Archive for April 2010

Post Archives
Archive for April, 2010

Object Oriented Design for Database Centric Applications

April 27th, 2010 2 comments

I’m writing a few fairly complex apps which are heavily data centric and I seem to be struggling to choose how to best implement such applications.  What I mean by data-centric is that data stored in the database is core to the application and most of the application has to do with working with the database, while the logic tends to be relatively simple.  So what’s the best way to do it…

Read more…

Share
Categories: Programming Tags:

ORM vs Code Generation

April 25th, 2010 4 comments

It seems no matter where you look these days everyone is using ORMs.  Every PHP Framework you look at has an ORM and it seems the preferred way to access data and .NET also now has LinqToSql and LinqToEntities which are both just ORMs.

I look at all these ORMs and read about problems with them where they don’t generate some SQL correctly, require you to learn a new language that tries to wrap SQL but doesn’t have the same power and it really makes me sad.  People have just no idea… They are prepared to trade off control and performance for some new concept that doesn’t really add anything good.  The productivity isn’t really increased all that much and you don’t really cut down on code all that much either if you are using code generation.

Now, code generation on the other is sooo much better and I’m really surprised that it hasn’t made it into all the frameworks and environments.  Code generation takes the mundane work out of initially creating lots and lots of similar code for the likes of CRUD operations but then you can quite easily modify it as needed.  Also people have built great big libraries like NetTiers that are based on code generation, but ultimately even those aren’t really needed.  The beauty of code generation is that you can generate really lean code and hence don’t really need all the compexity.

Ultimately I think serious developers will end up going back to good old SQL and code generation after this latest ORM fad is over.  If you want to write less code then just use a code generator, not some black box that does takes up CPU cycles and spits out SQL that isn’t guaranteed to be right.

Share
Categories: PHP MVC Frameworks Tags:

Designing a PHP MVC Framework – Part 1

April 25th, 2010 5 comments

In Choosing a PHP MVC Framwork – Part 1 I discussed what I feel is needed from a good PHP MVC Framework and Choosing a PHP MVC Framework – Part 2 I outlined my reasons for why I think many of the existing PHP MVC Frameworks aren’t well suited to my needs (and hence presumably to the needs of many others developing website in PHP).  In Designing a PHP MVC Framework series of posts I will be going through designing a PHP MVC Framework that is suitable to my needs and share my progress.  Hopefully, the end result will be something that I will be able to share with everyone in good old open-source spirit.

Read more…

Share
Categories: Uncategorized Tags:

Choosing the Best PHP MVC Framework – Part 2

April 25th, 2010 4 comments

In Choosing the Best PHP MVC Framework – Part 1 I discussed what I feel is necessary of a good PHP MVC Framework.  So, I’ve spent a fair bit of time researching the various PHP MVC Frameworks and basically come the realisation that most of them aren’t all that great for one reason or another.  For one, many clearly didn’t keep in mind the use of a PHP IDE like NetBeans or Eclipse PDT and hence their design resulted in poor (if any) support for intelli-sense.  Because of this I’ve pretty much straight away discounted these frameworks as having to remember all the methods of an object and not have code completion is a real pain and really hurts productivity.  Of the two more or less popular frameworks left were Zend Framework and Yii Framework.  I found Zend Framework to be too general and as a result too heavy and slow… Zend Framework is really an enterprise framework that tries to be all things for all people and that’s nice, BUT you pay for it with performance and you can pretty much forget about using it without having at least a Virtual Private Server (or preferably a Dedicated Server) and OpCode Caching enabled.  Even with OpCode Caching it’s still not the best performer.  Yii Framework is a lot better from this perspective and feels a lot more natural and close to ASP.NET to which I’m quite used to as well.  What I really dislike about Yii is the fact that it is really built with ActiveRecord in mind.  Sure, you don’t have to use it, but then you loose many of the benefits that it offers.  For example if you store language dependent data in a separate table then Active Record becomes a bit more of a pain.  It is also a pain when you tend to aggregate a lot of data and in that case the whole Domain Model pattern doesn’t work all that great either and Table Module is far more practical.  Having spent a lot of time implementing web applications and other database driven apps in .NET and PHP I have found more and more that Domain Model is really not the best option and a real skill is knowing how to build an app that’s easy to develop and extend.  The use of ORM in pretty much all the frameworks is also something I don’t think of very highly, as they’re ultimately trading off performance and flexibility for bugs and pretty much having to learn another language.  I really think that for heavily database driven applications the best option is NOT to use a pattern such as Active Record and to keep the data separate from the business logic that acts on it.  PHP is particularly well suited to it with it’s use of associative arrays (although you do loose code completion support for fields as you would with untyped datasets in .NET, but that’s something most PHP developers are used to anyway).  Furthermore, I tend to use only MySQL, so I don’t really see much point of having a database abstraction layer.

So, rather than using an existing PHP MVC Framework which pretty much forces you into concepts I fundamentally disagree with or don’t need like ActiveRecord, ORM, Database Abstraction, etc. I’ve decided to write my own minimalistic framework that will be lean and mean, yet logical and with support for what I need rather than what someone may or may not need/want and stuff that kills perforamance and takes away control over SQL from me as the developer.

