Slides: Test First, Refresh Second: Web App TDD in Grails by Tim Berglund

Here are the slides for the talk Tim Berglund gave this week.

[slideshare id=1861704&doc=testfirstrefreshsecond-090814112612-phpapp01]

Posted in Monthly Meeting | Tagged , , | Leave a comment

‘Java Servlets & JSP’ Book Review

murach_cover

Review of Java Servlets and JSP by David Madouros

I’m torn after reading Murach’s Java Servlets & JSP book, 2nd Ed. I read the first version when I was making the transition from mainframe programming to Java programming and found the information to be extremely helpful for getting up and running very quickly. With the authors’ assistance I had a database server, a servlet container, and a ‘hello world’ web app running within a couple of hours. On the other hand, reading the second edition as an experienced Java developer made me cringe. Ultimately, I have to side with the my experienced side. Especially when I consider how well the format of Murach books tends to make them canonical references and how easy it would have been for the authors to teach better practices.

The cover of the book makes at least three claims:

  • Get off to a quick start
  • Build professional web sites
  • Handle databases like a pro

Get Off to a Quick Start
The authors get off to a great start by helping the reader to download, install, some basic tools including a servlet container, a database server, and an IDE. They guide the reader with step by step instructions for installing both Tomcat and MySQL — bonus points for recommending the latest versions of each. However, I’m stumped by their choice of IDE — NetBeans — and their claims that it is a top notch IDE. Technically, I suppose it is third, but in my experience it’s a distant third well behind Eclipse and IntelliJ.
Build Professional Web Sites
I take issue with much of the material presented in the book and how it lends itself to creating ‘professional’ web sites. For starters, the authors provide an excellent introduction to HTML. Too bad XHTML is the current standard. The authors state that they’d rather discuss HTML than XHTML because they feel that XHTML is too difficult to teach in a single chapter. I thought this was ridiculous, but assumed they would at least promote well-formed HTML — boy, was I wrong. They consistently use of malformed HTML in their examples and go as far as mentioning the lack of unquoted attributes as a good thing! This is bad, but it gets worse because a couple of chapters later they have to discuss well-formed HTML before they can teach the reader how to use JSTL.
The authors discuss both JSP and Servlet technologies in separate chapters and demonstrate how to create ‘complete’ websites with each technology. I suppose this is necessary to teach the underlying technologies, but I wish that the authors had down played their use a little more. They do eventually discuss MVC (model 2) and state that it is a better solution, but they take the easy way out by saying that sometimes straight JSP and straight Servlet implementations are except- able.
My final grumble about creating professional websites has to do with the chapter on custom tags. While using the classic tag mechanism was a pleasure (not!), the simple tag mechanism is exactly what it claims to be — simpler — and much more straight forward. However, the authors only mention the classic mechanism — no mention of SimpleTagSupport and no mention of tag files. Long live SKIP_BODY!
Now for the good stuff… My favorite chapter in the entire book has to be chapter 9 because they give a high-level summary of JavaBeans and JSP tags stating that they are outdated and rarely used anymore — replaced by JSTL. The only reason the authors even mention them is that the reader may need to know about them to support legacy applications. I wish the rest of the book gave more of these disclaimers.
Finally, the authors really do a good job of describing the technologies. I just wish that they’d promote best practices and shun bad ones more often.

Handle Databases Like a Pro
The authors give a good overview of SQL and then move on to coding straight JDBC code. However, they choose to close the connection inside of the try block rather than follow the best practice of closing the connection in the finally block. Also, they mention the differences between Statement and PreparedStatement and seem to lean towards Statement unless there is a need to execute the same statement repeatedly, but throughout the entire discussion there is no mention of cross site scripting prevention as one of the benefits of the PreparedStatement (not that PreparedStatement completely eliminates the threat of XSS, but it greatly reduces it).

Summary
In summary, this book is a disappointment. The subject of web development involves many technologies: CSS, HTML/XHTML, Java, Servlets, JSP, JSTL, EL, SQL, Http, and Javascript; and this doesn’t include the various frameworks (Struts, JSF, Spring, Hibernate, GWT, etc.) The authors make a valiant effort to cover all the base technologies, but there’s just too much to cover in a single book and be able to make the claim that the reader will have all the skills necessary to create professional websites. This book barely manages to cover the basics. I give the authors an A for effort, but a D for execution. Having said that, if you don’t understand any of the technologies (other than Java) and read the book with the understanding that this is just the beginning, this might be the book for you.

