hey! bad programmers!

by Evil Buck on June 22, 2010

Listen up. Yea you. Please stop writing code that intermixes presentation with data. Please, please don’t create a class that abstracts out the model and then rely on POST superglobals! Damn! What was the point of writing that class anyways? Coupling is bad. Now I can’t reuse this >:/ .

Yea, I’m on a project that looks like it was written in the late 90′s. Only…it wasn’t. Written in PHP with intermixed presentation and data handling all over the place. Tracing through it is necessary to find out what the hell was going on. My favorite is this method that takes all the fields pulled from a database and pollutes the global namespace without a care. Something like:

foreach($db_object as $k => $v) { global ${$k} = $v; }

I know everybody starts somewhere, but damn! Why was this person ever put in control of a project? It’s guys like this that give the rest of us a bad name. I must say, he really helped set the bar low for my client though. Too bad he doesn’t have a clue how bad that is :( .

There are plenty of books out there. Plenty of resources. They are cheap too. Hell, a Lynda month membership is $25. You don’ t even have to read for that. Go to the library and pick up some books. That’s free! Please write some code, then have others check it and critique. And please don’t be sensitive about your code. Everyone improves, everyone was there once, and everyone has written some quick code or not known about the “most elegant” way to write some piece of it. Take the criticism and improve.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Leave a Comment

Previous post:

Next post: