Forums Register Login

Single Bean for all?

+Pie Number of slices to send: Send
Hi friends,

i want to know whether it's a good practice to use a new bean file for each process or i can add a function in the existing bean. For example i put all my setters and getters and functions of login and logout in a single bean instead of two?And i call it from separate servlet file? Which one is a good practice?
+Pie Number of slices to send: Send
To obtain the less overhead in maintenance, it is always better to segregate/group the related functionality.

Calling it from the Servlet does not really matter but if you do with the database calls for login/logout activities, do have the DAO pattern involved. DAO stands for Data Access Object and it is one of the suggested Design Patterns.
+Pie Number of slices to send: Send
But what would it really happens when i simply code it using a MVC pattern without DAO and i need as many models as if my functionality extends..ie..if my site has 40 kind of functions like login..user details..vendor info...and for each one of them i write a bean file? Will it be a good practice? Could you clarify me!!!
+Pie Number of slices to send: Send
If you write a bean for each functionality your classes will be highly cohesive and maintenance of your code will be easy. On the other hand, you will have more classes It is absolutely based on the requirement and your design choice
If you want to look young and thin, hang around old, fat people. Or this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 645 times.
Similar Threads
Filewriting in EJB
how to fetch the value of the checkbox in jsp?
limit on Connections
css browswer compatibility
Servlet can't find other servlet
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 17:00:41.