I will be posting about how I intend to design this framework as well, which is probably more for my own benefit as writing stuff down helps me think it through.

Share
Categories: PHP MVC Frameworks Tags:

Best Niagara Falls Tour

April 16th, 2010 No comments

Today I went on a Niagara Fall Tour and I have to frankly say that it was by far one the best tours I’ve ever done and I’ve done a few.  Why?  Because the driver was absolute fantastic.  He was funny, easy to understand and entertained the entire bus ALL DAY.  If you are ever in Toronto and want to do a tour to Niagara Falls than I would highly recommend Best Niagara Falls Tours by 4 Season Tours.  In fact the guy was soo good that I’ve given him advise on how to improve his own website in terms of SEO and linking to his website from this post as he currently does the work through another company and I’d love to see him doing it all himself, as every tour to Niagra Falls or in fact anywhere should be as good as this.

Share
Categories: Personal Tags:

Centralised vs Distrubuted SCM – SVN vs Mercurial

April 10th, 2010 No comments

There’s lots of debates and comparisons of version control systems and whether it’s better to have a centralised or a distributed version control system.  I really don’t think you can put your finger on it and Distributed is always better than Centralised and vice versa. 

In terms of Distributed Version Control Systems I really think that Mercurial is the best because it has very good GUI Support and IDE Integration (Visual Studio, Eclipse, Net Beans), which I think is better than Git’s support for those IDEs.

For Centralised Version Control Systems I think that SVN is the best because it deals with some of the issues in CVS, which is rather outdated these days and also has very good GUI and IDE Integration.

There’s a nice Comparison of SVN and Mercurial here.  Personally I think Mercurial is great when you’re working on a single project with a distributed team, but if you’re working with a team in a single location AND/OR on multiple projects then SVN is better, because you don’t always want the entire repository, just a single project!

Here’s a great blog post about this from Martin Fowler… Comparison of Verson Control Tools, SVN, Git, Mercurial

Share
Categories: Version Control Tags:

ORM Performance – Have you gone ORM crazy?

April 10th, 2010 5 comments

I gotta say, every framework I look at these days, there seems to be an ORM built-in.  For example in .NET alone (which is a single framework) there’s already LinqToSql and LinqToEntities and then on top of that there’s NHibernate, SubSonic and so on and so forth.  In PHP, every framework I look at seems to have an ORM… They don’t have half the other things that a decent PHP framework actually needs, but they have an ORM.

Is it really all that hard or labourous to write SQL?  Why do you need to learn effectively another language/api for ultimately creating SQL queries when you already know SQL?  Why do you want to destroy the performance of your application?

As crazy as it seams, that’s what seems to be happening.  It’s like people jump on the bandwagon without thinking.  If you read about LinqToSql and LinqToEntities you will find plenty of blog posts saying that performance is terrible and if you want to pre-compile the code needs to be WAY more complex.  Moreover at the moment LinqToEntities generates absolutely shocking SQL for anything but the basic queries.   The same goes for PHP frameworks… ORM takes heaps of code and processing and all for what?  To generate a basic SQL string that you could have written by hand?

Anyways, I guess anyone writing anything moderately serious doesn’t use ORM, but people really need to step back and think about things like performance before they jump on the bandwagon and start churning out SQL over which they have no control using ORM tools.

Share
Categories: Programming Tags:

PHP MVC Framework Performance – Part 1

April 8th, 2010 41 comments

As part of my assessment of PHP MVC Frameworks which I blogged about in Choosing the best PHP MVC Framework I decided to do a compare performance of the various PHP MVC Frameworks I was considering.  I did this using Apache Bench with ab -t 30 -c 10 http://testserver/framework/index.php as this is common and did the basic Hello World test where each framework just put out Hello World in an empty HTML document.  Here are the results…

Read more…

Share
Categories: PHP MVC Frameworks Tags:

Why Yii Framework is better than Kohana PHP

April 7th, 2010 49 comments

Recently I’ve set out comparing and choosing the best PHP MVC Frameworks so that I could then decide if I’m going to use an existing framework or roll my own minified super-efficient framework, because most frameworks seem too bloated for my liking these days (and hence run poorly on shared hosting).  Two of the frameworks I short-listed were Yii Framework and Kohana PHP.  After spending considerable time playing around with both I’ve come to the conclusion that Yii Framework is better than Kohana PHP. Here’s why…

Read more…

Share
Categories: PHP MVC Frameworks Tags:

Drupal vs Joomla vs WordPress Comparison

April 7th, 2010 4 comments

I was searching on some info about Drupal vs Joomla vs WordPress and came across this article Drupal vs Joomla: A frank comparison from an IBM Consultant.  I’ve worked with all of the above and actually had the pleasure/pain of having to customize all of them, but still wanted to see what others had to say…  Another good summary I found is at Drupal vs Joomla vs WordPress.

Those guys go into pretty detailed comparisons, but ultimately the question most have is when should I use each one.  My view is…

Read more…

Share
Categories: CMS Tags: