• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Design Pattern

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I want to develop a my own framework or say improve code for my web
project.

I have some idea in mind please give your view on it.

we have a project in which we are using jsp/servlet/ejb.

Assume user click or submit a form from jsp page then our
control(request) goes to a servlet say Action, here based on some
actionValue which coming from jsp page, we decided to call it a
specific engine, again on this engine based on that actionValue we
call business class.Now in business class we are manageing all the
codes regading database(saving, updating etc.)

Please tell me you review on the above and how can i improve my code.
If required any other info please let me know

Thank you
 
Ranch Hand
Posts: 515
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sounds OK to me. The question I have is why are you using EJBs? To me I only use EJBs when the need arises. And even then I might not use them if I can find another solution. If you are looking to manage your transactions, you can simply use the JTA (Java Transaction API) to manage them. Is this an internal web app or external? What really pushes the need for using EJBs. Just curious what your argument for using them is.
 
Ranch Hand
Posts: 308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i agree with dale.

in my former times i was very enthusiastic about ejb (2.x, before having used it) because i thought big players (IBM, oracle etc.) couldn't be so wrong pushing this technology to marcet.

if i was you i would have a try on spring-framework. first of all things get much easier, better testable (which in my view is a key criteria for "good" software) and further more you see very good design principles in practice (so you learn a lot about design too).
 
shyam shridhar
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks dale.

Actually i am not using ejb ,i'm using jpa(java persistence api) with jta.

the main reason behind my previous post is that i want to improve my code management skills. write now i have knowledge of some design pattern and framework.But i'm not sure i apply them in write way.I give you example which is as follow

i have to do some action like add,edit,delete...etc more than 100 for each & every module , let assume currently i have 7 module. So that mean instead of writting 700 or may be more if else in a single class i divide workload for each module in a seprate class.

proposed solution
so to achieve this :- i have a single class or servlet where i received request(action) for all module and then based on module call an another class or moduel engine.
so here we devide 700 action to 7 differenct class 100 each.

Now in each engine we will write code like :- getting data from request,and call to some business utility, which actually save and retirive data from a seprate layer(project) which represent database (this layer is something like DAO ata Access Object pattern).

Finally as you read above, ithas my idea i think that from engine i'm not managing or thinking it properly.

Hope somebody suggest some improvements or discuss to make it better.
 
Our first order of business must be this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic