A great read: Bad Programmers
Posted on 21 October 2011 by Demian Turner
A great read: Bad Programmers
Posted on 03 December 2010 by Demian Turner
Here’s a full transcript of the original email interview, some responses make more sense in context:
Am running a bit behind but here are my answers for your interview, please let me know your feedback and if this gets published:
–What advice would you give to a developer just starting to learn PHP?
– keep on top of best practices including a healthy approach to security
– read the code of seasoned devs, there’s always a better/cleaner way to do things
– ensure your code is human readable, if you can’t understand it 6 months later, how will it be for other devs
– always try and simplify your interfaces, it’s much more difficult to write simpler code but consistent refactoring will save you a lot of time and headaches when it comes to maintenance
– don’t reinvent any wheels, you will always have more than enough to program, use reputable libraries whenever you can avoid writing the code yourself
– read up on some of the great programmers (eg: http://www.codersatwork.com/) and find out how they stayed passionate about the art of programming so many years later
–In your opinion, what’s PHP’s biggest strength? Biggest limitation?
I think it’s easier to start off with its biggest limitation first: so many people criticise PHP that you’d be tempted to think it’s a rubbish language; that couldn’t be further from the truth. The biggest limitation is _aspects_ of PHP are easier to learn than comparable aspects in other languages, so PHP attracts a lot of “developers” who don’t have a clue, write horrendous code, show their ignorance in forums and generally dangerously decrease the signal to noise ratio for the rest of us.
When I first started with PHP in 2000 I remember discovering of project by a German developer that struck me as very well designed yet according to the critics this should have been impossible:
– it was done in one of the earliest versions of PHP4 (4.0.0, released in 22 May 2000, http://php.net/releases/index.php) yet still displayed all the sophistication of someone who understood software engineering
– the language itself supposed had all sorts of limitations and defects that meant using it for OOP was technically impossible: wrong
See for yourself, still not updated since 2000 and still probably better than most PHP that gets written today:
The point is a simple one: if you’re a developer who has the discipline to learn about software development, PHP can be an excellent tool.
The strengths of the language are simple and obvious:
– it stays close to its C roots while removing some of the unnecessary pain points like memory management, pointers and the compile cycle
– the OOP implementation is simple, elegant and easier to read than its peers
– the Java mantra of “complexity at any cost” is nowhere to be found, concise method names are used throughout
– libraries and extensions exist for pretty much every technology on the planet
– hacking activity and community participation most likely the highest of any programming language
There are however a few difficult situations that are directly linked and result from the above positive list:
– there is too much choice when it comes to selecting a library or framework to work with, and the information available is often biased and unreliable (posted by teenagers) so a lot of time can be wasted searching for quality
– the core development team is somewhat hysterical and not professional at times which has resulted in backwards compatibility being broken often, and in unacceptable ways, and our current namespace implementation
– there currently isn’t any decent IDE for PHP, not something comparable to what’s available for Java. This became increasingly obvious when I got into Objective C and Mac development, Xcode really sets the standard. A new candidate that seems promising and is non-free is PHPstorm, so far I’ve found it a relief to use compared to Netbeans. Eclipse, on the Mac at least, I don’t think is even in the race.
–For more intermediate or advanced PHP devs, what are some tips that have helped you along the way?
One of the key problems with PHP is the absence of any authoritative standard library, something which is literally taken for granted in Java, Python, Ruby, Perl and others. PEAR could have been it, but Zend chose to fork for political reasons, now we have the Zend Framework which is not really a framework but more like a library, and it still has some serious quality consistency issues. It seems ZF will likely become the dominant PHP library, but work still needs to be done by the community to refactor the “frameworky” libraries, ie, those that have dependencies on Zend_Config, Zend_Registry, etc. Documentation for many of the ZF libraries is flaky and incomplete, often the comments contain the clues you need to get things working.
In terms of tips, I’d make the following suggestions for devs who are keen to move out of beginner status:
– don’t be afraid of using an interactive debugger, available in decent IDEs like PHPstorm and also Netbeans and Eclipse if you have the patience, this is the best way to understand what the code is doing. If you’re using print_r($foo) you’re a beginner.
– don’t be afraid of unit tests, not only will you have an easier time maintaining your codebase, but often unit tests are the best form of documentation for a codebase, and will allow new devs to get up to speed fast
– use some of the available static analysis and IDE tools to help you refactor your code, good code is not subjective!
–What’s the best app or most clever hack you’ve seen that uses PHP? (Links, please!)
Facebook? Although from the code leaked a few years ago, the quality was primitive.
Posted on 02 June 2010 by Demian Turner
If you’re a newb I recommend giving it a read, you can pick up a copy on Amazon.
Posted on 27 May 2010 by Demian Turner
Stackoverflow has a great list of terms programmers have come up with where the standard jargon just didn’t cut it. A few gems in here, see if you can guess what the following might be:
Posted on 30 December 2009 by Demian Turner
A very nice matrix exploring programmer aptitude.
Posted on 20 December 2009 by Demian Turner
I wish I hadn’t waited so long to install the ClickToFlash plugin, it totally improves the web experience. The idea is simple, all flash animations are paralyzed by default 😉 To view flash, including videos like youtube, etc, you have to click to play. A lot healthier for the laptop, no more CPU running at 100% nor mindless distractions when you’re trying to absorb valuable content.
Posted on 26 August 2009 by Demian Turner
I can’t believe Zend is publishing articles on OXID eShop, this is definitely some of the worst code I have seen in ages.
As “the PHP company” I think Zend ought to at least select projects that have some merit in terms of software design, as surely beginner PHP devs look to Zend for good examples and copy/emulate whatever they showcase.
PHPterror took a closer look at some of the OXID code, really jaw-dropping stuff.
Posted on 24 August 2009 by Demian Turner
A new look at how to create unit tests – using Photoshop! Sense of humour required …
Posted on 27 July 2009 by Demian Turner
Thanks to Andrew Betts, a PHPlondon regular, for coming up with BadAPI, a service that allows you to simulate misbehaving APIs.
These days there’s almost no such thing as a web app that’s not integrating data from various external APIs, and with that integration comes a new set of problems the developer must handle.
From the BadApi website:
BadAPI allows you to simulate misbehaving APIs. This is useful if your site relies on the availability of service X, and you want to ensure that any downtime experienced by that service has minimal impact on your own application.
Posted on 20 June 2005 by Demian Turner
You might be surprised to hear that some developers have no idea what unit testing is – I know I was, but I have recently spoken to a suprising number of people who had never run across the ‘concept’.
I do have the advantage that one of the key proponents of unit testing and PHP, Marcus Baker, is a founding member of PHPlondon whose meetings I attend regularly, so I’ve had a pretty good exposure to testing and agile methodologies in general. At work we have also been quite ‘test infected’ for some time now, this became more obvious recently when we had to complete an assignment where no testing framework was accessible, and quickly realised how dependent we had become.
For a good overview of the SimpleTest framework check out this excellent introductory article (cancel the print dialogue, this view is easier to read than the paged one), before heading over to Marcus’ extensive docs on the SimpleTest website. SimpleTest is also available as a PEAR package which can be downloaded from the SF site.
Give it a try, see if you get addicted, can test-driven development work for your organisation? Also be sure check out Mock objects for help with isolating layers and resources in your application.