Category Archives: spring

Bootstrap and jQuery make me look good

I recently was given a task that seemed kind of big for me. I had to generate a web site targeted for a certain with little time. I put off planned vacation time in order to meet this schedule.

Bottom line, I spit out the site, and to top it off, my co-workers were impressed with my work. I had picked three key technologies:

  • Grails
  • Twitter Bootstrap for styling
  • jQuery for incidental refinements
Grails was the ticket to rapidly building a web site that not only was easy to create, but had mature plugins like Spring Security, ability to map some URLs for customized REST points specified in the requirements, and easy ability to manage database evolutions. Grails also comes fully loaded with Spring which through its MailTemplate made it easy for me to build an email-driven registration system.
But Grails was just the beginning. I had been tinkering in my spare time with learning how Twitter’s Bootstrap layout library worked. It was fantastic and let me quickly build a professional looking site. I learned how to use the various classes to lay things out. Then on the input fields, I was able to easily tag required fields. Bootstrap provided convenient validation. I even marked up certain fields using the HTML5 “email” types, and Bootstrap would trap entries that didn’t have email fields and alert the user.
Finally, I needed to force users to scroll through a EULA, and that is where a bit of jQuery did the trick. I had jQuery only enable a checkbox when they scrolled to the bottom, and then clicking on the checkbox would in turn enable the submit button.
All of this may sound like Web Programming 101, but what you probably don’t realize is that for the past 10+ years, I have worked on thick client interfaces using Swing and other things. I am a real newbie when it comes to HTML, CSS, and JavaScript! But tools like these define a whole new style of programming. Based on what I’ve seen, today’s web programming paradigm isn’t the same as what it was five years ago.
That means I don’t need to catch up on how people built web pages 5-10 years ago. I need to learn what people are doing today. And tools like Grails, Bootstrap, and jQuery tell me that this is in my grasp. My fundamental skills as a programmer are still useful even in a paradigm I sidestepped for 10+ years.
Maybe some people would consider my web-based skills impure because I lean on these libraries too much. I admit I probably couldn’t build these things if I had to. But that doesn’t matter. When people were building up the web 15 years ago, they never imagined many of the standard things we use today. And what does it matter? If the site looks good and works, that’s what counts, right?
This makes me excited to work on the “next” website. These tools make it really fun. Even now I’m learning how to customize the look-and-feel of Bootstrap. I’ve already plugged in a custom font. After a bit, I might figure out how to customize the navbar. All good stuff.
Happy programming!

Looking forward to speaking at Atlanta Spring User’s Group

If you visit, you can sign up for my talk I plan to give on Spring Roo and Micro Cloud Foundry in January. I’m excited to travel down there, rub elbows with Spring enthusiasts and co-workers alike, and talk about some good ole’ Spring stuff.

For those of you that are coming, I plan to bring some goodies to add to the door prizes as well. Look forward to seeing you ASUG!

Book review: “Just Spring”

I finished reading “Just Spring” by Madhusudhan Konda over the weekend.

The author states in the preface,

If you wish to get introduced to Spring quickly and precisely, or would like to refresh your knowledge on Spring in couple of hours, or have only a weekend to learn Spring before you start working on it on Monday, this is the book that you should choose.

“Just Spring” definitely lives up to that goal. I was able to read through the book in a few hours, reading probably 90% of the code, and feeling like it hit home with the basics.

I am an experienced Java developer with a strong familiarity with Spring. This may sound like I was able to whisk through the book based on my experience, but that is not the case. I have read several Spring books and can say with complete confidence that the author was very good at making it a light read. The code samples are simple and easy to follow. He didn’t dig into the more complex functionality of Spring, but instead stayed on target with covering the core parts.

Three of the five chapters focus on Spring, Spring Beans, and the Spring Container. They do a great job of introducing dependency injection (DI) as well as Spring’s battle tested container. It shows the benefits of DI along with configuring things using XML and annotations. The author also gives pros and cons of XML vs. annotations. I really appreciated that after discussing this, he took a stand on his own preference and why.

In the fourth chapter, Madhusudhan discusses the essentials of Spring JMS and its powerful JmsTemplate. This includes a 2-minute intro to JMS for the unfamiliar. In ten pages, the author does a good job of showing how to create message driven POJOs. He is also good at pointing out some of the limitations of JmsTemplate, especially its synchronous nature, and how to receive messages asynchronously.

In the fifth chapter, the author wraps things up by introducing Spring Data. In about eight pages, he shows how to use both the JdbcTemplate and the HibernateTemplate. These two powerful utilities were some of the biggest tools that helped empower the Java industry. Some have even said that Spring and Hibernate go together like peanut butter and chocolate, and Madhusudhan does a good job at showing how to set up and use these tools without getting bogged down in unnecessary code.

While reading the chapter on Spring JMS, I debated in my mind whether I would have included this in “Just Spring” were I to write it myself. That is probably because I don’t write heavily message-oriented systems. I would have preferred a chapter about Spring AOP (aspect oriented programming). Perhaps that would have the book too big to read over the weekend. Since the author is already working on another “Just Spring” book, perhaps he will eventually write one that focused on AOP.

I also felt like the Spring Data section was a little out of date when it delved into the HibernateTemplate. In its earlier days, Spring greatly simplified the Hibernate API, but since then, Hibernate has greatly improved their API. Similar things can be said for JDO and iBatis (which aren’t part of the book). The point is, Spring 3 documentation now currently recommends coding against plain Hibernate, JPA, and JDO APIs. But if you are joining a team that uses classic ORM, this section will be of immense value.

Nonetheless, the light writing and easy-to-follow code samples definitely makes it easy to pick up the concepts of core Spring. I would recommend it to anyone who is getting started with Spring or joining a new Spring-based team and wants to catch up quickly.

Disclosure: I was provided a free copy of the book.