Posted in Book Review | Tagged , , | Leave a comment

‘Modular Java’ Book Review

Review of Modular Java by Johnny Wey cwosg

“Modular Java: Creating Flexible Applications with OSGi and Spring” provides a great introduction to those either curious about OSGi or wanting to get more out of their existing OSGi workflow using the Spring Framework. Craig Walls, author of “Spring in Action, 2nd Edition”, opens the book explaining why OSGi matters and how it can be used to enhance the modularity and maintainability of those application stacks containing multiple and complex moving parts. He not only serves up a great introduction to the technology, but also directs the reader to several tools that make OSGi development significantly easier.

In the second portion of the book, Craig throws Spring into the mix and demonstrates how the power of Spring Dependency Injection, autowiring, and the Spring MVC web framework can not only run seamlessly in an OSGi container, but also remove a large portion of the burden that OSGi’s API can put on application development.

Finally, Craig spends some time describing how an actual deployment might look in a production environment using both Tomcat and Jetty and provides optimization tips that make the process as painless as possible.

The book itself is logically organized and Craig’s writing style is approachable and easy to follow. All the example source code is available online, and Craig demonstrates how to install OSGi packages using both Eclipse Equinox and Apache Felix, leaving the final OSGi container decision up to the preference and requirements of the project. The sample application Craig uses to demonstrate the concepts in the book is surprisingly fun and useful, and the book contains some wonderful appendices that function as a great reference for current and future development projects. The book is a relatively quick read but surprisingly complete.

For someone looking to get the most out of OSGi or wanting to find out what all the “buzz” is about, Craig Walls’ book is an outstanding choice.

Posted in Book Review | Tagged , , | Leave a comment

October 15, 2009 Meeting

Tivoli 320 AB

BC – Tim Berglund TDD w/Grails

Abstract:

Not many of us question that TDD is the right way to write software, but not many of us really practice it either. Even fewer of us do it when writing a web app, and with good reason: web app code is usually coupled to a framework, and the framework is usually coupled to a web server on one end and a database on the other. All this coupling does not set us up for testing success.

Grails 1.1 introduces several features that make it easy and truly productive to create a web application while testing first. In this talk, you’ll learn how to use Domain and Controller mocking to write unit tests that can be run quickly and easily from the IDE or from the command line. TDD with 100% coverage had always been possible in Grails, but for the first time the tools make it the kind of thing you’ll want to do. Learn to use the new features of the framework to build your web app the right way the first time.

About the Speaker:

Tim Berglund runs a software consulting firm called the August Technology Group (www.augusttechgroup.com), which provides training, coaching, and development services to customers building web applications with open-source tools, especially with the Grails framework. His technology interests span web applications, business integration, data architecture, and software architecture, but his greatest passion is to help developers improve in their craft. He is a frequent speaker at local user groups, and helps lead IASA Denver (www.iasadenver.org) and the Denver Open Source User Group (www.denveropensource.org). He is currently writing the book, Deploying Grails (to be published by O’Reilly), due out in 2010. He lives in Littleton, CO with his wife and three children.

FEATURED TALK – Randy Kahle on NetKernel

Abstract:

NetKernel is a software platform that runs on the JVM. It is based on a very small pure REST kernel and includes tools and services in its stack (much like Unix). Like the Web, everything in NetKernel is identified by a URI.

NetKernel started as a research project in HP Labs in 1999. Since 2002, the technology has been advanced by 1060 Research. We are releasing NetKernel 4 on 10/9/2009 and this represents a major step forward in the refinement of the abstraction and platform.

NetKernel is used by large corporations (e.g. BlueShield of California) governments (e.g. US Army, Intelligence Agencies) and small companies. All report the same – applications built on NetKernel run faster, require less code, scale with cores and in general, simplify systems.

More information is at http://www.1060research.com (Note: while the company is located in the UK, I work remotely from Fort Collins).

In an hour presentation I will present the fundamentals of the abstraction, demonstrate example working applications and explain the architecture and answer questions.

About the Speaker:

BA  EE/CS Rice University
MBA Dartmouth

I have worked at GTE Sylvania, HP, Microsoft, MageLang Institute, with my own consulting company and lately with 1060 Research. I worked with Java since the early days and with MageLang institute was an early consultant, instructor and architectural advisor to investment banks, manufacturers and service companies.

Posted in Monthly Meeting | Tagged , , , , | Leave a comment