Lessons Learnt After Developing a Web Application – Coding

Yesterday I talked about how the project was executed in both the design and implementation phase. Today I’m ranting a bit more in detail about how we coded the thing in PHP (v5).

Database Access

Our Approach

When coding started, we agreed on (or rather, I pushed the view) that we should use the DAO pattern for our database access needs. To work easily with the database, and also to have the possibility of prepared statement we used Creole, a PHP database API that’s very similar to Java’s.

Soon, we had our DAOs. Though, all was not good. Eager to get going we started coding using our new functionality and didn’t bother coding up the corresponding service layer for them. This was alright to begin with since the application only had some basic CRUD functionality. The problems (or future problems if you want..) became obvious when we started adding functionality that cut across the model objects. Code cutting across the DAO layer was made. And this in turn led to duplicated code.

At that point, I guesstimate that our application was ~70% done. So, to go back and change everything into using a Service Layer wasn’t an option with the deadline closing up and the code was delivered with those nice dependencies within the layer.

Alternative Approaches

Looking back, I see that the Active Record pattern probably could have been a good choice.

The View (and Controller)

This was probably the hardest part to get done right. And there’s no real consistency in the approach here.

Some places the code for handling form data and get requests were in the same file, and the page posted to itself. I guess this is fine for smaller scripts, but some of ours were starting to get big quick, and doesn’t look very maintainable.. In other places there was sort of a controller. They took POST data and redirected with a header(“Location: foo”) call. This is a much more maintainable approach, and very MVC.

I think the issue would have been better solved using perhaps the Front Controller pattern or a good MVC implementation. Both coupled with a template language such as Smarty.

Summing up

Creole was a good experience. We lacked a good approach from the data layer and up. Using a framework like CakePHP or symfoni would probably been the best thing to do.

I think I have learnt a thing or two now.

Lessons Learnt After Developing a Web Application – Design and Implementation

This spring I have been doing some work on a web application, part of a deliverable in one of my courses (INF5270).

We were a team of four writers/programmers/designers/whatever needed. The deadline was about an hour ago, and we delivered our system 3 hours before that for once. So, for personal reflection I thought I’d sum up my experiences. Especially in the light of having read through a better part of Getting Real by 37signals.

The theme of the course is, as stated in its title, Design of Interactive Web Sites. The curriculum is somewhat broad, but the main focus is on Information Architecture and Sociability. Our task was to build a social web site (and also write up some reports about it and reflect on the theory of the course).

We decided on a theme early on; books. We were going to build a social web site about books, or literature if you want it dandy. We started investigating other sites within the theme, and found some. Looked into them, and what they did and reflected about what we would want to put in.

At this step, we only had some thoughts, and also a report that we had to deliver about our findings and how they related to the theory taught. The next step was, as Getting Real suggests, making the screens in HTML. Only, we skipped the part with sketches and drawings and drew directly on a document with ideas. I think this is probably one of the first (major) faults we made in the project.

Words in a document are fine, but do they really convey what we want? Everybody has different ideas, and that really shone trough nearing the deadline. We were not on the same note and the end result was different than, I think, everyone envisioned. If we had sketched the site early on and put it somewhere on the web it would have been much easier to see what we agreed and disagreed on and reach agreements.

So, we had the screens out there in HTML (part of another delivery), we disagreed, agreed and none of them really got updated. The same screens were the basis when we started on the 4th delivery that included the first bit of implementation. The screens where as much worth as the dead document, nothing. So we started coding, all in our own directions, which resulted in confusion and a delivery that consisted of different ideas, not ONE idea.

And, that was pretty much the story for our 5th and last delivery that was finished up some hours ago. We ended up delivering a system that deviated some, or much, from both our personal and common vision.

I think the following would have made the project execution better:
* Interface sketches EARLY on, perhaps just after deciding on our theme for the site, and then meeting up for more iterations and doing an early assessment of feasibility for the different parts of the site. Together with a vision document, and some documentation of elements in the sketch this would serve as the framework for the whole System.
* A live document where we documented our choices, so that they could be found in easily when needed (some code at night, others early in the morning).
* Some more meetings . Although Getting Real really disapproves of them I think they would work in our case (small team) to easily and quickly solve confusion on certain aspects in a quicker way than e-mail and/or IM.
* A centralized, online, meeting place. Campfire could probably have been suitable for this.

Hm, that’s what was on top of my head for now.

Last Weeks Picks

There was a pillow fight in Toronto last week, and the picture of this pillow fighter caught my eye. Maybe I will give up my disdain for people with dreads someday too? For some reason I’ve always felt a bit of contempt for people who doesn’t wash their hair on a regular basis, although some of the women can look really good with it. A shame.

As a person somewhat interested in possibly doing something by myself work-wise some day, I ran into the Personal MBA Manifesto site that more or less gives a list of books and magazines to read and study by oneself to attain knowledge similar to an MBA.
The manifesto states that you wont attain all the knowledge needed by the books alone, you need to be out there working with your own start up or something similar. I’m kind of a skeptical, but I enjoy reading —so I’ll definitely pick up some of the books for summer or something like that (already posess Getting Things Done by Allen for a year or so. How is that for Getting Things Done?;) —I’ll get right to it after exams.)

Last week was also the birthday of the typeface Helvetica. I found Magasinets article(norwegian) a enjoyable read. BBC also has good coverage.

Installing GMF on Eclipse 3.3 (M7) Europa

I ran into a problem today trying to install GMF on Eclipse 3.3M7 Europa. Some file within the GMF package could not be found and the updater just threw an error. The solution was easy (after trying so many mirrors..), use GMF’s own update site (of course..). The URL to the update site is: http://download.eclipse.org/modeling/gmf/update-site/releases/site.xml for the Europa specific builds.

Add the site to the update manager, check of to search both the Europa discovery site and the GMF Update Site, select GMF from the GMF Update Site and then press Select Required and you should be golden.

Info from the GMF Update Site page.

Essential Software for a Fresh Windows XP Install

As a personal reminder, and possibly helpful for other people, I’d thought I’d post what software I spend hours installing after hours of installing Windows XP.

Security

Development

Surfing/Net

Only one(I use GMail, Reader and Calendar from Google for other net stuff.)

General purpose

Multimedia

More suggestions?

Picks of the Week

Things I found interesting this week.

The Definitive Guide to Semantic Web Markup for Blogs (article)

This article talks about how one should mark up HTML documents semantically correct. Although the comments points out some flaws (as using a H4 tag after something other than H3 – and thus breaking the hierarchy) the articles sums up why and how you should mark up your documents.

Caspian – The Four Trees (music)

I found the album “The Four Trees” on eMusic, and it’s stunning. Although having a sound similar to Explosions In The Sky it isn’t a copy. Good stuff.

Dvorák -Symphony No. 9 (music)

Well, I usually do not listen to classical, but I took my chance on this one. Some of the parts in it gives me associations to Bonanza. I like!

First post and so on

Well, this is my first post, and first time setting up WordPress, which seems great :-) I considered setting up SimpleLog, but being totally unfamiliar with the nuts and bolts to get RoR going I decided to go to the security and bug-riddled haven of PHP software. ;-)

Anyways, if things get fubar, it’s as easy as resetting my slice at Slicehost which provide the VPS account this blog is running on.

Time for bed. Another day.