views:

100

answers:

3

I use PHP with CodeIgniter(MVC framework). My Question is fairly simple. What according to you is the better approach while working with a slightly complicated website.

After planning, and listing all the small and big features of the website and where they are going to be and planning out the tables and columns for the database.

I would till now just start building one page at a time. Working on CSS issues, doing behaviour(JavaScript) and back-end at the same time.

In your experience, is it more efficient to do front-end completely deal with all issues, get everything done with. and then work on the back-end logic?

What about JavaScript? (Do only User interface related JavaScript + Validation with front-end -- and then do all AJAX calls and responses to it with the backend..?)

+8  A: 

I would strongly recommend an iterative approach, where you develop both front end and back end incrementally.

Get something simple working on the back end that you can unit-test, then build a simple UI that interacts with this and implements the front end feature. Test thoroughly. Repeat until finished.

If you don't do this, then you will find it very hard to verify that functionality is working as you go along. As a result, gluing the pieces together at the end will be a nightmare: at best you'll spend a lot of time debugging, at worst you'll discover a major design flaw and have to rewrite large portions of your code base.

mikera
+1, sound advice. You need a stable base on which to build each layer of functionality and you also need to continually verify how you've written the back end corresponds to the front end needs etc (because we all think we know a great way to do it until we are actually sat down with the workflow!).
Ninefingers
+1  A: 

I didn't do MVC with PHP, but my experience with WPF/C# should be similar. I started out with the architecture (I used an DI container to put everything together), after that I did the first ViewModel, together with a really simplistic UI, to check if everything is in order (Yes, TDD would be more appropiate, whatever). I continued that and didn't really focus on the UI, unless I needed a button or so. After a while, I was done with the ViewModel and focused on the UI, polishing it up.

I don't see problem if you jump between all three components, simply because you need all three for the page to work. Also, you don't get bored so easily while working on it. Just don't lose the objective out of your sights and work towards finishing most of the features. UI polishing can be done afterwards and shouldn't take much time due to the MVC approach.

Femaref
+1  A: 

You are asking a very general question, mixed with some specifics...

I understand the general question to be: In terms of writing software - is it better to write bottom up (database call first, business logic next, ui after that) or top down (ui first, business logic, database calls).

Top down is good in order to iron out UI issues early. It leaves business logic and data access (and possibly other infrastructure code) for later on.

Bottom up is good in order to iron out infrastructure issues early, leaving UI to the end.

Both ways are valid and if you are the single developer it boils down to this - which one are you more comfortable with?

Personally, I would go with full functionality, one page at a time - making sure it all works correctly (with unit and acceptance tests where they make sense). This way you work on all aspects at the same time and can fix things faster.

You want to have a short feedback loop on all aspects of your software - UI, business logic, data access and other infrastructure. The shorter the better - it allows you to fix things fast before they become too big to change gracefully and shows the client the progress you are making, allowing them to steer you right early on.

Oded