Friday, 24 August 2007

NORM

I have been working on a little framework that I think might be useful then developing applications on a Compact Framework device. Its an ORM for PDA's inspired by Hibernate. I developed the initial framework in a day or so just coding away in a nice flow fashion and I am quite happy with the result. Its called NORM and is available from here.

The basic idea was to try to abstract away all the SQL specific stuff from the programming model to allow for working with POJO's as easy as possible. Lets just say I got one step to bored with having to think/work/program in terms of Tables, Rows, DataSets and so on in .NET. For me that is just to low level. I want to work with proper objects (POJO's), and I want the CRUD operations related to these to be as transparent as possible. The less code I have to write the less I have to worry about.

The framework itself relies heavily on Annotations and Reflection as I am a strong believer in a self-contained representation model. Thus I should not have to configure something unnecessarily in a configuration file (XML or something similar) when the intent can be clearly specified in the class file itself.

Some basic assumptions regarding the framework
  • The schema must match that of the domain model (currently working on an schema auto-generator)
  • There is a one to one relationship between a table and a class name (unless otherwise specified using an Annotation)
  • There is a one to one relationship between a field and a table column (unless otherwise specified using an Annotations)
  • The many2one relationship must follow: (src table) id -- field_id (foreign table)
This is implemented so far:
  • All fields are persisted unless [Transient] is specified
  • All fields are persisted unless [Transient] is specified
  • Only classes with [Entity] can be persisted
  • Strings are assumed for all fields unless the Id is field
  • The Id field is an Int32 which cannot be null so it is assumed that a class with Id == 0 is fresh and can be inserted
  • Attributes to specify the persistence option:
    • Entity (speficies that this class is persistable)
    • Id (speficies this field to be the primary key)
    • Component (flattens the the object graph)
    • Transient (do not persist this field)
  • Inserts an object graph (semicascading)
    • (Only persists object with the [Entity]attribute specified)
    • (Only fields != null are included)
    • (If the id != 0 dont bother with generating an insert)
  • Update individual objects
    • (No dirty checking but only fields != null are included)
  • Load an object and automatically populate it with the data from the DB
  • Supports QBE whereby only fields != null are included
  • Load an object graph (shallow cascading)

Features that I am working on at the moment
  • Collection support (requires implementation of laziness)
  • Dirty checking (requires a 1 level cache, Session or something)
  • Support for more databases and dialects (currently only SQLite)
  • Persistence by reachability (no dynamic proxies in CF, so have to rely on a CRUD service)

I am looking for developers that are interested in contributing to this framework. If you have been using NORM in a project yourself please drop me a line or two and tell me about your experience. Any feedback is more than welcome.

More information is available from the sourceforge.net site...

Monday, 11 June 2007

Groovy vs. Ruby

Both are very compelling and provide with very powerful abstractions...

but...
  • I don't really like the syntax in Perl and unfortunately Ruby is living in that space..
  • Groovy seems a bit lagging behind in areas like parallel assignment
  • No good IDE support overall, maybe next year :)
despite that...
  • Groovy really shines with its natural Java blending capability
  • I love the Grails project, showing what is possible with Spring and Hibernate
  • Dynamically typed languages are just sweet... write less and no interruptions in your flow
  • Groovy just added Annotation support, that is way cool
I devoted some nerd-time to learn both last year and I really enjoyed the exposure. I think its important to experiment with different conceptual tools such as programming languages from different paradigms as it expands on the set of potential solutions you can dream up for a particular problem.


So for example...
Say for example how nice it would to be able to do something like this in Java:

Map stuff = {"locale" : "en", "theme" : "basic" }

...but of course we cant so we have to resort to something like this:

Map stuff = CollectionUtils.asMap(new String[][] {
{"locale", "en"}, {"theme", "basic"}} );


There is nothing in Java that is called CollectionUtils.asMap(String[][] map) so we have to create this ourselves, but without the exposure to the Map construct in a higher level language like Groovy it would be less likely that we would create a method asMap() as in the example above just because we had not experienced or perhaps not understood the power of such an abstraction.

Hmmm, so why is this so powerful, well it has to do with expressiveness and preciseness. Math is an excellent example of how you can cram vast amounts of precise knowledge together to describe a phenomena in nature... but just as Perl its syntax is quite obnoxious. I think I like math more :)

The way of Scrum

Was talking to my good friend about planning a software project and I wrote down this little overview on how I tend do it but it could change from one project to another...

Initial setup
You do an initial inception/elaboration phase where scoping takes place. Not all requirements are gathered here through. Maybe 30%-40% of the major ones.

Then for each sprint (iteration) you do analysis, design, development and testing over and over again. You find more requirements here maybe around up to 80%-90%. You should do integration here progressively.

Rule of thumb NEVER WAIT UNTIL LAST MOMENT WITH integration, testing, security and so on.

Then in the Closure/Transitional phase you complete/finalize the project.


Details around Scrum and Agile project development
So lets say you have a 4 week sprint (with is the name of one iteration when)...

So each software component would have to be broken down into smaller chunks that each should not take more than 8-16 hours (1-2 days) to complete. With completion here I mean:

Analyzed, designed, implemented and tested.

Backlogs
The team of stake holders would sit down and decide what the project should deliver. The following artifacts are produced:

Product Backlog - for the whole product (very high level, specifies the complete product)
Release Backlog - for a particular release (more details added, subset of the product backlog, for a release say v1.5)
Spring Backlog - features picked for a particular sprint, subset of release backlog (1 iteration worth of features)

The process and phases
So the Scrum project is divided into the following phases:

1. Review release plans (done by developers, picking from the backlog)
2. Distribution review and adjustment of product standards (done by developers)

