Best approach to creating a database driven Java website?
I'm fairly new to programming and new to java, but I'd like to jump in the deep end with a little database driven website project. I've read quite a lot about requirements in the 'real world' requesting experience with Spring and Hibernate, so I have those installed on netbeans and a project created (if I hit run I get the default spring page). Now I j开发者_Python百科ust need a little guidance as to where to start designing my app (please tell me if I'm getting in a bit too over my head for a beginner!).
Should I start off with my classes? - create all my classes as they map to my database tables and decide which attributes and methods each will require?
Can anyone suggest any good books for maybe.. making a java based website from scratch (i.e. from design right through to deployment) that might be useful for a beginner?
Any help appreciated thanks.
Edit: since posting this I've found a brilliant book that fits my needs just right to get started. Firstly I tried both spring in action and hibernate in action - but found both to be a bit too heavy for my novice mind. Instead I got the Java EE 5 Development with Netbeans 6 book https://www.packtpub.com/java-ee5-development-with-netbeans-6/book and its been a great help. If you use netbeans and are in a similar position to me, I'd say pick it up!
Too over your head? Depends on what you hope to accomplish. Are you trying to create a revenue-generating site to which users will be asked to trust credit card numbers and other sensitive information? Then yeah, you're getting way ahead of yourself. Is this a tool for personal use or a toy you're throwing together primarily as a learning experience? Then I say "Pffffft!" to the notion of over-the-head-ness. Go for it.
As to where to start, I say start with whatever portion of this beast is clearest to you. Have a solid idea of what the database is going to look like? Then start with it and its supporting classes. Have a clear vision of what the guts of the code are supposed to do? Start there. Etc. And if all things are equal, I'd say start at the bottom with the database layer and work your way up -- but that's just me.
And as for the books, can't help you there, but I'm sure somebody can.
I suggest to take a look at web application frameworks such as Spring's Roo or Grails. Sadly I have no experience with Roo. But I do have some experience with Grails.
With Grails you will be working mostly with Groovy, a language similar to Python, but still using the JVM. You'll still have the option to use Java anywhere you like (I think). Grails (and maybe Roo too?) manages Spring and Hibernate for you.
As for books on Grails, I recommend "Grails in Action". I have read a little of "Grails 1.1 Web Application Development" and it also seems to be a good reference. BTW, netbeans supports Grails too.
Not trying to gut your goals, but if you are wondering whether to start with your classes, I would suggest you work on your programming skills more.
I'd suggest taking a look at Larman's "Applying UML & Patterns: An Introduction to Object-Oriented Analysis and Design and Iterative Development (3rd Edition)" as well as a book on relational database theory (you need to know how to model databases properly.)
You can try your hand at building a database driven web app, and it might give you an insight into how to do it, but you need have some programming maturity to take those skills into the non-trivial.
This is a completely personal opinion so please take it with a grain of salt: Before someone tackles the building of a data-driven application with the purpose of eventually being able to use it in non-trivial projects, that person needs to have a good exposure to programming (by good I mean a LOT, say 1-2 introductory courses, 1-2 intermediate and at least one junior-level course, perhaps a total of 15-30 credits.) Unless that person is a natural programming virtuoso, I don't see it happening otherwise.
I would suggest, if you are serious about programming, to spend a substantial amount on learning the fundamentals before tackling something like this.
Good luck.
精彩评论