.NET Software Development

Friday, September 26, 2008

Nothin but .Net (Day 5)

A little bit late, but here it is:

Some comments on the end of day 4
Most of us where able to follow the tasks until about 4:00am!
When I left the training room only Michel and Stefan stayed with JP to go code on.
(when reading the next lines, be aware of: JP didn't went to bed this night!)

The Last Day!
JP presented the results of his last coding hours from day 4:
A QueryBuilder providing a flunet interface to specify a query which later can be visited to create the corresponding SQL statement. Together with a data base gateway this query can executed to get the data from the SQL server.
data_rows = db_gateway.execute_for_rows(Query.from(Tables.Products.table_name)
.where(Tables.Products.DepartmentID).is_equal_to(department_id)
.and(Tables.Products.DisplayIndex).is_null());
Awesome, isn't it?

The Bootcamp
This morning JP challenged us in a completely new way: Extreme TDD
While he is committing one test (oh, we BDD'ers say Observation) after the other to the svn repository everybody had to make the current observation passing until the first one said "Checked In!". It was really really fast (and sometimes a little bit frustrating when being almost finished, but another one shouted: "Checked In!")!

Pair Programming

After lunch JP assigned tasks to the pairs:
  • Adding missing functionality
  • Setting up a TeamCity server for CI
  • Auto wiring container (Björn, I love your result!)
  • Code generation using Velocity engine
  • ...
It all went on until 2.00am, but even with some red bull the batteries where low! (more than 42h hours without sleep for JP - how could you bear up so long?)

Good to have more than 6GB of screencasts to

Thank You!
JP, it was really an honor and pleasure to be at your course to learn so many stuff.
God bless you and your family!

Also thanks to the attendees
("Basti", "Bavo", "Birgit", "Björn", "Björn",
"Jonas", "
Michel", "Niki", "Simon", "Stefan",
"Thorsten","Thorsten").ordered_by(attendees.first_name)
.ascending.by_intention(":-)");
for having such a good time with you to share experiences, impressions and more!
And to say it with Michel's words: I'm really going to miss you.

I'm still tired, but:


And (JP, sorry for using your motto) keep on to

Thursday, September 25, 2008

Nothin but .Net (Day 4)

Recapitulation of day 3

The fourth day started with good recapitulation of the container stuff of the day before.
Because we were awake it was easier to understand than yesterday evening.

Application startup

Later JP introduced to implement the aspect of application startup as a first class citizen and from my point of view it feels good.
It has to cover the actions of initialization the core service (logging), service layer (registering the service tasks in the container), front controller (registering all the web related stuff in the container: RouteTable, WebContextFactory, ServerViewEngine, CommandRegistry), routing (setting up the routing table)

JP did a lot of cleanup and refactoring to achieve better separation of concerns and focusing on readability of the code.

Introducing the domain layer
Thoughts only:
"Service layer asks the domain layer for getting domain data!"

Parts of the domain:
  • Repositories
  • Aggregates
  • Entities
  • Value Objects
  • Factories
  • Specifications
  • Services
Three ways to get objects from the domain layer:
  • Repositories
  • Aggregates
  • Entities

JP introduced the repository he want to use in our application and created the basics.
We started to do out own experience with it and JP completed the repositories.
(I promise to mention it here the last time: Everything top down and writing the tests first! Seeing and doing it all the time is like getting itintravenous.)
When he came to the part of creating the DTO's base on the domain objects, JP introduced the interfaces for mapping data from one type to another type. I have to say that I like it! (May be you want to have look at his blog entry for that mapping.)

ORM

I'm not sure, but it was to somewhere between 9.00pm and 10.00pm when JP said that he wants to do the ORM and querying the data from the database today!
He coded down most of the stuff in an incredible speed. (You may read "day 4" of Kyle Baley's blog about ndbn. I definatly can't express it better!)

Completing and wireing up all together!

Afterwards he challenged us to complete the whole stuff: Mapper implementations for entities to DTOs, DataRow to entities, criteria to query, wiring up, smoke test, ...

3:33am : JP's music (high beats - working like heart pacemaker for us) and some RedBull keeps us alive!!!

It's the first time i do it all in an agile way; it felt really cool.

Now it is nearly 4.00am and the stuff works! Awesome day! I love it!

Now it's really time to go to sleep, because at 8:30am will (or when able to) start last day (sadly).

Wednesday, September 24, 2008

Nothin but .Net (Day 3)

It was a great day again!
JP gave us some tasks to complete in pair programming, test driven, of course.
Beginning in the morning, coding until afternoon and getting really deep into top down development and writing tests first makes this day absolutely wealthy to identify my own deficits.
I learned a lot (thanks to Michel for the inspiring and entertaining pair programming)!

I have to admit that we did not completed all the tasks, but Stefan and Björn developed the best point JP used to complete and refactor.

After supper (unfortunately the surroundings of the hotel where we do the training has a big lack of good restaurants) JP introduced the concepts of a container to get rid of the poor man's dependency injection. In less than one hour he completed a whole container wrapper which shields an underlying real container framework. He also prepared unit tests for us to implement a simple own container.
We did it in a few minutes, but we both were not sure that using Activator.CreateInsance(interface) during the resolving is a good solution.
How would you do this?
JP solution was to have registration items which calls an anonymous delegate to create the requested object.
Later he extended it with lifetime support.

Watching at JP working, everything looks so easy and logical, but I'm sure that I cannot redo by myself with this ease. Indeed a fact of missing routine.

At the very end (11.40pm) JP kicked us with some more container stuff and we all are happy that he is recoding the whole stuff, so we can retrain ourself ;-)

Sleep well!

Nothin but .Net (Day 2)

Puh, day 2 is finished! Now it's about 11.00pm and I'm absolutely exhausted. But the day was great, too.
JP started by introducing the front controller pattern. The goal was to have a plain old ASP.NET (if it is allowed to say so, regarding that ASP.NET MVC is still preview?) running with the front controller in a kind of MVC.
He gave us a lot exercises doing TDD on this project, of course emphasizing to use a naming that expresses the behavior.
Doing this individually or doing it with pair programming, always fun!
During these we covered state based testing and interaction based testing. Using a helpful set of extensions supporting a very good human readable testcode, I can imagine that I will able to get into this code base even a year later. Allow me encourage you to have a look at JP's blog posts about the BDD style of unit test.
Specially for the interaction based testing JP came up with several extension methods for Rhino Mocks also focusing on getting easy readable tests.
JP explained why he is starting projects with "UI first". This is a good way to have get UI signed of by the customer, even the code behind isn't full functional, but the customer is able to confirm that this is the result he wants to get. Starting with the UI leads us to develop this application top down, step by step digging deeper into functionality, getting more and more tests that covers nearly all of out code.
We learned that using the poor man's dependency injection can be extremely helpful to combine the ability of unit testing and simple usage of a class. (But we are prepared that there will come more this week -> containers!)
I have to admit: I have some experience with generics, but implicitly JP teached me that I know nearly nothing about that. I need to learn more about generics, absolutely!
The whole training class is hanging together the whole day and it's absolutely cool to get into more discussion during breakfast, lunch and supper.
If you know JP, you know this slogan "Develop with passion!", but I'm sure "Teaching with passion" fits perfectly also!
Now it's nearly midnight, I have to go to bed immediately and please forgive any typos ;-)
May be more tomorrow! Sleep well!

Tuesday, September 23, 2008

Nothin but .Net (Day 1)

Nothin But .NET

May be you have read already: Jean-Paul Boodhoo is currently here in Germany giving his great Nothin but .NET training.
I am happy to join and to learn a lot of .Net stuff, come into discussion with JP and the other attendees.
The course is very intense, that means: Starting the day at 8.30 after breakfast, training and coding sessions the whole day until 10.00pm (or later)!
JP sent a lot of stuff for course preparation: A list of prerequisites (VS2008, Resharper, ...), a screencast explaining how to prepare and configure the machine and - and that's what I have never seen before with a training - some homework exercise to get into TDD. The exercise consists of a prepared unit test (of course, written in JP's BDD style) together with skeleton of a class to test. I was our job to complete the class to all the unit test running. This was really a cool preparation and i got appetite for more!

