Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Best Practices, Patterns vs 'Workable Patterns'  RSS feed

 
john fuhr
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
a couple of weeks ago i was speaking with another programmmer and friend of mine. he had a problem: 'translate' a series of complicated ASP pages which relied heavily on a couple of database tables into a servlet/JSP application.
should he use a command pattern/ servlet centric application? (in which a single servlet takes input and delegates the appropriate responses through some background classes and beans and then onto any number of JSP's which then handle further input (through the servlet - beans - a JSP)
or should he use just a series of JSP's that handle responses? (JSP centric, using a few beans and a database manipulation class)
well, he looked around his working environment and considered the boss: with a few DB wizards and a couple of VB types, he went with the series of JSP's option. it turns out it was a good idea. after all, he's going to be working with folks that can only handle either database manipulation or the configuration of that data on a web page.
yes, he could have implemented the app with Struts but would have to conduct several seminars for his work crew and boss. or he could have invented his own over-abstracted set of classes, which a set of hired consultants had already done (and consequently made the application uneditable because of their LOUSY documentation).
anyway, what's "best practices" here? over the long run, i'd say that a well documented command pattern/ servlet centric app would be best. but i don't work in that forest. unfortunately they are not inerested in any more "code and run", high buck consultants, otherwise i'd try. besides that this friend of mine is well able to design and implement the best solution - considering the humans he's working with.
so, the question: what's the best way to handle the situation my buddy's in? KISS ('keep it simple stupid' for the rest of the crew) or use an established pattern like the command pattern?
 
Nehal Dave
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
John
First of all i disagree your comments about consultants & lousy documentation. I am working in usa from last 3-4 years & all i have seend is that people like you or your bosses call consultants when u people cant handle the situation & then u people are so much in haste .. never give enough time to consultants to document the code. Let me tell u if u have ever studied (even heard)about Software Development Life Cycle, majority of project time goes (should be utilized) in creating specifications & documentation. I can write lots more but...
Anyways
Cheers
Nehal.
 
Andrew Patzer
Author
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The siutation you describe is a very common one. The approach your friend took may very well have been the best one at the time, but it is not the best solution from a maintenance and extensibility perspective.
The approach you recommend, using a command pattern and a central servlet (or simply stated - MVC), would give them something that is easy to understand, maintain, and extend as the application grows. I agree that using Struts sometimes requires too much training for everyone involved. So, I'd recommend setting up a simple request-handling framework using an MVC pattern so that all requests go to a central controller servlet where they are processed by a specific 'command' object which stuffs the response data in a bean and forwards the user to the appropriate JSP to display the results.
This framework is actually very easy to set up. I don't usually go for the shameless plugs, but my book really does a good job of setting up this kind of framework. I walk through the implementation of several design patterns, then I actually build the framework step-by-step. The book concludes with a full example using the framework to build an application.
I hope this helps.
Andrew
 
john fuhr
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Andrew,
Thank you for the reply. I agree: in the long run, it's wiser to follow a simple single point-of-entry MVC.
I'll look at your book.
jf
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!