Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm work on a simple blogging web application using Java and MySQL as the database backend.

I'm implementing the whole application using plain HTML and servlets.

I'm using a Java class with static methods that are called from within servlets to handle communicating with the database.

Is this a good design? Or what should I do instead?

share|improve this question
up vote 4 down vote accepted

Build it without regard to any design patterns. Use it for a while and try to add features that make your user experience better. When you run into trouble try to fix it and chances are in the process of adding features you will rediscover the MVC framework. The point I'm making is that design decisions are highly dependent on the scale and use case of your application and it's hard to make a value judgement on what constitutes good design without being aware of the use case for the application.

share|improve this answer
This is actually what I'm doing, whenever I try to add more feature, I end up redesigning my application, thank you :) – Mahmoud Hossam Mar 15 '11 at 8:06

Do NOT retain database connections between requests. Do NOT use static methods in Java unless there's a very good reason for them (there rarely is), especially in web applications.

share|improve this answer
I'm using them for convenience (I don't have to instantiate the database class), what do you suggest I do? – Mahmoud Hossam Mar 15 '11 at 6:47

You may find that implementation using HTML/PHP/MySQL would be easier... however unless you're doing this for experience I would recommend downloading the newest version of WordPress. Its fully developed, easy to install/maintain/modify and overall an amazing piece of development!

share|improve this answer
I'm doing this for experience, and I'm not interested in PHP at all, I know it's easier, but I don't plan on learning PHP for the time being, thanks anyway :) – Mahmoud Hossam Mar 15 '11 at 6:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.