CodeMash – Domain Driven Design

Time for the second afternoon session here at CodeMash.  This session is called Domain Driven Design and is being given by a gentleman by the name of Barry Hawkins.  This is the second presentation I’ve seen Barry give today, he’s a very dynamica and entertaining speaker, but still is very on point.

The presentation focused on the importance of modeling.  To distill this greatly models are a representation of the domain, the domain is the subject matter itself.  It is important to use ubiquitous language across a team made up of all people necessary to move project from conception to completion.  This means that subject matter experts and scenarios they provide feed the domain vocabulary, not pattern and practice leanings.

Domain models should start small and be validated by detailed reference scenarios.  Barry’s team uses nNuit or jUnit to create tests to in effect ‘model’ the reference scenarios so they can validate the model accurately reflects them.  The reference scenarios get increasingly complicated and are provided by domain subject matter experts.  Barry used an example from the shipping industry as an example.

Another importance concept was to entertain different models, don’t settle on the first solution you think of.  Use natural language to pseudo code out multiple modeling options to decide which is best for the context you’re in.  Don’t be afraid to throw out models if they don’t work, the first thing isn’t the best thing necessarily.

Barry works with Eric Evans who authored a book, Domain Driven Design, which the talk was based on.  Great overview of a very deep topic.  I’m looking forward to picking up the book and learning more.

CodeMash – Software Design and Testablity

It’s Thursday afternoon here now at CodeMash.  Had a nice lunch while listening to a presentation on Microsoft’s open source efforts given by Hank Janssen. Now I’m sitting in on my first afternoon session, Software Design and Testability, the presentation is being given by Jeremy Miller, a gentleman from Dovetail Software in Austin Texas.

Testability and Design …is about finding, removing and preventing defects….is about assiging and partitioning responsibilities in an application…corresponds well to traditionally good design ideas…..is facilitated by patterns.

Need to shift mindset, I don’t write code, I ship software….people should see their efforts in the context of the whole, testability promotes this.  Software isn’t designed for the efficiency and optimzation of the code itself, but for the software as a whole.   Good code is only important in that it enables us to delivery what the customer wants, where it does not do that it doesn’t really matter.  That being said it is really important since good code allows software to be changed and worked on by other developers more easily, allowing us to better deliver wanted features to our customers.

First Causes Of Good Design: Fast feedback, short iterations are important to good design (agile)……Orthogonality, good separation of concerns (persistence, ui) so changes can be kept to small parts of the system when made.  Changes will be needed when made only want to change one area of system to accommodate.  This allows you to change things more easily when you know more later in your project.   You will be wrong at times, this helps make things easier to change to accommodate this…………Reversibility, give customers the ability to change their mind………….Understandability, although smaller classes for testing that interact more may make things less understandable.

Writing Automated Tests:  Known Inputs and Measurable Outcomes.  State Based tests versus Interaction Based tests, state based tests check to see if state changes occurred appropriately, testing to see if something else was called appropriately are interaction based tests (mock objects).

What makes a good test?  Repeatable…..Run Fast…..Easy To Write….Easy To Understand, a good test tells you where and why it failed, not just that it failed.

Jeremy is pulling up an example of something he did early on that was not testable.  Showing us the actual code.  Example code is doing many things at once, hitting database and doing processing.  Code is impossible to test without setting up entire application.

You should isolate the ugly stuff, isolate external dependencies ie the database, active directory, remoting, chatty api’s, etc…..etc……  Jeremy gave an example from Jay Flowers, Expand The Creamy Center.   Jeremy is now walking through how to do this with the sample bad code he has up on the screen.   Refactoring code into state machine that is heart of the workflow, ugly stuff is pulled out and state machine is tested using mocks for the ugly stuff.

Coding from the bottom up is good idea.  Test small to begin with, then test big.  Don’t try and put everything together and then test, hard to find problems you find.  Build little things at a time and assemble them.  Jeremy is a big fan of Object Role Stereotypes and responsiblity driven design, this is in the context of introducing a controller into his refactoring of his example code.

Inversion of control discussion.  Should push not pull, if your class is directly accessing a config file or database it is very tightly coupled to these things and hard to test.  Push externally needed things into your classes so they aren’t coupled to these items.  Push don’t pull!  This also causes you to keep a short tail, can resuse code without needing a whole lot of other code to come with it.

