You advise is needed - Practicing web tier patterns

Discussions

General J2EE: You advise is needed - Practicing web tier patterns

  1. Hi,

    I have read the first few chapters of 'Core J2EE Patterns' related to the web tire but did not do any coding to practice them. I tried the 'Adventure Builder' web application provided by the blueprints team, but it depends on the WAF which I am not familiar with. I have no experience with Struts but I have been using JSP and Servlets for the last year and a half in which I used the MVC architecture for development. Can anyone guide to the proper direction to practice the patters.

    Thanks,

    Basel Mahdi
  2. There's nothing better than writing your own web-app from scratch, in an incremental fashion, appling the patterns as you go along. Perhaps one pattern for each interaction?

    Regards,
    Martin
  3. Thank you Martin for you reply.

    Does that mean frameworks such as Struts and JSF implement part of the patterns?

    Thanks,

    Basel Mahdi
  4. Hmm... Struts is an implementation of MVC for webapps. JSF, I couldn't say. I never cross-analized Sun's J2EE core patterns versus Struts or JSF, actually.
  5. IMO Struts and JSF are very similar and both use the MVC.

    IMO the JSF is the future, so I would suggest you to:
    - try to develop some small app with the JSF
    - try SUN's JAVA creator - IMO fastest way, how to write the web tier
  6. JSF is the future

    I guess you bought a bunch on Sun's stocks, right? I mean, to make such a statement on a subject so uncertain as the future.
    ;)

    Regards,
    Martin
  7. 1) well, it is my opinion ("IMO"). I do not say it will happen ...

    2) JSF are implemented now by SUN, IBM, Oracle and some OS group

    3) 3 above mentioned companies are preparing IDEs or they have them already

    4) 6 months ago I was looking for a GUI editor for Struts and I did not find it. Now I am using SUN's JAVA Creator and I can drag and drop (tables, buttons, dropdowns ...) my web tier in 10 minutes. And it is also MVC and IMO it is quit similar to Struts.

    so my typical scenario is:

    - I create an Oracle table
    SUN's JAVA Studio 6:
    - generates for me the CMP entity bean from DB schema
    - I add "create" and "findAll" methods to CMP
    - I encapsulate the CMP by DAO
    - I encapsulate the DAO by BD
    SUN's Creator:
    - creates JSP
    - drag and drop the dataTabel to JSP
    - connect table to the collection of CMPs from BD
    - add 2 lines of code for "insert, update,delete" buttons
    SUN's App Server 7.1
    - deploy to SUN's app server 7

    A) in 10-20 minutes I have the CRUD for 1 table

    B) if the table is long I go for the JDBC DAO and then it takes longer

    3) my architecture is split to 3 layers: web, BD and DAO

    4) web tier uses MCV

    5) DAO uses OR mapping for DB caching and JDBC if I do not want to cache

    6) DAO is implemented by CMP and JDBC based on DB caching motivation

    7) ALL MENTIONED HERE IS FREE EVEN FOR PRODUCTION ENVIRONMENTS !!!

    I am quite happy with my productivity and architecture.

    Any TECHNICAL comments are welcomed !!!
  8. Just wait a second here. This thread is not to discuss the future of Struts or JSF. It is about practicing the web tire patterns in the 'Core J2EE patterns' books.

    I would appreciate any guidance to practice the patterns. As I mentioned I did some web applications using Model 2 and now after learning the patterns I need to practice them.

    Thanks,

    Basel Mahdi
  9. Hi Basel,

    Do you want to practice e.g. MCV by using some MCV framework (e.g. Struts) or by writing your own MCV framework?

    If you prefer the second option then Rod Johnson in his "J2EE Design" book describes writing his own frameworks based on web tier design patterns.
  10. Hi Damian,

    I have already practiced the MVC architecture. What I need is a starting point to practice the web tire patterns in Deepak Alur book, Core J2EE Patterns, which I have read the first few chapters related to web tire patterns. I tried to refer to the 'Adventure Builder' web application developed by the blueprints group but I do not know from where to start.

    It is not that I have to practice using the 'Adventure Builder' web application. Any other web application will be fine for me. I need your guidance and advice.

    Thanks,

    Basel Mahdi
  11. Hi,
    It is not wise not to use a framework that has been tested by thousands developers. So Struts is the one of the most at the web/presentation tier.

    When you decide STRUTS then you just need a SERVICE LOCATOR pattern to get rid of time consuming JNDI lookups.
    Business Service pattern is embeded in struts actions.
    Namik
  12. Hi Namik,

    Ok now I have to use a trusted framework such as Struts to practice the patterns.

    My question is, does Struts implements parts or some of the patterns? Will I encounter some classes or interfaces in Struts that are in fact part of a web tire pattern?

    Thanks,

    Basel Mahdi
  13. Sweet cheezus!! Should I believe that you haven't read the Strut's documentation since opening this thread?
    You don't need advice, my friend, you need MOTIVATION.
    My advice is: read the framework's docs. I think than in page 1, paragraph 1, you can find "Struts is an implementation of the Model-View-Control architectural pattern for web applications".

    Regards,
    Martin
  14. Hi again,
    If you decided to use STRUTS then you just need the patterns i mentioned before. STRUTS handles the rest.

    good luck
    Namik
         communication+co-operation=success

    note: if you need info about struts, the ebook whick you find here in theserverside

    http://www.theserverside.com/books/sourcebeat/JakartaStrutsLive/index.tss