If you've always been challenged to write unmaintainable code, i.e. code you yourself won't understand anymore immidiately after completion or later, here's a tutorial:
http://thc.org/root/phun/unmaintain.html wrote:
In the interests of creating employment opportunities in the Java programming field, I am passing on these tips from the masters on how to write code that is so difficult to maintain, that the people who come after you will take years to make even the simplest changes. Further, if you follow all these rules religiously, you will even guarantee yourself a lifetime of employment, since no one but you has a hope in hell of maintaining the code. Then again, if you followed all these rules religiously, even you wouldn't be able to maintain the code!
You don't want to overdo this. Your code should not look hopelessly unmaintainable, just be that way. Otherwise it stands the risk of being rewritten or refactored.
This was written for Java, but just as nicely applies to PHP.
Btw.: If you haven't noticed the irony of that tutorial (or this post): you should always endeavour to have code-maintenance pretty much at the very top of your priority list when you code.
A friend of mine told me he does that and he was proof to me that this really does work and does give you repeat contracts. So I've been doing it for quite some time now and I must say, it's working for PHP also (though a Zend Encoder would make that so much easier).
That article is an instant classic in my eyes and should be in any freelancers bookmarks!
A friend of mine told me he does that and he was proof to me that this really does work and does give you repeat contracts. Very Happy So I've been doing it for quite some time now and I must say, it's working for PHP also (though a Zend Encoder would make that so much easier).
Don't think I need any help from Zend. My production code is definitely unmaintainable. Redundant data and code plus no white space or comments. However, what's on the server and what I maintain are two different things.
Buddha443556 wrote:
Don't think I need any help from Zend. My production code is definitely unmaintainable. Redundant data and code plus no white space or comments. However, what's on the server and what I maintain are two different things.
Thats funny. My "production code" at work looks like you could eat off of it. Sparkling, well-commented, OOP design..
The work I do off-hours for fun is just the opposite.. Procedural, hardly-commented, pile of legacy code and quick hacks.
Of course, I'm spending the time to make it more consistent, and less kludgy, so I feel the pain of unmaintainable code every day.
Some years ago a restaraunt chain that I had called on without result called me and asked me if I programmed in BASIC. After I told them that I did when doing so was unescapable they asked if I could come in that very day. Seems their programmer (all one of them) had quit without notice and the computer was crashing. They were unable to run payroll and the next day was payday.
Their computer was running interpreted BASIC (actually this was many years ago) and the programmer had done some sabotage before leaving. It took several hours to determine that, however, as I was wading through page after page of the most convoluted nonsense spaghetti code you ever could conceive of, with not one single comment in it. This programmer was of the "I'm going to prove how intelligent I am by writing code that is so complex that only I can understand it" school.
I actually managed to find the problem and get payroll done on time. But then I was there for, I think it was six months, on a full-time basis cleaning up the mess. First I had to find all the sabotage, which was of all kinds. Some caused crashes, but some simply caused bad output. This programmer had to have spent more than a full day inserting all the sabotage before leaving. Then I was re-writing code. I would take something that was like nine pages and rewrite it in a function that was twenty lines.
I never did figure out if the programmer wrote the code that way out of hubris or ignorance. But I had one of the longest contracts I had done at the time, and a few free steak dinners to boot.