This page was originally included in On not using the "right" standards, but there have been so many references to it that I have decided to make it a separate article in its own right.
Since a major motivation for object-oriented programming is software reuse it should follow that every methodology, principle or practice should be graded according to how well it contributes to the production of reusable software. It should not be graded subjectively according to someone's opinion, it should be graded objectively using criteria which can be measured scientifically. In other words, something should not be regarded as "best practice" unless it produces the "best results", which for OOP means the most reusable software. Why is reusability so important? Because it has a direct effect on a programmer's productivity:
I explain the importance of productivity in Programmer Productivity takes Precedence over Paradigm Purity.
Let me prove my superior productivity with an example and a challenge. Every database application consists of one or more databases containing one or more tables, and each table has its own set of columns, keys and indexes. Tables may be related to other tables in what are known as relationships where one table (the child) contains a reference (known as a foreign key) to another table (the parent). Relationships will also require some form of referential integrity.
In order to maintain the contents of a database table the application software will have a number of user transactions (sometimes known as "tasks" or "use cases") each of which will perform one or more actions on one or more tables. In an online system each task will communicate with the user by means of a User Interface (UI), also known as a form or screen, on a client device such as a PC, tablet or smart phone. Each transaction will have a name which is meaningful to the user, such as "Create Account", "View Account" or "Pay Invoice", and these names will appear on some sort of menu system which enables the user to quickly identify and activate the relevant task for a specific business operation. In my own enterprise application, for example, I have over 400 database tables and over 4,000 tasks.
Suppose I add a new table to my application database and then want to implement a standard family of CRUD forms as shown in Figure 2:
Figure 2 - A typical Family of Forms
I can create this family of forms in less than 5 minutes simply by logging on to the framework and following the Generate PHP component scripts process which exists within the Data Dictionary. This will create those tasks at the touch of a button without the need to write any code at all - no PHP code, no HTML code, no SQL code. Since a major motivation for object-oriented programming is software reuse it should be obvious that the more code you can reuse then the less code to have to write, and there is nothing smaller than no code at all.
Each of the six components above will perform a single transaction on that single table. The LIST and ENQUIRE tasks will perform a READ operation on that table, the ADD will perform a CREATE, the UPDATE will perform a READ and an UPDATE, the DELETE will perform a READ and a DELETE, while the SEARCH will supply data which is used by the LIST1 task to filter its results. Note that each task in that diagram is a hyperlink which will take you to a full description of their structure and behaviour.
As well as constructing the six new components they should also appear as options in the application menu so that they can be run immediately. The parent LIST task should be made available on a menu screen, while its associated child tasks should only be available as options on the navigation bar within the parent task.
Here is the challenge: using your favourite framework how much code would you have to write to implement that family of forms and how long would it take? If you have to write ANY code, or it takes longer than FIVE minutes then I'm afraid that you can back up your bags and go home as you have failed! If you cannot achieve in 5 minutes what I can, then you are obviously writing too much code, which means you have less reusability which means that you are not achieving the objectives of OOP. This can only mean that your methods are inferior to mine. Rather than telling me that I am not following your version of best practices you should be asking yourself why my practices are producing better results.
A full description of the steps involved is available in the following places:
If you think that building the forms to maintain the contents of a single table is not much of a challenge then here's a bigger one for you.
Before I came to build my first enterprise application as a package which could be sold to many customers instead of building a bespoke application for just a single customer I knew that I would need a database design that was both comprehensive and flexible. Anyone who has attempted to build a package knows that trying to satisfy the needs of multiple organisations with a single piece of software can be quite difficult as each organisation has its own way of doing things. The software therefore needs to support multiple options so that the application can appeal to as many potential customers as possible. I needed to base this package on an industrial-strength database, so I chose the designs in Len Silverston's Data Model Resource Book. As soon as I read this book I could see that it offered a wide range of options and that it would be a solid foundation for my software. I chose six databases from the book and developed a separate subsystem around each one. These database were as follows:
After creating each database I imported it into my Data Dictionary, created the table class files, then proceeded to create the tasks for each table from my library of Transaction Patterns. I modified some screen structure files to make cosmetic adjustments, then filled in some "hook" methods with custom logic to deal with the business rules. This business logic was not covered in Len Silverston's book, so I had to draw on my past experience with previous applications. From start to finish this whole exercise took me six months to complete, which gave me an average of one man-month per database, after which I had a system good enough to demonstrate to my first customer. What could YOU achieve in one man-month using YOUR favourite framework?
I have read that some software houses with teams of expert programmers can take several man-years to complete equivalent projects, so my meager efforts are not to be sniffed at.
Here is a response form one of these so-called OO experts which first appeared in Response to personal attack on reddit.com.
In this comment the same Hall_of_Famer made the following claim:
I am a better and more productive programmer because almost everyone on this reddit will agree with me
to which I answered:
Where is the proof? Where have you posted any code samples that you have written so that people can judge for themselves instead of having to take your word for it?
He responded with:
Not like you can prove you are more productive at all.
I informed this person of questionable intelligence that the "proof" could be found in this challenge where I demonstrate that using my framework I can take the definition of a database table, load it into my Data Dictionary at the press of a button, create the class file for that table at the press of a button, then create and run a family of six tasks to maintain the contents of that table at the press of another button, all in the space of 5 minutes and without having to write a single line of code - no PHP, no HTML and no SQL. That is the level of productivity which *I* can achieve, so if you think you are more productive with your methods then you have to prove it by improving on that 5 minutes. Instead of putting his money where his mouth is he bottled out by saying:
I will not take on your challenge since you ain't qualified to make one
Not qualified!!! Excuse me, I have been programming with PHP for many years. I single-handedly designed and built a framework for developing database applications which I released as open source in 2006. I used this framework to single-handedly build an ERP application in 2007 called TRANSIX which has subsequently grown into the GM-X Application Suite, which is now sold all over the world. This framework has won multiple awards. What have you ever written which can complete with that?
That just proves to me that he is all mouth and no trousers, someone who can talk-the-talk but not walk-the-walk, he is all wind and piss.