Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-4041-

I bet /prog/ is full of OOP pigs like this.

Name: Anonymous 2009-10-24 15:23

http://phpbuilder.com/board/showthread.php?p=10931946#post10931946

Everyone laugh at the retarded OOP ricer.

Name: Anonymous 2009-10-24 15:23

tl;dr

Name: Anonymous 2009-10-24 15:33

lol it looks like he started designing before programming

what a newbie, real men program from the beginning to the end

Name: Anonymous 2009-10-24 16:00

>>1

why are you even reading that shit

Name: Anonymous 2009-10-24 16:29

Some of us on /prog/ have to code for a living.  We can't write unmaintainable one-off single-author projects.

Name: Anonymous 2009-10-24 16:31

Name: Anonymous 2009-10-24 16:43

>>5
write unmaintainable
Dear Sir, I cannot fathom what would prompt such a thought!

Name: Anonymous 2009-10-24 16:45

>>5
Lack of what is understood in the mainstread as OOP does not make something unmaintainable, on the contrary, some things may even be better that way.

Name: Anonymous 2009-10-24 16:56

I bet he's some tard who just learned about OOP.

"When all you have is a hammer, everything looks like a nail."

Name: Anonymous 2009-10-24 17:10

When all you have is a cudder, everything looks like an anus.

Name: Anonymous 2009-10-24 17:14

When all you have is a haskell, everything looks like a dead dog.

Name: Anonymous 2009-10-24 17:16

When all you have is an anus, everyone looks like a hax0r.

Name: Anonymous 2009-10-24 17:33

ENTERPRISE QUALITYWEB 2.0

Name: Anonymous 2009-10-24 17:54

ENTERPRISE MY ANUS 2.0

Name: Anonymous 2009-10-24 20:38

yes.
well on one hand we have frozen void.
and on the other we have this guy.
two complete opposites, but both as absurd as the other.

Name: Anonymous 2009-10-25 1:50

You're abusing OOP horribly. Not everything needs to be encapsulated. The OP's simple project doesn't need class inheritance.
Defend yourself: http://dis.4chan.org/read/prog/1256412188/1-40


fail, you can't even troll. gtfo

Name: Anonymous 2009-10-25 18:16

Name: Anonymous 2009-10-25 18:38

To all responders, please keep any further responses limited to constructive suggestions/criticisms germane to the original post and avoid anything which might be perceived as inflammatory (whether intended or not).

Name: Anonymous 2009-10-25 18:40

>>18
I want to register just to post "Hax my anus!".

Name: Anonymous 2009-10-25 19:13

shell_exec(2girls1cup)

Name: Anonymous 2009-10-25 20:21

So you cannot come up with anything else other than petty insults, then you drop a link to /prog/ hoping we will argue your case since you're too retarded.
This is neither /b/ nor your personal army, please kill yourself and IHBT.

Name: Anonymous 2009-10-25 21:23

>>18
WHY IS HIS SIG BIGGER THAN HIS POST?!!?? Fucking 12 year olds

Name: Anonymous 2009-10-26 0:29

>>20
I noticed that. He has got to be a troll.

WHBT.

Name: Anonymous 2009-10-26 3:00

DESIGN MY ANUS


I'm not saying that you are, but these small tips require extensive code. I do not get why everybody thinks I'm being arrogant.

I will give it a go:

This project is probably best being designed in an Object Orientated (OO / OOP) design and doesn't require a framework, but I would suggest it, cause projects like this tend to get complex quite quickly. The following in no specific order...

1.1 - Auth object

1.2 - Validator Object

1.3 - Debugger Object

1.4 - Uploader Class / Interface
1.4.1 - Image subclass extends uploader class
1.4.1.1 - GIF subclass extends Image class
1.4.1.2 - JPG subclass extends Image class

1.4.2 - Compressed_Files class extents uploader class
1.4.2.1 - ZIF subclass extends Compressed_Files class
1.4.2.2 - RAR subclass extends Compressed_Files class
1.4.3 - PDF Class

1.5 - Database Class

1.6 - View Page
1.6.1 - Forms
1.6.2 - Images
1.6.3 - Hypers
1.6.4 - Content
1.6.5 - Menus
1.6 ---- continues forever lol

1.7 - Back End (like view, but only you can view it)

Ok this is just what I can think of at 2am...

Explaining this. lol

The design process of this should be done in 'reverse'. Thinking ahead is important with this style of programming. Start with a gameplan, an overall picture of what you want from your application, then break it down (like above). What do you want each class to achieve, how do we achieve that? What do we need to do? Will a snippet do it or do I have to design a function set for it? If the latter, what functions should I create to achieve my goal? Will this affect anything I've done before? Do I need to extend this class? Will something else work better then what I'm currently doing (which happens more often then you would think). Just a few questions, but so many more after this.