The hour is up, a very good presentation I thought.  The push versus pull analogy really made a lot of sense a clarified why we’re doing a lot of the things we’re doing.

CodeMash – User Stories Closing The Agile Loop

Time for the second morning session here at CodeMash.  This session is called User Stories Closing the Agile Loop and is being given by a gentleman by the name of Barry Hawkins.

Barry says requirements churn is not a crisis.  This really hits home, it feels like it is, but it is also a reality.  Barry is now walking through the agile manifesto.  Creating working software over comprehensive documentation does not mean we don’t create any documentation.  It means we create high quality documentation that people actually want and use.

Barry’s reviewing the pieces of the manifesto and talking about his real world experiences and what they practically mean to him.  This is really interesting stuff.  Comparing estimation process with business in its usual way similar to a game of poker.  Points out contracts are made at beginning of project when we are as ignorant as we’ll ever be about the project, this may not be the optimal time to lock in absolutes.  An Agile approach would dictate a softer approach that involves collaborating and allowing for changes along the way as we learn more.

Underlying agile assumptions:  Motivated self-directed people make up the team.  Cross functional team, have everyone you need to move product from concept to launch.  Good teams have a QA person at all stages, not just at the end.  Teams have highly available domain experts.  A culture of testing.  A failure tolerant environment.  Value projects completed, not projects launched (context switching for developers can be time costly).

Most agile adoption is driven by development teams.  Usually it is not management that proposes development is done using an agile methodology.  This produces situation where development doing iterative approach while business is still providing phased waterfall analysis, use cases at best.  Hard to fit non iterative requirements/analysis process into iterative development process, very time costly to translate requirements.

What are user stories?  Barry recommends the book User Stories Applied for deeper understanding.  User Stories are place holders for interaction, not a substitute.   User Stories are much smaller than use cases, they focus on a small strip of functionality, they don’t dictate detailed requirements such as UI requirements.   User Story structure:  “As a ___ user, I can ____, so that _______”.  Structure defines who is going to do what and what benefit it will provide.  The “so that’ is the benefit statement and is very important.  Stories should follow Bill Wake‘s  INVEST acronym: Independent, Negotiable, Valuable, Estimatable, Small, and Testable.

But what about __________.   Business won’t cooperate: maybe business doesn’t like you, you say no to often.  Could it be that business has come to believe no will already be the answer.    Functional spec already written:  you can turn these into user stories.   Team is not co-located: wiki’s can help here.  no UI for code : just  becuase no UI doesn’t mean there aren’t users.

Well that’s that.  Very good presentation I thought.

CodeMash – Keynote

The keynote speaker at CodeMash this year was Mary Poppendieck.  Very interesting talk about what was called the LEAN software development methodology.  Approach was apparently based on lessons from Just It Time manufacturing learnings.  Basics involve eliminating waste by not doing things that don’t have value to your customer, always learn, build quality (TDD)  into the process at all levels, make decisions as late as possible and delivery quickly.

Specifically Mary focuse on five concepts, Purpose: everyone in the organizations should know why they’re doing what they’re doing at a meta sesnse.  Passion:  people should be passionate about the organiation.  Persistence:  hard work and practice, especially practice is necessary.  Pride: Cathedral builders versus stone cutters and Profit:  Organizations should make money but that shouldn’t be only goal.  Goal should not be to make as much money as possible, but to be profitable while servicing clients and employees.

CodeMash – Iteration 0

I’m back at CodeMash, and it’s Thursday morning.  Just left the keynote, more on that later.  Now sitting in first morning session, Iteration 0, a session on how to get prepared for an Agile project.  Presentation is being given by a gentleman by the name of Ken Sipe.

Goal, many organizations have problems getting started wtih Agile, this presentation is oriented on how to overcome these problems.  Ken is an old RUP guy, used to teach Rational courses, has a background doing XP programming, now a scrum master.

Review of different development process, first Waterfall.  Waterfall seems to be corporate default.  Iterative process is different in that provides for feedback.  Corporate environments have problems with an iterative process, why, lack of control of process can’t predicate the future with as much certainty as they’d like.  Corporate environments have trouble with communication.  Iterations force process to happen before last minute, akin to term paper being done the night before it’s due.  If have interim due dates, iterations, things go better, feedback is introduced earlier in the process.  Agile is an iterative approach.

