mikusan wrote:So you are saying that if i have many functions that do the same thing "technically" or are "related" to each other in some way then i should organize them into a class...
This kind of thing does make a lot of sense. If you base your design on the RDD (Responsibility Driven Design) approach, then this is right in line with it. Basically, organize bits of code based on what it's responsible for, whether or not they are objects!
mikusan wrote:
...that brings up the next question, what if i took all my program apart and wrote it as a class with a bunch of extends...
This sounds as though you are getting dangerously close to what's called a God class. One where everything is thrown into it, normally including the general logic of the program. This is an extreme no, no. You also have to keep in mind method calls are around 10 times slower than function calls, and ops on referenced vars are around 2 to 3 times slower. That said, having everything work from some uber class is bad from the viewpoint of design and performance.
mikusan wrote:
then technically it would function as my includes right now, perhaps i see that this way i would not always call all of my functions but only the ones i need that instant, i could see that as a bonus... but frankly editing a class based program seems much harder to me than a bunch of funcitons... correct me if i am wrong...
If what we are talking about is a God class, then you're correct. Everytime you make a change to that class, you're affecting the entire program and the likelyhood of foobar'ing something is extremely high.
On the other hand, if there are a collection of classes, or ADT's, or modules or functions, one only has to update or change the class, ADT, module, or function in question.
A perfect example is an airliner. A 777 is capable of carrying a number of different engines under wing. These different engines have different strengths, weaknesses, and performance characteristics. However, any of them can be changed out in a manner that is transparent to the pilot and the rest of the plane for that manner because how the different engines connect to the plane is through a consistent interface.
That said, a db connection object in your code should be the same way. You should be able to connect to any db on the planet by simply changing that object. Furthermore, how those objects interace with the rest of the code should be consistent. A mysql db connection object should look exactly like an oracle db object from the interface point of view. I hope that's clear.
mikusan wrote:
Now then this means that i am not OOPing though i would like to... then wat kinda style would mine be called?
I wouldn't yet worry about that. However, I do suggest that you look into concepts such as Responsibility Driven Design (RDD), Object Oriented Design (OOD) (which in my opinion is an analog of RDD), and other things like Orthogonal Design.
Also, Patterns and Anti-Patterns both are very helpful. One thing to keep in mind though is that the use of Objects is
NOT required for good design! However, you may want to be careful with that last statement as I've gotten myself into trouble with it.
Cheers,
BDKR