Re: Which do I use for web design?



Arved Sandstrom wrote:
Let's say that all you need to write are small and relatively simple web
apps. For Java, your own "framework" may simply be a re-useable controller
servlet, an event handler base class, some of the core event handlers, and
some of the core JSPs. You could also regard the JSTL as part of your
framework. If your simple web apps access databases, part of _your_
framework (in the Model part) would also be a skeleton data access object
(DAO) system (see
http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObject.html) -
this could be quite simple, potentially to the point of targeting a single
RDBMS.

IMO it's a good exercise to create a skeleton framework like this. Number
one, you can actually develop with it. Number two, it exposes you to the
concepts at the lowest level. Number three, when you start using other
frameworks, you'll know that fundamentally that that bit is replacing your
Views, that other bit is replacing your Controller, and that other stuff is
doing what your Model does.

It also doesn't hurt to tackle each new framework at a very simple level.
Choose one of the basic tutorials, and dissect it. Identify the Model, View
and Controller. Next, implement one of your own simpler applications.

You can absolutely get overwhelmed by using a high-powered IDE that has
support for various technologies. Dive into a J2EE app using Netbeans, and
in an hour or so you can have a working app that set up entity classes
mapped to a DB, it created a session facade bean for you, it created all
the stuff for a few JSF web pages, and at the end of that you're not
necessarily much the wiser about anything that's going on. IOW, and again
this is just my opinion, I wouldn't recommend starting this way.
....

With regards to the latter, still a good article is
http://www.stardeveloper.com/articles/display.html?article=2001060501&page=1

This is an MVC2 example. Page 6 will mention the limitations of this
example: no support for forms handling or internationalization, not a
particularly complex user interface (one event, one handler), and some
scriptlet code still in JSP. Also, the state components of the model are
very simple. Because the limitations _are_ mentioned in the article you're
not left in the dark about actual real-life improvements that would be made
(that is, what frameworks will do).

Also, if you haven't already done so, read (at a minimum)
http://java.sun.com/blueprints/guidelines/designing_enterprise_applications_2e/web-tier/web-tier.html
from "Designing Enterprise Applications with J2EE". That link points to a
discussion of the web tier.

Note that with enough care you can make this work with any language. For
example, see http://www.tonymarston.net/php-mysql/infrastructure.html#mvc
It's not a bad idea to read up on MVC done in other environments - it
highlights the principles.

This should get you started.

In addition to Arved's superb advice, look around java.sun.com and IBM DevelopWorks for articles and tutorials on the so-called "Model 2" JSP architecture. It's a straightforward way to get into the matter without a lot of framework trees to obscure the MVC forest. I concur with Arved's advice to include JSTL early on, and add that you should use Expression Language (EL) with it. The Sun JavaEE tutorial has all the information you need about JSTL, EL, and for when you're ready, JSF (Java Server Faces). Of course, it might not be presented the way you'd like, but it's an awfully good starting point.

Sun would have you use Glassfish for all web apps. Tomcat is quite sufficient until one needs EJBs or JPA (Java Persistence API). I prefer Derby and PostgreSQL over other free databases. Actually, the classic combination of Apache Web Server (httpd) and Tomcat is an amazingly versatile and capable platform.

I've actually done what Arved suggested, for example writing one sample MVC web app three times to try my hand at writing DAOs differently each time.

In the end, it's the ops (operations) role that is hard. Writing the code is fairly straightforward. Deploying your apps, connecting to the database, scaling well, not crashing, getting the right URL to connect to the right directory - those types of things are the tricky parts.

Make sure to study and practice the setup and deployment aspects of your work at least as much as you practice the coding parts. I also recommend siege-testing your app in unit test - try to smash it with anomalous data, dead databases, bad inputs - whatever you think could hurt your app in production. Review your log files afterward to see if they really help. Fix your logging strategy if they don't.

These are arguably more important aspects of web design than mastering model-view-controller.

--
Lew
.



Relevant Pages

  • Re: which is a better dev language
    ... Java is not real time either - no runtime with a GC is. ... Managed code on the desktop succeeds for the same ... Run a .NET app on a Palm device with a Palm OS? ... Managed code has a slow startup as the framework is loaded and JITted ...
    (microsoft.public.pocketpc.developer)
  • Re: OODesign - OPF, design pattern
    ... I developed a Pocket PC app last year using the compact framework. ... Maybe my design is just very simple then, ... and its in the application layer not the business ...
    (borland.public.delphi.non-technical)
  • Re: Whose Fish?
    ... "Reuse" has seemed to fall out of favor as a top claim of OOP. ... Language Framework: the framework of preexisting *reusable* classes ... When I start an app I first check to see if the tools I need to solve ... random number generator. ...
    (comp.object)
  • Re: Bitter about [Lack of] .Net Framework Deployment
    ... We built a very nice auto-update framework, ... the 30-60 minute range to install. ... Also, the user's perception is reality - and our app install sucks, ... deploying 3.0 application, so I've not paid that close attention. ...
    (microsoft.public.dotnet.framework)
  • Re: Anybody use web2py?
    ... I have a way better development environment on my ... (lets say that's in a controller). ... while doing a quick dummy test app can give you a first ... For PyCon, web2py registration was ...
    (comp.lang.python)