This is where the majority of the work is done

3. Sprint (developers doing work, 4 weeks typically)
4. Sprint review (by stakeholders to determine next sprint, determine completion based on complexity and feedback)

5. Closure (last finishing activities, debugging, optimization, marketing and release)

So lets say for a 5 sub-projects and 5 components gives you 25 items in your backlog

So given that you have 5 months to complete the project you can break down the backlog into roughly 25/(4/20) = 125 chunks per sprint. So say you have 5 people in our team then each developer will work on around 25 chunks per iteration. That is your backlog "Burndown" rate... something called the project velocity in XP and other agile methodologies.

You need to be able to keep track of the Velocity in order to be try to track how the project is progressing. You need this as you would want to to be able to check your estimates... So lets say that one spring your velocity is 25... then if you calculating backwards you will find that you will be able to do 125 chunks based on having a team of 5 developers. But say that for one sprint your velocity is only 15 then you know that for the same number of developers you can only deliver 75 chunks so that will be your estimation baseline for the next sprint... So by using these instruments you can adjust the project plan and sprint backlog accordingly.

Saturday, 28 April 2007

Dont make me think

Interaction design is such an important craft when designing a professional looking website. The interaction designer not only has to get his/her head around the concepts around the product but also designing a look and feel that would help potential customers to use it efficiently and also would want to come back and use it again.

This is much harder that some people tend to think. It usually takes only a few seconds to decide whether you like a site/UI or not. What are the factors?


Look (colors, fonts, size,
and layout) and Feel (does it do what I expect it to do)

The Look and Feel should be covered by the interaction/graphical designer.

Speed (it should load fast, its that simple)

Ajax has helped tremendously to speed up various aspects of a web site. There is usually no need to refresh the whole page as we only work with smaller areas of a page such as:
  • updating a table and showing a summary
  • loading and hiding/showing an article
  • store a poll result and then displaying a result in a tooltip window
There is surprisingly little that is needed to add Ajax to a site:
  • Knowledge of some kind of Ajax framework (there are quite a few out there)
or
  • Javascript and the IFrame tag (if you want to do it yourself)
I would recommend to use an already existing Ajax framework as it usually handles browser incompatibility issues pretty nicely.

A comparison of some of the good ones out there can be found here - http://www.devx.com/AJAXRoundup/Article/33209

Sunday, 4 March 2007

Profound

That which we persist in doing becomes easier - not that the nature of the task has changed, but our ability to do has increased!

Saturday, 3 March 2007

Thoughtful Statements

I love this one from my very good friend Frederico:

Sniff, sniff...
what is that smell?


The smell of success :)

New Milestone Release

Aaaahhh, its a nice feeling directly after a milestone release. A milestone is like a heartbeat. You plan, live and evolve around it. We work so hard preparing for the release, the stress, the little features we agilitly include or exclude... very exciting to slowly see the whole application taking shape :)

This project has been a great success I think where I have been able to fully experiment with my ideas and principles around agile software development. I will write some more about my discoveries in some later posts but to summarize:
  • Deciding what to do and how to capture requirements
    • It all starts with an idea, you need to break it down, nothing is cast in stone
    • Prototype early and think RAD
  • Putting together a team
    • You must pick skilled people that can work well together
    • Pick people that you like and can trust!
    • Communication is key (natural, problem domain and pattern languages)
    • No synergy is like swimming in Tar!
    • There can be no substitute for skill and experience!
  • Drawing up the initial architecture
    • There cannot be a democracy here, to many architects is very destructive
    • The principle architecture can be found in numerous existing frameworks
    • Put metadata in the code and abstraction in the configuration
    • Be pragmatic
  • The software development process
    • Iterative and incremental
    • Usecases, stories or features? Doesn't matter, as long as you can break it down into chunks that can be understood, estimated and prioritized.
  • Planning a release
    • Never move a deadline, de-scope if you need to!
    • Announce the features to be demonstrated early. This makes the target clear!
    • Prioritize, not everything is important!
  • Developing the code
    • Coding standards are very important!
    • Don't let just anyone touch the code
    • Test driven development is key
    • Refactor the code often, strive for simplify and elegance
    • Reuse good ideas, best practises and principles, no need to copy&paste code then!
    • The code is the documentation and the unitests are the requirements
    • Document the intent, the idea or principle behind the code
  • Tools for collaboration and issue tracking
    • Issue trackers, wikis are key
    • Use whiteboards often
    • Don't send emails if you can walk up and talk directly with a team member
    • Make sure information is shared
  • How to demonstrate your software
    • At the end of a milestone, demo the initially announced features
    • Be swift, make sure every feature is demonstrated properly
    • Take time to write down all comments from stakeholders
    • Let members in the team take turns in demonstrating new features as this ensures that knowledge is shared evenly
  • In general
    • Be eager to learn something new every day
    • Be helpful and humble but make no mistake, be proud of your craft and skills!
    • Don't complain, do something about it, be pragmatic
    • If you break the build, you fix it!
    • Don't think X hours a week, think Y issues done/left.
    • Measure the velocity by ensuring that most issues are broken down evenly
On Monday it all starts again with release planning. We are now one milestone from the first candidate release. I don't expect us to release more than 2 release candidates at most.

Being so close to a release candidate I am now breaking down the milestone into smaller weekly point releases, one every Friday. The reason for this is so that we can test the codebase more frequently (as we don't have a testing team available) and also to allow for faster feedback from the stakeholders and still allow for a practical development cycle length.

Once all this is done, we will all chill out on a beach in Thailand drinking a MaiTai feeling absolutely in peace with the world...

Why?

Because we deserve it :)