Web application design patterns?

K

kgalligan

I manage a small IT group in my company. I started as a developer and
I still do some development work, so it seems like I'm a good candadite
for this job. Strangely enough, I feel like I'd have an easier time if
I wasn't, because a lot of the time I'm looking at my peoples' work
thinking, "well, maybe it should be like this...", but I digress.

Yesterday I looked at some code that was doing basic table maintenance.
There was an edit and delete link for each row, and an add at the
bottom of the table. The delete was supposed to just set an 'active'
flag in the table for a logical delete.

If I had built this, I would've had the edit link and the delete link
send the database unique id to the code (struts action in this case),
and do whatever needed to be done. Instead, this person passed every
other field in the table to the delete link, except the id. I looked
at the code, and I guess the idea was to pass in all the field values,
including the 'active=false', and do a global update with all of those
values. Now, to be clear, this WILL WORK. However, fill in the
blanks. What happens when we add another field? Are we sure the
values are properly html encoded? What if there's a newline in the
value, and it isn't properly represented? You get the idea. I just
wouldn't have done it that way.

That got me thinking. Is there some sort of design pattern book for
web applications? It looks like most of the stuff out there is in a
programming language camp (web apps for php, web apps in .net, web apps
in java). I mean, it would be great to have one that did Java with
Struts, and had good design patterns, but I'm less concerned about the
specific language.

The person who did this is new, so I think what I need to do is just
better document my ideas on design, but I think there's a lot of stuff
that's pretty obvious and I should be able to point to a book and say,
"do this". Any thoughts?

Maybe some ideas on my managment process? I've heard of some shops
where one person will design everything out in detail and another coder
will just fill in the blanks, but we're really not that kind of place.
I'd like to feel as though I can hand off stuff at a higher level and
get back a decent piece of code.

Thanks in advance.
 
R

Ryan Dillon

Maybe some ideas on my management process? I've heard of some shops
where one person will design everything out in detail and another
coder will just fill in the blanks

I don't think this type process works very well. Designs will always
change as requirements (inevitably) change. Sometimes a little,
sometimes a lot, but certainly enough that even the most junior
programmers need to be able to tweak the design themselves, else
the lead developer will become the bottleneck.

One thing I think that can help here, is to do a "vertical slice" of
the application that demonstrates how all the layers/bits of an
application works. This needs to be done *before* everyone else starts
coding. Then when a programmer needs to add some new functionality,
they can check the "vertical slice" for the "best practice" way of
doing it. They can still do things slightly differently as
the situation requires, but they have a good starting point and
will hopefully not deviate too far from it. Sure, it is still
possible to get off track, but you could prevent massive surprises
by doing code reviews.

Cheers
 
A

Andrea Desole

If I had built this, I would've had the edit link and the delete link
send the database unique id to the code (struts action in this case),
and do whatever needed to be done. Instead, this person passed every
other field in the table to the delete link, except the id. I looked
at the code, and I guess the idea was to pass in all the field values,
including the 'active=false', and do a global update with all of those
values. Now, to be clear, this WILL WORK. However, fill in the
blanks. What happens when we add another field? Are we sure the
values are properly html encoded? What if there's a newline in the
value, and it isn't properly represented? You get the idea. I just
wouldn't have done it that way.

I don't know if it can make you feel better, but definitely you are not
alone.

The person who did this is new, so I think what I need to do is just
better document my ideas on design, but I think there's a lot of stuff
that's pretty obvious and I should be able to point to a book and say,
"do this". Any thoughts?

well, if you want something about web apps, BluePrints are the first
thing that comes to my mind:

http://java.sun.com/reference/blueprints/index.html

I don't think this will solve the problem, though.


Maybe some ideas on my managment process? I've heard of some shops
where one person will design everything out in detail and another coder
will just fill in the blanks, but we're really not that kind of place.
I'd like to feel as though I can hand off stuff at a higher level and
get back a decent piece of code.

Personally I have never done it, and I don't really think it's the best
solution. For me it's just better to do a better selection when hiring
people.
A developer must have an idea about what he is developing, and someone
who does all the design will inevitably lose detail: his work will be
incomplete and probably incorrect. I think the best option is to have
someone with an overview, and the developers taking care of the parts.
I do know, however, of companies doing it. I think it's more common to
big companies.
 
K

kgalligan

I guess I'm just a little frustrated. I looked at it yesterday and
just kind of knew they'd have to redo much of the code. In other tasks
this person is right on, so I guess I was a little surprised. I've
worked with genius coders, all the way to people who litterally slowed
the project (as in 5 coders took longer than 4 would've without this
person), so I've seen a lot of different things.

I've read some articles about how down the road there may really be
standards like in other more mature industries. Architects aren't
generally designing new processes and components every time they design
something (for example). Guess I just want a, "this is how you should
generally build table management screens", "this is a good method for
access control", etc. I've picked this stuff up over the years, but
its either one little thing here and there, or learn by example (ie.
learn by mistake).

Thanks for the kind words! My interviewing has gotten better over the
years. I actually don't do too much of the technical grilling myself.
I leave that to another guy. I just get the person to start talking
about their projects. I can generally tell when somebody really knows
what they're talking about or are spitting out magazine quotes (this,
however, assumes that I know what I'm talking about. Who knows? Maybe
the people that sound good to me are just confused in the same way I
am?).
 
A

Andrea Desole

I guess I'm just a little frustrated. I looked at it yesterday and
just kind of knew they'd have to redo much of the code. In other tasks
this person is right on, so I guess I was a little surprised. I've
worked with genius coders, all the way to people who litterally slowed
the project (as in 5 coders took longer than 4 would've without this
person), so I've seen a lot of different things.

and unfortunately the latter comes much more often than the former.
Actually, 5 take longer than 4 is still a nice situation ;-)

I've read some articles about how down the road there may really be
standards like in other more mature industries. Architects aren't
generally designing new processes and components every time they design
something (for example). Guess I just want a, "this is how you should
generally build table management screens", "this is a good method for
access control", etc. I've picked this stuff up over the years, but
its either one little thing here and there, or learn by example (ie.
learn by mistake).

Mmmm, I would expect architects and designers to do something more. I
would basically expect them to do all the analysis work, to build the model.
I have more the feeling that you just need developers with experience.
Maybe you can try some code reviews. For the 5th developer already
mentioned, though, there is not much to do, I'm afraid.

Thanks for the kind words! My interviewing has gotten better over the
years. I actually don't do too much of the technical grilling myself.
I leave that to another guy. I just get the person to start talking
about their projects. I can generally tell when somebody really knows
what they're talking about or are spitting out magazine quotes (this,
however, assumes that I know what I'm talking about. Who knows? Maybe
the people that sound good to me are just confused in the same way I
am?).

Interviews are important, but some companies tend also to wait a bit
before making people permanent, specially in countries where it's
difficult to fire someone. For example, in the company where I am, where
I started 6 months ago, I have a 1 year contract, before starting with a
real permanent contract.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top