The Part Time Developer 2: The Beginning

So here’s a recap of my first week of renewing my developer vows, so to speak.

The newest Java version for the Mac is version 1.5. It’s already present. From the little I’ve heard, 1.6 is available to developers through the developer preview. I think I have a developer account but 1.5 will be sufficient for the time being. I also heard something about the 1.6 only being a 64 bit version but I’ll have to look into that at some point.

Next up was getting the latest Eclipse version. Eclipse is free open source programming editor, mainly for Java I think but there’s plugins for other languages as well. I downloaded the 3.3 Europa EE version. Not that I plan on making use of J2EE (complicated enterprise stuff), it just comes with pretty much everything already under the hood. Watched a couple nice little training videos from the web site, and followed along with a Test Driven Development example. I’m really intrigued by TDD and JUnit. It seems like it would be quite a liberating thing to have all your stuff verified with tests you’ve written in a way that would allow you to rework/refactor the way you did things and still have faith that your end result is still the way it should be. My problem is sticking with writing the tests and also I inevitably come upon a situation where I struggle with how something should be tested. Also since most of what I write is just for tinkering around, sticking to writing tests first just doesn’t happen.

Next I grabbed Hibernate and started going through the nice little tutorial they have on the site. Hibernate is what is called an object relational mapper (ORM). It basically handles the mapping (saving and retrieving) of data to and from some sort of persistence layer (usually a database) to business object within the code. In Java, you create classes that have traits to describe the class and also methods that make the class do something. For example, if I make a Dog class, it could have certain traits (size, breed, tail length) and methods (wag tail). Hibernate aids in sending the traits (or member variables in programming-speak) to and from the database.

Back in my beginning days, we just wrote a class for each database table that we used and you just used that to save and retrieve data. These ORM’s are now the trendy way of doing things. This is my second time going through Hibernate and I’m still realizing things I hadn’t before. It changes the way you need to think about things.

I find myself switching between terms for an audience that knows nothing about programming and one that does. I don’t know if any non-programmers would really care about any of this, but I’d be happy to elaborate if needed.

So I went through the simple tutorial which created a simple console app and then a webapp. That involved installing Tomcat. Tomcat is an application server that allows the hosting of web applications with a Java backend. It’s all about servlets baby! Getting Tomcat set up on the Mac was a breeze! Pretty much all this stuff was a breeze. Seemed a lot smoother than when I did it on my Windows laptop in the past.

I found a sample chapter to Java Persistence with Hibernate and have been working through that while also perusing the Hibernate documentation. I’d like to really get a deeper understanding of Hibernate than I had in the past. I strayed off the tutorial path to try some things and ran into some issues. I want to figure out what’s going on with that. I downloaded a big shopping cart demo webapp using hibernate to dig into also. So I figure I could be in Hibernate for a while.

Oh, a pretty cool little thing that the tutorials used that I played with in the past but still think is the coolest thing is HSQLDB. This is a little database that you can use in projects that’s light as can be. You just throw a jar file in your project, tell Hibernate that you’re using it, start it up in a directory of your choice from the command line, and presto! you’ve got a nice little database to use. No elaborate install, just a jar file. Pretty cool! I haven’t done anything super intense with it, so I can’t vouch for robustness and those type of concerns, but it’s a handy little thing. Be great to use for small applications.

That’s about it for now. I don’t know what I’ll really be able to report on next week, as I said I’m probably going to be staying with Hibernate for a while. I will say that my productivity has waned over the last 2-3 days. I haven’t had much time to sit and concentrate on the sample chapter as much as I’d like. I need to schedule an hour here and there over this weekend to get back at it. I have tried to continue looking over the manual that i printed out to keep at least something happening. Plus I wanted to get this post written so I could move on also.

So that’s all I know for now.

Tags:

2 Responses to “The Part Time Developer 2: The Beginning”

  1. gojim Says:

    We’re using EJB3 / JBoss 4.2.2 / Hibernate / MySQL on our current project at work. We moved away from using Hibernate directly and are using the JPA (Java Persistence API) over top of it now. Along with EJB3 (we were using EJB2.x) annotations and the JPA we were able to rid ourselves of a ton of the hibernate mapping files that we had the last go around.

    It’s all good stuff, have fun with it!!

  2. FloydWing Says:

    That’s pretty sweet, I may need to send you some questions now and then. The little I’ve read about EJB stuff was always that it was so much overkill and complicated hoop jumping. I’d be interesting in hearing your opinions on what it gives you.

    In that sample chapter from the Hibernate persistence book by Bauer/King, there was a section on JPA and EJB stuff, but I’ve skipped over it. The annotations looked like an interesting way to avoid the mapping files. I may need to go back and look into that stuff once I get a firm understanding of the core Hibernate stuff.

    I wish I would have kept up on all this stuff back when I was in a couple years back.

    You still at the college? My Uni doesn’t allow me enough resources do even dream of doing anything that involved.

Comments are closed.