Wednesday, March 14, 2007

Best Practices

The reason I am being so weird at the moment (see last post) is the nature of the project I am working on. I am currently moving a collection of community web sites from one host to another. The sites average from 20,000 - 30,000 page views a day. At currently market rates, the site would have to have about 300,000 page views per day to generate enough revenue for one minimum wage job. IMHO, The sites are still valuable as they provide a community service. The sites provide people in the community who would otherwise not be heard a venue to list their site.

My orginal market plan for Community Color was to pound out a quick prototype site hosted on a discount web server, get market feedback, then write a "real" application in Java. PHP is the ideal prototyping language. It is quick, dirty and easy to support. Now, the first iteration of the program was a quick and dirty prototype. For a variety of reasons, I wrote the prototype as a collection of procedures, and not with object oriented programming techniques. I can feel people trembling ... the horror, the horror.

Writing Object Oriented style code is considered best practices.

I feel the intellectual elite of the programming world snubbing up their collective noses at the idea of someone intentionally designing a web site with old style programming techniques. The horror, the horror.

Anyway, during my current move, I am upgrading from PHP 4 to PHP 5. During the move, I thought I would upgrade from procedures to objects.

Guess what? I am finding that I like the procedural style code better.

Best practices dictates that all computer programs must be written in object form.

I find myself wanting to tell the world why I don't think object oriented programming is the right solution for all applications. In my opinion, oop is not the right solution for web based programs written in a scripted language.

IMHO, the sentiment that object oriented programming is the best solution for all programming problems is an unwarranted absolutist statement. For that matter, as I look back on the evolution of programming, I think that the overemphasis of object oriented design is a cause for many buggy programs that exist today.

I believe that the programming world is best served by a diversity of programming lanugages and programming styles.

Since programming techniques have an affect on society at large, I think that this is a topic that people outside the programming world would find interesting.

I am being weird because I am thinking about how one would make my case to the world.

PHP is a programming language that is immediately available to new programmers. A run of the mill, internet savy computer user can learn PHP 5 and start using it to add functionality to a web site within hours. It is a programming language that I would encourage casual internet.

I think it would be fun to present the case for procedural v. oo programming in a structure that encourages internet users to learn PHP and HTML.

Several years ago, I pounded out a quick and dirty syllabus for a class on PHP. This was a quick seven part tutorial for a general audience. The course was written for HTML 2.0 (old style HTML). I was thinking of writing a new tutorial for PHP 5 and DHTML.


Charles D said...

At one point a few years back, I thought that programming would evolve into ever higher levels of code so that the actual construction of an application would become rather simple. Maybe the programming world decided that was too threatening.

Now I find that we are all supposed to do Java or Ruby or some other OOPy language. I never learned PHP, but like the procedural languages just fine. You can learn them quickly, get your job done and move on.

y-intercept said...

I thought that programming languages would be getting easier with time as well. For that matter, they were getting substantially easier up until about the time of the release of Windows 3. At this time there was a major rethinking of what a programming language should be, then things started getting substantially harder.

The funny thing is that the new think about programming was supposed to make it so easy to program that people could program without knowing anything at all about what you were doing.

The first windows programming languages had all sorts of things where you could "paint a screen" and that screen would have limited functionality. The program would blow up in your face as soon as you tried to getting any deeper than the limited functionality.

OOP was introduced with the hype that it would push programming to the next level and make programming something that drunk monkeys could do. My experience is that casual programmers had a better grasp of procedural programming. The OOP revolution had to opposite of its intended effect. Instead of decreasing complexity, it greatly increased the complexity of programming.

OOP simplifies somethings, it adds complexity to other things.

BTW, I think you are right that parts of the programming community intentionally want to raise the bar of entry for programming. The professionalization of all industries involves raising the bar entry; thus making the inner core of the profession wealthier.

(This is actually a good example for what I consider to be the difference between the free market and capitalism. A professional group that artificially raises the bar of entry into their profession is the antithesis of the free market. The professional society reduces freedom in society at large; However, it would be part of capitalism: The members invest their political clout to increase their wealth.)

Charles D said...

What you said for a professional society can equally apply to a corporation. The capitalist market is not one marked by competition, but one in which the goal of the players is to eliminate competition. When a market is dominated by a small number of players, they often work to raise the bar to entry so that entrepreneurs cannot afford to bring new competitive ideas to market.

Whether that applies to Java programmers, I can't say.

y-intercept said...

BTW, I don't think that higher bars of entry is necessarily a problem. If a company creates an innovation that improves the quality of their product, they raise the bar of entry for the industry.

I think there are concerns about what raised the bar.

Quality improvements or cost cutting measures that raise the bar of entry into a market are usually good things. If a group in an industry colludes to lock out competition, then it is usually a bad thing.

There is a good argument that big corporations take all sorts of antimarket steps to lock out competition. Unfortunately, what seems to happen is that people try to correct the affects of antimarket measures by introducing even more antimarket measures, and you've laid the market to waste.