"To know your enemy, is to know the outcome of war"

I have that above my pc on the roof. Gets me thinking about a problem; by whatever means, whether it be research, trail and error, prior knowledge, help from others, I just want to know my enemy.

Database:
Ok your database object will have a handful of useful functions that handle all your db workings. This includes although not limited to, the active db connection(s), queries, fetch arrays, num rows so on so forth.

Validator:
Your validator class will include a function for each of the different inputs, data types and possibly even your cleaner functions, also will be used in close conjunction with your database class because validation and user inputted data going into a database is a law... Functions including but not limited to, is_array, is_numeric, is_bool, strip_tags so on so forth.

Debugger:
Debugger class is what the name says, functions that test your code for errors, elevated error reporting levels and alike are in here. Assure this is not used once the development process is complete.

Uploader:
This should probably be a interface for flexibility, but that’s just me, others will disagree. Although I will explain it as a static class because it covers both types and most that do not know any different won't be able to tell the difference.

This 'parent' class should contain your lets call them, 'global methods' within the scope of your class hierarchy. Meaning, the set of functions within the uploader class will be accessible anywhere within the classes that EXTEND it; in this example, the image (including gif and jpg/jpeg child classes), compressed_files (including zif and rar child classes) and the PDF class.

Now, the functions within this parent class will not be defined, meaning this class is just a 'blue-print' for those that extend it.

Within the Child classes, img and compressed_files (C_F from now on), you will re-declare and define functions pre-defined in the parent class (being what, that’s right, uploader). Thus from this point on, they are functional (working, active, do stuff). These functions will still be somewhat small, maybe just choosing the child to goto, defined paths to directories that you will pass to the child classes from here and data validation & cleaning (validator class coming in again).

Now the confusing bit. These classes (img and C_F) are now the parents to their respective child classes. So img and C_F are now a functional parent class for classes jpg / gif and zip / rar. The parent classes (img and C_F) methods are now within reach of their 'children' using parent::testFunction(); , OR you can re-define them in the children if you wish (now we getting complex :P).

Now within these 'child' classes you will find most of your functionality, including the processing and uploading of the file itself.

PDF is unique due to it being the only 'type' of its kind. Thus it will contain all functions and abilities’ that are describe above, but doesn't extend to any child classes. So if a pdf file is uploaded, clean, validate, define directory paths etc etc all in the one place.

NOW some will argue that the extension beyond IMG and C_F classes are needless. You can make this choice, I just have a rule of thumb "the less flow controllers there are, the better".

Front End (view):
This is where all the magic comes together, what the general user can see despite the countless lines of code controlling it. Get a nice template, work your PHP into it so you do not have to change any your class scripts when you want to change the overall look of the front end site itself.

Back End (admin area):
This is your zone. Doesn’t really matter what it looks like as long as it works. This will include mini-scripts that display all your data that your users have uploaded, where its located, delete, moving, updating, sizes, and probably your own admin based uploading system :P All of this can possibly be done in your front end as well and its handy to have access to commonly used admin options there (delete, hide, move etc).


This was a 'brief' and hopefully non-complex description of classes and class inheritance.

I suggest you read up on Object Orientated Programming / Patterns, Working with files and directories, regular expressions, is_ type functions and I could on and on, I say this not to belittle you because I still have troubles with this sort of stuff

Ok. Now some might say that building a semi-framework for a project this size is overkill. Maybe, but from my experiences these sorts of projects have a way of becoming extremely complex extremely fast and it is always good to have a working, tested and debugged platform to work off and improve. Do the leg work now, save yourself the headache later.
(smoke break) brb 2mins lol

Just note this is a sort of basic example of classes and how they work. Parent classes may do A LOT more then was described in this, and more then likely that will be the case. Whatever the setup is, OOP is the best way to program (imo) and beats the old "top to bottom" style anyday.

Linkage time.
OOP
Regular Expressions
Files & Directories
is_ type functions
Programming Patters Take your pick of hundreds
Validation Tutorials, take your pick

I don't know why I wrote this much, it just happened. Hope this sheds some light anyways. Im going to bed now. Goodnight.

Name: Anonymous 2009-10-26 4:53

To the person who linked /prog/ on that thread, I honestly hope you die a horrible death, but not before being raped both anally and orally multiple times.

Thank you.

Name: Anonymous 2009-10-26 5:12

>>25
they did WHAT?
fuck, they actually did.
IHBMT

Name: Anonymous 2009-10-26 13:44

protip: If when given a programming problem you immediately start spewing objects everywhere, it's time to meditate and read SICP.

