The Myth of “Good Code” – blog.phpdeveloper.org » PHP

There’s an interesting dichotomy in software development – anyone wh has spent any amount of time in the field knows it all too well. There comes a point in every project where you have to make a choice – good code or fast code. Sure, you’ll get those “sweet spot” projects that’ll let you work on the “good code” side of things for as long as you’ll need (maybe a personal project?) but more often than not, you’re going to fall on the “fast code” side of the line. It’s sad, really it is.
Every good developer knows that the world could only benefit from having more “good code” in the world. Applications would not only do what they’re supposed to to but they’d do it well and have better performance while doing it. Things would flow smoothly through the paths the user laid out in the planning stages and everything would be magically delicious. Right? Sadly, even when you have the time to make the “good code”, it’s still not that good.
First off, throw out those personal projects – the timelines of those don’t really apply anyway. You can hack away at a framework you’re developing for years and only get most of the way done with it. Unless it gets some kind of larger following, chances are people aren’t going to be putting the pressure on you to make updates and add new feature. The whole realm of personal project timelines is an interesting one – maybe something I’ll look into later on. For now, though, we’re going to focus on software someone else wants you to write. This is where the major part of the problem is – it’s someone else’s timeline, someone else’s thoughts you’re trying to put into code.
I can’t tell you the number of times that I’ve been working on a project and have hd nothing but the best of intentions of how it was going to turn out. I’d planned out the pieces, worked up descriptions of the objects involved and laid out how they’d all integrate together. The code was well-structured and was something that could be both easy to maintain and simple to expand – that is until the customer decided to get involved.
If you’ve worked on any kind of larger project for any length of time, you know the cardinal rule – the customer never knows what they want. Even when they say they do, show them a demo. Their minds will freak out with new possibilities and new features that were never even conceived of in the first versions you’ve developed. Now, this isn’t so much of a problem if you have the customer/client reined in to keep these sort of things under control, but if you don’t…let the bad code pour in.
It never fails – at least one of the new features that the customer proposes as a “strongly like and might need” for this version will go against the code that you’ve already written. I don’t think I’ve ever heard of a project that was able to augment what they were doing mid-stream (yes, even you agile folks) to accomidate every request the customer could make. Some things are easy, but most of these sort of changes are hard.
This is when it gets very hard to keep that “good code” in place. It takes a lot of practice and skill to keep things flexible enough to make the impact of these sort of changes minimal. Writing good code from the beginning is easy – making that good code stick through to the end is hard.
How hard are you willing to work to keep that code good?
Photo credit snappED_up
Seriously, Australia? SERIOUSLY?
I recently bought an Internet radio gadget that lets me listen to Australia’s Radio National while sitting and knitting on my back porch, away from my computer(s). This afternoon I was doing exactly that when I heard a lengthy interview with th…
Looking for 2 PHP Developers in Montreal (Senior and Intermediate) – Ron Yayli
I’m looking again to hire PHP developers.
Common stuff:
- You must be living in or around Montreal!
- You are not a freelancer looking for a contract job. These are full time positions.
- You must love music, games, pool, PHP
For Senior PHP Developer
- You have at least 5 years of PHP experience within a team.
- You are very proficient in Javascript.
For Intermediate PHP Developer
- You have at least 2 years of PHP and JAVA experience within a team.
- You can integrate html and proficient in CSS. Can handle browser issues, mobile browsers etc.
If you are the one, please contact me at hyayli _AT_ touchtunes.com with your resume/CV.
Steve Holden: Google Mail Weirdness
I’d be delighted if somebody could explain what the hell’s going on here. I switched mail for the holdenweb.com domain to run through Google’s Gmail for Domains service. Things had been going quite nicely, and the spam levels had reduced amazingly without me having to apply any external filtering (which makes me wonder just exactly why Google Groups is so clogged up with the output of asshole spammers, but that’s another post).
Recently I have started to receive replies to emails sent out from my holdenweb.com account in the Gmail mailbox I have used for years. At first I though this might be Thunderbird (or me) getting my email accounts and personalities mixed up, but it appears this isn’t the case. Here’s a test message I sent to myself as an experiment, as it looks in my Sent folder:
So it definitely looks as though it went out from holdenweb.com. And here’s the same message as it arrived in my Inbox:
So it goes out from my holdenweb.com address, and arrived at the recipient from my gmail.com address. That’s pretty evil, Google – or is there some obvious way I am shooting myself in the foot? It’s making my mail conversations pretty hard to track right now.
Steve Holden: PyCon is Coming

