Tony Marston's Blog About software development, PHP and OOP

A challenge to see who's technique is best

Originally posted on 13th December 2016 in On not using the "right" standards
Reposted on 21st November 2024 by Tony Marston
Introduction
The challenge itself
A response to my challenge
Comments

Introduction

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.


The challenge itself

Since a major motivation for object-oriented programming is software reuse it should follow that every methodolgy, 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 reults", 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

LIST1 ADD1 DELETE1 ENQUIRE1 SEARCH1 UPDATE1 dialog-types-01 (1K)

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:


A response to my challenge

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 aint 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.


counter