How do you know what the right size is for an iteration?  Larger iterations mean less feedback, but iterations that are too small don’t allow enough time for anything to get done.  Generally most organizations are probably erroring on the side of having iterations that are too large.

Iterations create trust with business.  Business starts to realize you can respond to their needs because they see the results of their feedback sooner.  Business also is asked to give feedback more often, again building trust.  Also allows feedback about progress against plan early and reliably in project.

What agile is not, it’s not evolutionary based on iterative development, it does require documentation, it does require architecture, it is not cowboy development.

Pair programming, many organizations say they do agile but do not allow pair programming.  If you aren’t pairing you aren’t really doing agile.  Pairing is just in time code review. Should swap pairs regularly, disseminates information across team.

What is an iteration?  Opening meeting.  Standup meetings daily and a closing meeting.  Standup meetings need to be no more than 15 minutes and stand up meeting must actually happen daily.  Iteration size, change it around to find points of pain, fix pain points and go to iteration length that seems appropriate.  The more you remove yourself from actual agile practices the more risk you introduce into the project.

Who should attend an opening meeting and what’s it for?  Optimally an actual end user should be involved.  It is optimal to have an actual end user on the project full time.  Should have a BA, DBA’s, developers, architects and QA in the opening meeting.  Purpose of the opening meeting is to define the vision of the user for the iteration, and to agree on acceptance criteria.  Poorly defined acceptance criteria is a large reason for iteration failure.  Should have a second follow up opening meeting to break out an allocate assignments.

What is the closing meeting for?  Is iteration accepted by the user, define velocity of team.  Need to resolve bug level to velocity.  Is the team going too quickly to have a better looking velocity at the cost of quality?  What kind of bugs are coming out of QA?  Are we getting functional bugs?  Functional bugs should be caught in dev process in Agile.

Stand up meeting, the Pig Rules.  In a ham and egg breakfast the pig is fully committed, the chicked in simply involved.  Only pigs are allowed to talk in a standup meeting.

Pre-Iteration 0, collect user storied.  Need to estimate ROT, is project justified.  Build your team.  Create a release plan and iteration strategy.  Team needs to be prepared for transparency.  Pairing and code refactoring may happen to your code by someone else.  Very transparent process

Team Building Phases

  1. Forming – Team meets very friendly
  2. Storming – Team forms as get to know each other has some conflict
  3. Norming – Team becomes settled works well together
  4. Performing – Team hits its stride

User Story gathering.  Some projects have all the stories up front, some have enough to start and expect that others will be provided along the way.  Either approach requires a business analyst.

Feature Slip versus Time Slip.  In a RUP based approach you will slip dates to get features done if running late.  Agile will slip features as iterations are done when they are done.  Can extend agile projects and add iterations to handle feature slip.

Agile alignment with QA options.  One option:  Have BA and QA building test plans for next iteration while dev is working on current iteration.  QA executes test plan for previous iteration during current iteration.  Features are considered complete when dev has finished iterations.  QA bugs will be added to future iterations.  QA executes regression testing against iteration -2, while executing test plan against previous iteration and creating test plan for next iteration.  Only dev is working on current iteration.

Second Option: have dev work on many iterations before QA starts executing tests against first iteration.  Allows many things to change before QA gets involved, someone pointed out this seems very waterfall like, Ken agreed and said first approach is better.  Both approaches based on production level code coming from development iterations because of TDD and pairing.

Coming to the end of session, getting into QA now.  Someone asked for a definition of velocity, a fairly standard agile concept.  Discussion on point allocation to stories and iterations and such.  Question of team size, Ken indicated an 8 person team is very large, shouldn’t have bigger teams but more smaller teams or scrum of scrums.

Iteration 0 is heavily about automating everything possilbe before real iterations begin.  Why automate?  Predictablily, get frequent predictable feedack.  Have to setup Version control in iteration 0.  Build project should be setup in automated fashion so all things regarding release and such can be done with the push of button.  Setup build server to handle moves.  Setup build server to automate unit testing and code coverage.  Setup automated repoting for management that will be used in iterations.  Initial design concepts should be decided on in interation 0.  Are you using and MVC model for presentation, logging models.  Where it makes sense make these decisions in iteration 0.  Ken advises to run iteration 0 like any other iteration.  Have an opening meeting, stand up meetings and a closing meeting.  In iteration 0 the user is you and your team.