Home | About Us | Stelligent  

TestEarly Weblog

Agile

Agile and /Brothers23 Jul 2008 09:24 am

I’ve used Rails now for close to three years, and I’ve been teaching myself Grails for a new project.

Initial Thoughts
Grails is close enough to Rails to make getting started easier, and far enough away to be confusing in some ways. I had to learn Ruby while I was learning Rails, so there was a ‘double challenge’ there. I’ve been using Groovy for 6 months now, so with Grails the learning curve is much more shallow.

Cool things about Grails
I like the idea of having the domain objects define the database, instead of the other way around. One of the things that annoys me about Rails is having to go fire up MySQL every time I can’t remember what fields are on a class.

I like the built-in java integration, and IntelliJ’s support for Grails seems very solid.

Having HSQL built-in is very nice! That’s a big win.

Frustrating things about Grails
I have run into several bugs that leave me scratching my head - strange exceptions that keep the database from being automagically updated, and I find the different ways to handle error messages confusing.

In Grails’ defense, I don’t have a book to draw from - I’m looking at online examples and the InfoQ PDF. And some of this will go away with a little more practice.

And, all things considered, those are fairly minor complaints. Mostly what I’m struggling with right now is my own ambitious vision for the project.

Developer Testing and Agile and /Subbarao21 Jul 2008 04:00 pm

After having read the book Beginning Groovy and Grails: From Novice to Professional, I was wondering if it was ever going to be as simple as a few clicks in any IDE for Grails development. Just yesterday, I read an article by Geertjan Wielenga(who is also my colleague at Javalobby/DZone) about how to get started with Grails in NetBeans IDE 6.5 in 5 simple steps. I had worked with NetBeans quite a lot for EJB3 development but I had never used it for either Groovy or Grails; the choice earlier was always Eclipse IDE.

I first followed the Book Demo and later moved to a more real life example. This was a litmus test which I thought NetBeans had to pass for developers to continue using the same for Groovy/Grails development. The example in the book has a few relationships; which is what we would generally have in any enterprise application.
domain-classes
I was able to create all the domain classes, controllers, manage relationships without ever leaving the IDE. Creating a Domain class or even a Controller, is as simple as right clicking on the appropriate nodes and providing meaningful names. The IDE creates the skeleton classes; we need to provide the meat within and here is what the Todo Domain class looks like:

class Todo {
    String name
    String note
    Date createdDate
    Date dueDate
    Date completedDate
    String priority
    String status

    User owner
    Category category

    static belongsTo = [User, Category]

    static constraints = {

        name(blank:false)
        createdDate()
        priority()
        status()
        note(maxSize:1000, nullable:true)
        completedDate(nullable:true)
        dueDate(nullable:true)

    }

    String toString() {
        name
    }

}

Right-click the application in the IDE and choose “Run”. The application is deployed to Jetty, and then you’ll see your application as shown below:

book-example

If you are a Groovy or a Grails fan, download the latest version of NetBeans and give it a try. You can develop, test and run your Grails application without ever opening a command window. The Groovy editor has basic coloring, formatting and bracket completion. The GSP editor has coloring, highlighting of GSP tags, expressions and scriptlets. You can mix and match Java and Groovy as well.

P.S: Groovy and Grails home needs to be set from within the IDE NetBeans/Preferences as shown below:
grails-home

Resources:

Developer Testing and Tutorial and Agile and /Subbarao18 Jul 2008 10:12 am

book-coverJust yesterday, I posted a detailed review of the book “Persistence in the Enterprise: A Guide to Persistence Technologies” on Java Zone and a few other relevant zones. I wanted to share with you two very unique aspects of this book that are sure to help every developer.

1. If you are a CTO, an architect, a developer or even a tester, this book will help you ask the right kind of questions before you choose a persistence framework; comparing JDBC™, Apache iBATIS, Hibernate Core, Apache OpenJPA, and pureQuery. With this book, you’ll learn how to define requirements for your persistence tier, choose the right solution for your organization, and build and test enterprise systems that help maximize both performance and value.

2. source-and-testThe next thing that makes this book so unique is the tests written for each of these frameworks. The authors have free source code download, and you can learn how to write tests using JUnit and DBUnit for all these persistence frameworks. I have seen developers at a loss when writing unit tests for their persistence tier. This book gives you complete step by step instructions on how to run these samples and tests; via a common example application.

So, lets get started writing tests and see that we get at least 80% code coverage(strive for 100%) for our persistence tier.

P.S: For those of you who are Safari Books Online subscribers, the book is available there in:
http://safari.informit.com/9780131587564. I read the hard copy the hard way. :)

Developer Testing and Publications and Agile and /Subbarao17 Jul 2008 07:41 am

