Web Hosting Talk







View Full Version : Rapid Web Development with PHP :: how to?


webFani
09-13-2007, 09:20 AM
This is going to be general discussion with you guys rather then anything about php code etc...

in fact I was thinking/working about Rapid development and wants to hair from you guys as well my ultimate goal is produce website rapidly, one approach I have and following it currently is I am developing reusable components catering requirements up to some extend...

e.g:

I have developed a supplier module using my MVC based development environment which will be used as suppliers information management module, now I need to integrate this into 2 different projects no problem just need to put files in both project area set some variable and configure as per requirements its work fine :agree:

now here come my problem :rolleyes: for 3rd project may be supplier definition required some extra fields for saving suppliers multiple address... one solution is I need to go back into code add new fields update queries etc... and make it ready for 3rd project...

I want to have something like generic components so on the fly I can change configuration / fields / business rules I mean whatever is possible :D so I want to ask how should I develop such components??? any suggestion, feedback

I hope you guys can understand what I mean...

Big Thanks in Advance...

nnormal
09-13-2007, 11:04 AM
IMO Rapid development using modules is a bit like the holy grail web work. You can get close to finding it but never get there 100% which is still a much better approach than rerolling everytime.

That said if you are developing modules to deal with any kind of data, you have to take into account that the data may change. Today it's a multiple addresses tomorrow it will be something else. What you need is a default data structure which can be modified via an xml file (ala java) or that's smart enough to look at a db table and modify its logic (ala rails). Or you could come up with a different approach. The main thing is to have useful defaults and a standard way of modifying them.

webFani
09-14-2007, 03:51 AM
ya very right nnormal

I got your point, can you show me any think developed on this pattern or any live example so I can change my development style accordingly... :cool:

jstanden
09-14-2007, 04:48 AM
I say rapid development is easily attainable if you invest some time really understanding a particular framework.

The framework (such as ZendFramework in PHP, Tapestry in Java or Rails in Ruby) is going to give you what you need to organize code and think in terms of model, abstraction, patterns and loose-coupling. Such things are application-agnostic.

Libraries that you're comfortable with from past projects are going to give you the services to accomplish your functionality (PHP examples: ADODB, Smarty, SwiftMailer, ZendFramework, PEAR).

Both of those categories (framework and libraries) form the skeleton for any application you're going to work on. They're both highly reusable once you invest in the initial research to pick the right tools.

Your different projects are almost always going to have conceptual/model differences, and you definitely risk the "holy grail" (or magic-bullet) fallacy mentioned in the post above if you expect your platform to start writing domain-level code for you. There's only so much you can carry forward.

The majority of your time should be spent writing code that attacks the specific problem you're after. I really started developing a lot faster once I got over the mistakingly prideful feeling that I had to write every component of an application (down to the XML parsing) before I felt like I owned the solution.

Food for thought, perhaps!

webFani
09-14-2007, 05:01 AM
yes righto..

i am looking for some frameworks/CMS as well e.g. Drupal , Joomla

I find many Open Source CMS but till yet I think Drupal and Joomla are best of them what do you think ?

jstanden
09-14-2007, 05:32 AM
For content-management apps I definitely agree with those two choices.

Development frameworks, though, are really a different beast entirely. If I started my projects over again today from scratch, I'd favor:

PHP (Framework/MVC): http://framework.zend.com/
Javascript (Ajax Library): http://developer.yahoo.com/yui/

If you become proficient with those they will save you a huge amount of time over the course of your development. They both BSD-licensed so you don't have to worry about bundling them with any commercially-delivered software.

Neither prohibits you from adding additional libraries to do anything you need.

For me, rapid development isn't about finding a framework that tells you how to code and takes away your decision-making -- it's about finding a framework that you can give the things you don't want to be bothered to do. ;) It should be flexible enough you can ignore parts of it and go in a different direction, without losing the benefits you do want to use.

I appreciate that about ZendFramework. Initially you can just use various modules as they are useful (Zend_Lucene, Zend_Locale, Zend_Translate), but eventually you can let it take over the more fundamental parts of your app as you refactor (Zend_Controller/MVC, etc).

dollar
09-14-2007, 05:38 AM
As long as we're talking about frameworks I have been having quite a bit of fun with QCodo (http://www.qcodo.com) recently. Worth checking into at least.

jstanden
09-14-2007, 05:48 AM
QCodo looks interesting.

Code generators generally scare me, but they're absolutely useful for something as repetitive as DAO/CRUD (create, retrieve, update, delete).

The HTML Form functionality looks useful, but what I really miss in PHP is something like Tapestry from J2EE. That component definition really made form validation/processing/rollback clean.

Instead of callbacks, as QCodo seems to be doing, in Tapestry you just added a "jwcid" attribute to a blank <input jwcid=""/> element in the form. The platform takes care of naming the field uniquely, ensuring the proper field validation, re-populating the data on error, etc.

The major benefit of that was clear separation of presentation and logic -- where, at the worst, a designer would obliterate a jwcid attribute, which takes you about 5 seconds to add back. ;)

(Sorry, webFani, I don't mean to thread-jack your topic!)

webFani
09-14-2007, 05:53 AM
hey jstanden

no prob mate, your post are really :agree:

hmm going through provided details seems very interesting...

dollar
09-14-2007, 05:56 AM
It is very interesting, certainly not for every project though.

I haven't worked much with Java save for a few classes (was the language of choice at my college for introduction to programming type courses).

In regards to seperation with QCodo there is actually quite a bit. Instead of creating the form fields you use small pieces of php such as:

<?php $date->Render(); ?>

QCodo then takes over and creates the element for you (listbox, checkbox, etc..). I'm a bit rusty on exact syntax, but you can style an element such as:

<?php $date->Render('Class=someclass'); ?>

or similar. Validation is also as simple as RenderWithError instead of just Render. It's really an interesting framework if nothing else.

The big downside to QCodo IMHO is that you are limited on database design in a few ways. The biggest one (which you can overcome with a bit of reworking, resulting in a non-perfect database) is in a many to many relationship. For example if we had recipes stored in the database we'd probably have a recipe table and an ingredient table. With a many to many relationship I would like to be able to store the quantity in the table in between them (apologies for lack of proper terminology); however, that's a no-no with QCodo.

I love the code/form generation for quick backends to sites that I'm going to be the only person seeing. I have it running a handful of my projects and it's saved me a lot of time in getting the basic CRUD functionality that I wanted.

It has a medium to steep learning curve sadly, but certainly one of the most interesting things I've seen out there.

My turn to take a look at yours and give the Zend Framework a actual try.