Kirby Urner suggested that the PSF should advertise PyCon at airports. I though this was a great idea until I looked into the cost of hiring the billboards. Thanks to the wonders of modern web technology, however, we can all now see what it would be like to advertise PyCon on buses.
My slogan is probably pretty feeble. Can you do better?
PHP: So you’d like to migrate from MySQL to CouchDB? – Part I – till
This is the first part of a series. I’ll start off by introducing CouchDB — from a PHP side, then I’ll demo a couple basic use cases and I later on, I’ll dive into migrations from MySQL.
My idea is to introduce CouchDB to a world where database-driven development generally refers to MySQL. By no means, this is meant to be disrespectful to MySQL, or SQL-databases in general. However, I’m a firm believer in using the right tool for the job.
First things first!
First off, before using CouchDB and maybe eventually replacing MySQL with it, we need to ask ourself the “Why?”-question.
And in order to be capable of more than a well-educated guess we need to familiarize ourselves with the CouchDB basics.
Basics
- Document-oriented and schema-less storage.
- Erlang (for rock-solid-scaling-goodness).
- RESTful HTTP-API (we’ll get to that).
- Everything is JSON – request data, storage, response!
Document-oriented
In a document-oriented as to opposed to a relational store, the data is not stored in table, where data is usually broken down into fields. In a document-oriented store each record is stored along side and can have its own characteristics — properties of any kind.
As an example, consider these two records:
Till Klampaeckel, Berlin
Till Klampaeckel, till@php.net, Berlin, Germany
In a relational store, we would attempt to break down, or normalize, the data. Which means that we would probably create a table with the columns name, email, city and country.
Consider adding another record:
Till Klampaeckel, +49110, till@some.jabber
(Just fyi — this is not my real phone number!)
Looking for an intersection in the records, the name is the only thing this record has in common with the previous two. With a relational database, we would either have to add a column for phone number and chat, or we would start splitting off the data into multiple tables (e.g. a table called phone and one called chat) in order to get grip.
With a document-oriented database — such as CouchDB — this is not an issue.
We can store any data, constraints do not apply.
Erlang
Erlang was invented a while ago, by Ericsson, when it was still sans Sony. In a nutshell, Erlang’s true strength is reliability and stability. It also manages to really utilize all the resources modern hardware has to offer since it’s a master of parallelization.
CouchDB is written in Erlang, and also accepts view code written in Erlang. More on views later.
RESTful HTTP-API
For starters, a lot of HTTP-APIs claim to be RESTful, most of them are not. HTTP has so called request verbs (DELETE, GET, HEAD, POST, PUT among them) and a lot of APIs don’t use them to the fullest extend, or rather not all.
Instead, most APIs are limited GET and maybe use a little POST. An example of such an API is the Flickr API.
Most of us are familiar with GET and POST already. For example, when you opened the web page to this blog entry, the browser made a GET-request. If you decide to post a comment later on — you guessed it, that’s a POST-request.
Aside from its basic yet powerful nature, HTTP is interesting in particular because it is the least common multiple in many programming language. Whatever you use — C#, PHP, Python, Ruby — these languages know how to talk HTTP. And even better — most of them ship pretty comfortable wrappers.
JSON
JSON — it’s godsend for those of us who never liked XML.
It’s very lightweight, yet we able to represent lists and objects, integers, strings — most data types you would want to use. A clear disadvantage of JSON is that it lacks validation (think DTD), and of course comments — ha, ha!
Why, oh why?
So along with “Why?”, we should consider the following:
- Does it make sense?
- Is CouchDB (really) the better fit for my application?
- What is my #1 problem in MySQL, and how does CouchDB solve it?
And if we are still convinced to migrate all of our data, we’ll need to decide on an access wrapper.
It’s all HTTP, right?
By now, everyone has heard that CouchDB has a RESTful HTTP-API. But what does that imply?
It means, that we won’t need to build a new extension in PHP to be able to use it. There’s already either ext/socket or ext/curl — often both — in 99% of all PHP installs out there. Which means that PHP is more than ready to talk to CouchDB — right out of the box.
Since I mentioned JSON before — today
Truncated by Planet PHP, read more at the original (another 925 bytes)
Dave Beazley: Ultimate Python Quickstart Guide
As the father of a toddler and a newborn, I’ve been getting my fair share of practice putting together various sorts of baby accessories (strollers, bassinets, cribs, etc.). It has inspired me to write this ultimate quick start guide to getting started with the Python programming language. I hope that you find it to be as incredibly useful as I have.
Congratulations!
Congratulations on your wise decision to use Python! Follow this quick and easy guide to get started.
(a) Get

(b) Click
(c) Run
(d) Code

Enjoy your new Python interpreter!
Perl Survey downloads
A handful of people have asked me recently where they can download the reports and data set for the Perl Survey I ran in 2007, now that the domain name has expired.
I’ve put them all up here on Infotrope and you can get them at http://infotrope….
what is pod weaver? (pt. 2: pod weaver and you)
So, yesterday I wrote about Pod::Weaver’s history. Today, the much more useful topic of “how to use it now that it exists.”
I try to write classes that define objects in terms that you can think about as actual objects: machines that perform a given …
Ted Leung: 10 Years of Apache
November is just around the corner, which means that once again it’s time for ApacheCon US. This year is a special year for the Apache Software Foundation – its 10 year anniversary. Since I got involved with Apache just a few months after the foundation was created, it is also my 10 year anniversary of being involved in open source software.
This year I am going to be speaking twice. On Wednesday I’ll be speaking on the Apache Pioneers Panel, and on Thursday I’ll be giving a talk titled How 10 years of Apache has changed my life. I owe a huge professional debt to the ASF and its members and committers, so in my talk I’ll be interweaving important events in the life of the foundation with my own personal experiences and lessons learned.
Unfortunately, I’m not going to be there for all of the conference this year – I’ll be arriving Tuesday afternoon and flying out on Thursday evening. If you want to meet up, I’m in the ApacheCon Crowdvine, and I’ll be around with camera in hand (and on the LumaLoop).
keep looking »Warning: include(/home/elamp/enterpriselamp.org/wp-content/themes/Enterprise_LAMP/r_sidebar.php) [function.include]: failed to open stream: No such file or directory in /home/elamp/enterpriselamp.org/wp-content/themes/Enterprise_LAMP/archive.php on line 23
Warning: include() [function.include]: Failed opening '/home/elamp/enterpriselamp.org/wp-content/themes/Enterprise_LAMP/r_sidebar.php' for inclusion (include_path='.:/usr/local/php5/lib/php:/usr/local/lib/php') in /home/elamp/enterpriselamp.org/wp-content/themes/Enterprise_LAMP/archive.php on line 23