Beginning-GroovyAuthors Christopher Judd, Joseph Faisal Nusairat and Jim Shingler are getting beginners started with Groovy and Grails, taking a practical approach to teaching how to develop productive Grails web applications. Covering all the basics and some advanced topics of the Groovy language that is necessary for Grails application development, readers are guided through the process of writing a fully featured web application.

Everyone wanting to discover and use Groovy and Grails will gain the insight and skills needed to start creating their own applications.

The main highlights of this book are:
# Full coverage of basic Grails features of scaffolding, domains, controllers, services, and Groovy Server pages
# Tackles common web application challenges such as security, Ajax, web services, reporting, batch processing, and deployment
# Includes a Swing desktop client built in Groovy that integrates with the application using the exposed web services

Who should read this book
This book is for Java developers and organizations looking to become more productive by taking advantage of dynamic languages and solid agile web frameworks while lever-aging current investments in infrastructure, code, and education in the Java platform. It is for those who want to build internal applications and mission-critical, Internet-facing applications.
This book does not assume the reader has a strong Java or Groovy background, so those familiar with other dynamic languages like Perl, Ruby, Python, or PHP will find this a great source for investigating the Groovy and Grails alternative.

How This Book Is Oragnized
In this book, you’ll explore how to build command-line, Swing, and web applications using the Groovy language and the Grails web framework. The step-by-step approach will take you from a simple to a complex and fully featured Web 2.0 application. Chapters 1–3 provide a basic Groovy language primer, while Chapters 4–12 explain how to build and deploy web applications using Grails. The final chapter explains how to use Groovy and Swing to build a desktop client that interacts with the Grails web application.

You can find more information, table of contents and sample chapter online here: http://www.apress.com/book/view/1430210451

Downloading the Code
The code for the examples in this book is available to readers in the Source Code/Download section of the Apress web site at http://www.apress.com or on the book’s website at http://www.beginninggroovyandgrails.com.

Developer Testing and /Glover and Agile15 Jul 2008 05:11 pm

Andrew Binstock, a long time friend of Stelligent, principal analyst at Pacific Data Works, and SDTimes Columnist recently published an article dubbed “BDD Coming to a tool near you” in which he states behavior driven development enables

real communication with the user about the code. For example, you can sit down with the user and capture all the various requirements in a series of scenarios. Then, as you place the needed method calls into the requirements, you have a good sense that your code is indeed matching the stipulated requirements. Moreover, the user can also see that the requirements have been implemented, as each one has matching method calls. This last point is important because it gives the user or manager a way to look at code in a reader-friendly fashion.

Indeed, using the user’s language can facilitate avoiding impedance mismatch between what they ask for and what they receive– in essence, this practice can lead to executable documentation.

Check out Andrew Binstock’s article and don’t forget to check out easyb as well!

Developer Testing and /Glover and Agile14 Jul 2008 12:07 pm

shh!The notion of executable documentation, where a stakeholder’s language is leveraged as a means for decreasing the impedance mismatch between what they want and what they ultimately receive, has, for some time, been ambition of many a development team (and corresponding stakeholders!). While executable documentation proves to be an effective means in assuring customers get what they actually want, this technique also proves to facilitate a deeper level of collaboration between all parties because everyone is using the same language.

For example, the following conversation illustrates a collaborative attempt at defining a new feature– note how, in essence, the conversation tells a story– or more appropriately, a scenario in a story.

Stakeholder: For the upcoming 2.0 release, our VIP customers should receive a discount when they make a purchase.

Developer: What kind of discount– what criteria do they have to meet in order to receive it?

Stakeholder: When they have at least 3 items in their shopping cart, then they receive a 20% discount.

Developer: Does the discount increase based upon the number of items or is it fixed at that percentage?

Stakeholder: The discount is fixed at 20% regardless of the number of items. Consequently, given a VIP customer, when their shopping cart has 3 or more items then they should receive a 20% discount off the total price.

The last statement made by the stakeholder is key– note how they’ve essentially specified the requirement with a means for validating it.

Given their scenario, a developer can literally take the stakeholders comments word for word and execute them via easyb, which facilitates system validation through a domain specific language that supports stories and scenarios as follows:

scenario "VIP customer with 3 items in shopping cart" , {
 given "a VIP customer"
 when "their shopping cart has 3 or more items"
 then "they should receive a 20% discount off the total price"
} 

Of course, this particular scenario doesn’t actually do anything (other than capturing the stakeholder’s requirements); consequently, it is considered pending. This status alone conveys valuable information– a stakeholder can first and foremost, see their words as a means to validate their requests and secondly, they can gauge if their requirement has been fulfilled. Once this scenario has been implemented, it can, of course, take on two other states– those being success or failure, which both serve to convey further status information to interested parties.

