Tuesday, April 22, 2008

OMG - java weenie goes LAMP!

Well yes, I've spent the past week or so trying to apply a load of stuff that I want to do from the world of Java to the word of LAMP, or php to you and me.

I should also say that before I embarked on my career as a java-weenie I'd spent four years man-and-boy programming perl, so the php itself wasn't any kind of hurdle, my challenge has been to see if I could introduce all of the application architecture patterns which I know and love from Java world.

So what things have I uncovered?

1/ IDE - the Eclipse PDT, with zend debugger, is excellent. Not quite as robust as Eclipse java tools, there are still some flaky moments and the code completion can't always work out what class $this->thing actually is, but that is all made up for and more by subclipse and the zend debugger. Keep up the good work PDT guys. For others who want to investigate I followed these instructions.

2/ OOP Yes, PHP5's OOP is pretty decent, but (obviously) it is weakly typed which I find annoying coming from a strongly typed background. And surprisingly I had to write my own classloader, which was fun and instructive and it seems to work fine, but why? I haven't started using exceptions yet, hopefully they'll be familiar.

3/ ORM Oh yes, this is cruicial to my plans Mua hahaha, and it seems so far that the excellent Doctrine ORM is well up to the task, if not quite in the same league as Hibernate.
One thing thats puzzling me is where the transactionality has gone, but perhaps thats because I haven't read the manual fully yet.

4/ Logging, oh wow- log4php - in incubation at Apache this is the php sibling of log4j it works fine and smells very familiar.

5/ Unit testing, haven't tried it yet but while I was talking through my researches with the guys who will have to suffer the consequences of my decision making they said phpunit, which certainly sounds like the right thing!

6/ MVC I'm not keen to adopt a big framework wholesale, for reasons which I can't be bothered to explain now, but its been relatively painless to knock together an OO MVC framework using Doctrine, homespun controllers, and Views generated by the Smarty template engine which at least lets us bind, using simple {$my.attribute} syntax, display elements to objects from the model, not sure how far Smarty will suit at this early stage but its looking promising for now.

I have no stirring conclusions at this stage, but its looking good, stay tuned and I'll let you know how it all turns out.


blog comments powered by Disqus

I know nothing, I'm not a fortune teller, and you'd be insane to think that I am. This disclaimer was cribbed from an email footer I once received. It is so ridiculous I had to have it for myself.

Statements in this blog that are not purely historical are forward-looking statements including, without limitation, statements regarding my expectations, objectives, anticipations, plans, hopes, beliefs, intentions or strategies regarding the future. Factors that could cause actual results to differ materially from the forward looking statements include risks and uncertainties such as any unforeseen event or any unforeseen system failures, and other risks. It is important to note that actual outcomes could differ materially from those in such forward-looking statements.

Danny Angus Copyright © 2006-2013 (OMG that's seven years of this nonsense)