Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
February 9, 2005, 3:46 am
rate this thread
Re: learning object-oriented programming w/ PHP - any good exampleprojects?
phpPeanuts is an OOP framework that comes with a tutorial and examples.
It is the third generation of a framework i started to develop because i
when i started with OOP i had just done a self study on knowledge based
systems and was very interested in the use of abstraction. When my
experience with real world applications grew i learnt that smart use of
abstraction was not only the key to software reuse, but also to
object-oriented design (OOD) for maintainable and flexible systems. The
fact that the framework has been rewritten twice from the bottom up has
substantially improved its design.
The design documentation is limited to some essential principles (MVC,
user interface compostion), class diagrams and the 'what is' section of
the website. This is because the focus is to help you get started in
practical application development. If you need theory, there are good
books on system development methods, design patterns, algotithms,
refactoring, test driven development, etc. Read them! But they will not
do much good if you do not find ways to apply the theories. You need
ways to make choices between the many design options. You need
experience with how bad design bites you when you have to maintain and
extend real life software.
When you build a substantial application and refactor relentlessly
(improve its design by the elimination of repetitive code and patterns)
you will probably end up with a framework. Therfore frameworks offer a
practice oriented aproach to learning more about OOP and OOD. With
phpPeanuts you can start off with converting a simple application design
allmost 1 to a domain model in php. PhpPeanuts will take care of
storing and retrieving your objects to/from the database and give you a
default user interface. From then on building an application in
phpPeanuts is essentially a matter of selectively extending and
overriding the default behavior of the framework and extending and
refactoring. By constantly looking at phpPeanuts from the perspective of
extension and specialization we hope you develop a habit of looking at
your own code too with the question: how can i make it extendable and
See it like a city: It is one thing to read a traveling guide and seem
some tourist attractions, but really living there is a different matter.
By doing so you get to know it from the bottom up. PhpPeanuts essentally
offers you a map, a starters guide with some examples, some practical
adivice and off you go. It is immanent that there will be times that you
will feel lost in the big city. To help you with that there are the
Hypercode Browsers on the website will help you to learn about the
framework by allowing you to searching for polymorphisms, with wildcards
and scope control. Yes, you will have to read code. Much of the details
are "undocumented". The "why" is usually not explained either. But the
code consists of small methods with explanatory names. With the
hypercode browsers you can move around through the code following method
calls in both directions, and quickly find inherited and overiding
methods. Every time you find a way to get your application do what you
want it to do by just overriding the smallest possible pieces of
framework behavior, you know another "why".
Nowadays most developers work in teams, on applications that have a
history, and therefore a legacy. Learning to find your way in other
peoples code is probably just as usefull as learning design principles.
Only once you know how effective ill-written code can hide a design (and
how you can by tricked by that into hopelessly wrong directions) you
will be really motivated to make your own code communicate its design. I
guess by then you are a skilled OO Developer.
Of course you will also run into limitations of phpPeanuts. Some of them
are introduced deliberately to keep te framwork simple and learnable.
Others are only there becuase i could not figure out how to build it
better at the time it was built. Software is never finished. Please
inform me if you find design limitations that really limit the ways in
which you can override and extend the framework!