Now with a collaborative scenario defined, development can proceed with an implementation– the beauty in this case is that they can directly implement the desired behavior inline with the requirements like so:

scenario "VIP customer with 3 items in shopping cart", {
 given "a VIP customer", {
  customer = new VIPCustomer()
 }
 when "their shopping cart has 3 or more items", {
  customer.shoppingCart << new Item("picture", 50.00)
  customer.shoppingCart << new Item("frame", 10.00)
  customer.shoppingCart << new Item("nails", 1.50)
 }
 then "they should receive a 20% discount off the total price" , {
   customer.orderPrice.shouldBe 49.20
 }
}

Plus, as of the 0.9 release of easyb, the DSL supports two new features: descriptions and narratives, which add detail regarding the features, benefits, and roles of a persona related to a story.

The description syntax that takes a String value or Groovy’s triple quote trick.

description "some description"
scenario "text"

or

description """some long description that requires
multiple lines, etc
"""
scenario "text"

What’s more, you can provide additional details of a story via the narrative syntax:

description "text"

narrative "description", {
 as_a "role"
 i_want "feature"
 so_that "benefit"
}

scenario "text"

Both the narrative and description keywords are optional and they don’t have to be used together– i.e. you can use the narrative one without providing a description. These aspects will be captured in the output (i.e. story report) of an easyb run too.

By leveraging the customers language, the customer has the ability to collaboratively facilitate in validating the system they want built. Plus, with development leveraging the stakeholders language there is a direct link between what stakeholders ask for and what they receive. In fact, given the support of executing scenarios with easyb, I’d say we’re getting really close to truly realizing the hypothesis that one can execute documentation.

Continuous Integration and /Glover and Agile16 May 2008 03:15 pm

hudson-groovy

If you are in Ireland (or close enough to get there easily!) the week of June 9th, then you’ll want to come to the International Conference on Agile Processes and eXtreme Programming in Software Engineering as I’ll be giving a tutorial on Continuous Integration!

The tutorial will walk students through a series of exercises on a project where an automated build system is created that facilitates compilation, testing, inspection, and deployment. This build system will then be plugged into a CI server (Hudson in this case) and students will code a series of features using Agile techniques like developer testing, which will ultimately demonstrate how a Continuous Integration process reduces risk and improves software quality. Students will then toast to CI over a pint of Guinness!

If this sounds like a blast to you, then register today! If you plan on attending, drop me an email and I look forward to meeting you!

Code Complexity and Publications and Agile and /Brothers12 May 2008 02:55 pm

I don’t always agree with Mr. Yegge, but this is a great presentation/script on Dynamic Languages with some very interesting ideas and discussion topics.

One point that he never actually got to, but one that I think is worth more discussion - how do you maintain a million-line codebase w/out static types?

My answer is that with a good dynamic language, you have some seriously elegant features and patterns that allow you to keep the size of your codebase small.  Essentially, you don’t maintain a million-line codebase - because it doesn’t take a million lines to write your application.

Which fits in with some of the agile concepts as well - if you are building a project in an agile style, the constant refactoring and removal of technical debt will keep the application smaller and lighter.  The unit tests ensure a clean level of separation of concerns, the DRY and YAGNI principles reduce bloat.

Agile and /Subbarao30 Apr 2008 06:55 am

ThoughtWorks AnthologyThe ThoughtWorks Anthology by ThoughtWorks is a collection of essays which covers a broad range of problems facing IT industry and developers in particular throughout the software development life cycle. You’ll find tons of pragmatic advice to improve the efficiency of your development efforts.

In this book, you’ll find essays on varied topics like refactoring build files, testing for enterprise applications, single click software release and many more.

This book well justifies its addition to the prestigious ranks of Pragmatic Bookshelf. It is well taken and timely, some of the material covered is just mind blowing. This is the real book you need if you are using TDD or planning to, an absolute must-read on the subject.

The book is aimed at several different audiences. The book’s coverage of its subject matter is exhaustive and obviously expert.

Highly Recommended. Stay tuned for a detailed chapter wise review.

/Glover and Business Perspectives and Agile21 Apr 2008 10:14 am

Jim York, a long time Stelligent friend, a Certified Scrum Trainer and lean and agile coach, is conducting a Certified ScrumMaster class May 5-6 in Vienna, VA.

Learn the essentials of working as ScrumMasters, Product Owners, and Scrum team members in this highly-interactive 2-day class. Jim creates an energized learning environment where participants engage in discussion, hands-on simulations, and role play to explore the nuances of Scrum in action. More than an intellectual exercise, Jim challenges attendees to connect Scrum practices to their underlying guiding principles. This class provides what you can’t get from a book — guided experiential learning in realistic scenarios.

Sign up today as space is limited!

WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1]
SELECT COUNT(DISTINCT ID) FROM