Name: Anonymous 2009-10-26 13:58

>>27
But then you'll have no problems.

Name: Anonymous 2009-10-26 13:59

>>24

Projects like this get hairy because of OOP clusterfuck. That is not to say that good object models are impossible or nonexistent, but PHP, C++, Java, C# are not one of them.

Name: Anonymous 2009-10-26 14:22

these sorts of projects have a way of becoming extremely complex extremely fast
It's "becoming extremely complex extremely fast" because that's what you turned it into, idiot.

I miss the days of simple design and efficient, concise code. Take the UNIXv6 utilities for example. What programmers back then could write in a few hundred lines and less than a dozen functions now takes thousands of lines and several dozen classes with a ton of methods in each, all linked to some huge "framework" that itself is full of useless shit.

Name: Anonymous 2009-10-26 14:23

>>30
You're an idiot.

Name: Anonymous 2009-10-26 14:30

>>29
What language has a good object model, then?

Name: Anonymous 2009-10-26 14:44

>>32
Scheme
BBCode

Name: Anonymous 2009-10-26 14:45

>>32
ANSI C

Name: Anonymous 2009-10-26 14:48

>>32
TROLLGOL[1] will have a fantastic object model, look forward to it.

--
1.http://dis.4chan.org/read/prog/1256142514/11

Name: Anonymous 2009-10-26 19:15

>>32
You're mom!

Name: Anonymous 2009-10-26 20:14

>>34
nothing is an object!

Name: !aNIgERyWIs 2009-10-27 1:18



                       _.-------.
     ----------------''       ,-.`-----.
                             ( X )      `-.
                              `-'  ,---.   |
                                  .     `---      ----->
    -----------------------.       `-.            |
                            `---------`  ----+----------
                                         | ctr() :
                       Can I suck your   | a()   :
                       UMLH today?       ----+----------
                                                 ^
                                                 |------

Name: Anonymous 2009-10-27 12:13

bampu

Name: Anonymous 2009-10-27 15:40

>>37
THE BEST THE BEST THE BEST THE BEST THE BEST THE BEST THE BEST THE BEST THE BEST THE BEST THE BEST THE BEST THE BEST THE BEST THE BEST THE BEST THE BEST THE BEST object model.

Name: Anonymous 2009-10-27 16:11

>>40
lol

Name: Anonymous 2009-10-27 16:35

>>24

1.1 - Auth object

1.2 - Validator Object

1.3 - Debugger Object

1.4 - Uploader Class / Interface
1.4.1 - Image subclass extends uploader class
1.4.1.1 - GIF subclass extends Image class
1.4.1.2 - JPG subclass extends Image class

1.4.2 - Compressed_Files class extents uploader class
1.4.2.1 - ZIF subclass extends Compressed_Files class
1.4.2.2 - RAR subclass extends Compressed_Files class
1.4.3 - PDF Class

1.5 - Database Class

1.6 - View Page
1.6.1 - Forms
1.6.2 - Images
1.6.3 - Hypers
1.6.4 - Content
1.6.5 - Menus
1.6 ---- continues forever lol

1.7 - Back End (like view, but only you can view it)

I began weeping.

Name: Anonymous 2009-10-27 16:41

>>42
I began weeping.

Learn English you faggot.

Name: Anonymous 2009-10-27 16:57

>>43
Nice quote failure you've got there, bro!

Name: Anonymous 2009-10-27 16:59

>>45
Yeah, sure, whatever, quotefag.

Name: Anonymous 2009-10-27 17:11

>>45
Hey, don't you mock proper quoting, redditfag bitch. Next you're gonna talk shit about BBCode, and I ain't standing for that.

Name: Anonymous 2009-10-27 17:24

>>46
SON OF A BITCH BBCODE
BBCODE IS PIG
DO YOU WANT A LIMITED FORMATTING?
DO YOU WANT A FORCED CLOSING OF TAGS?
BBCODE IS PIG DISGUSTING
BBCODE IS A MURDERER
FUCKING BBCODE

Name: Anonymous 2009-10-27 17:36

>>45

SELF FAILURE

Name: Anonymous 2009-10-28 3:48

>>48
__init__(self)

Name: Anonymous 2009-10-28 9:42

>>49
IndentationError: expected an indented block

Name: Anonymous 2009-10-28 10:34

>>50
HAHA.
PYthon is fuck.

Name: Anonymous 2009-10-28 11:00

>>3
/end thread

Name: Anonymous 2013-01-19 23:18

/prog/ will be spammed continuously until further notice. we apologize for any inconvenience this may cause.

Don't change these.
Name: Email:
Entire Thread Thread List