Day 1:
After a small introduction JP started with having a look at our exercise results and picks up one to refactor it more and more. The intense use of lambda expressions to build a fluent interface for searching and sorting signals: that will be a tough week! And, a lot of bloggers mentioned already, JP is fast, really fast in coding. I can't imagine where he stores all the keyboard shortcuts for VS, R#, GVIM, Vimperator, ...
We covered a lot of topics and can' summarize all, but there some of them I definately want to dig in more.
Here a small list of my coding highlights from day 1:
- Specification pattern
- Interface based programming
- Coding by intention
- Don't start with inheritance, refactor to inheritance
- Extension methods are also available for .Net 2.0

I will do my very best to continue blogging during this week! But forgive me if I fall asleep at the keyboard ;-)

Thursday, June 12, 2008

Do you know "Bear Programming"

If you are a software developer you are probably familiar with a situation like this:
You are working on some code, but it refuses to do what you want and you are going to become crazy! This is a point where you ask a colleague for help. Now, what often happens, during the explanation of your problem to your colleague: you see the solution by yourself!
Do you know this? (I'm sure you do!)

Then have a look at this post of Gojko Adzic and his thoughts about Kuniaki Igarashi's presentation on Omoiyari-Driven Development (ODD)!

I totally agree with him!

So let us convince our managers that one peace of our equipment has to be a

Friday, February 1, 2008

Unit Testing: What should I test?

I had some discussions with my colleagues about what to test in unit tests.

I have to admit that it was always theoretical, because we didn't have any real project experience with it. But we are migrating some VB6 stuff to .NET and therefore it is an important topic for us.
But the most emotional discussion was about: Should i test internals or only the public interface?

I would like to cite Derik Whittaker final statement in his comparison, because that's exactly my point of view: "At the end of the day this comes down to a personal/philosophical decision and both are better then the alternative....NO TESTS."
Powered By Blogger