Showing posts with label Refactoring. Show all posts
Showing posts with label Refactoring. Show all posts

Monday, October 19, 2009

Sculptor and Agile

For us, the agile way has always been the way of getting things done. Even before there where fancy names for it we did things in a way that enabled us to deliver the right things on the right time. This hasn't change, but now we call it scrum :-)
Sculptor will help you if you want to work agile.

Things change
They do. There is nothing anybody can do about it. And when things change, there will be delays. Doing things in an agile manner helps minimize those delays. Using sculptor helps you even more.
I'll show you by an example. Lets say you have an application that is almost done for production. Testing is done. No more bugs (yeah, right). On the final demo, suddenly, one of the stake holders realize that the customer object needs another attribute, lets call it ICE (In Case of Emergency). And, of course according to the stake holder you can't go into production without it.
So, what are the changes that needs to be done?
From the bottom up:
  • Database schema
  • Persistence layer (JPA, Hibernate, etc) :
  • Domain object
  • Service layer (if we have any logic tied to the attribute)
  • Back office Client (for creating a customer object)
  • Public Client (for viewing a customer object)
Most of these changes are boiler plate code. Changing declarations etc. Without Sculptor these changes takes time and are error prone. If we assume that every change is a risk and then calculate and compare all changes we need to do with and without Sculptor we end up with the following table where every point is a code change needed to do to accomplish the last minute requirement:








Without SculptorWith Sculptor
model:01
db script:10
db migration script:11
property in domain object:10
jpa annotation för property:10
logic in service or domain object:11
back office client (create/update/list/view):70
public client (view):11
junit test (save, find):22
documentation (class diagrams):10
sum:166

So, being simple, lets say that each point is equally valued. By this assumption we reduce risk and time by 150%

This can be very valuable when change comes along. And it does, doesn't it...?

Thursday, August 27, 2009

Screencast: Introduction to Sculptor

During the summer I have published a series of articles that illustrate basic usage of Sculptor. They include screencasts so that you get a feeling of what it looks like when using Sculptor.

If you are totally new to Sculptor you might need to read What is Sculptor? before looking at the practical example.

The series illustrates the following, step-by-step:

  1. Jump Start - Initial creation of maven and eclipse projects. Persistent entity and CRUD GUI are created in a few minutes.


  2. The World is Changing - Adding more to the application. Quick development round trip, short feedback loop, it is not a one time shot.


  3. Testing is Simple - Testability is crucial and is of course supported.


  4. Adding Behaviour - Generated code is well separated from hand written code.


  5. Say Hello - Entity, Repository and Service are some of the available building blocks. Yes, it is real DDD-style.


  6. Introducing a Type - Developing a high quality domain model is the core of Sculptor. Small type objects are typically part of a good domain model.


  7. Refactoring - How is refactoring done when having a mix of hand written and generated code?


Tuesday, August 25, 2009

Refactoring

Sometimes I get the question "How is refactoring done when having a mix of hand written and generated code?" It is a good question, since refactoring is very important. The intention is that existing IDE refactoring tools will continue to serve you when using Sculptor.

When doing initial prototyping and you don't have any (or little) hand written code you can easily change in the model and re-generate. When you have hand written code you start with using the refactoring tools in the IDE, as you are used to. Thereafter you do corresponding change in the model and re-generate.

Eventual mistakes will normally be caught by the compiler and JUnit tests.

The following screencast illustrates how to rename Planet to Planet2.




Alternative video format (mpg)

Sculptor doesn't make it more difficult to do refactoring. Sometimes it makes refactoring easier, when the change only affects generated code.