Monday, September 17, 2012

Importance of a Complete Vertical Slice

What's a vertical slice?  Think of a delicious layered cake.  Say we have 3 layers and you slice a piece.  A thin slice of each layer produces one solid piece.  Think of the cake layers as architectural pieces: database layer, services layer, the user interface layer, etc..  Each of these layers are as important as the last to get to the final goal: a solid, functional piece of software.

In any project, especially a green field project, building in vertical slices is critical to success.  A solid vertical slice proves two things: 
1.) Proven architecture
2.) Produces a complete, functional, shippable piece of working software that works from end to end.

The risk of not having a Vertical Slice

Not having a vertical slice presents an unproven architecture and much unneeded risk.  Not having a vertical slice poses the possibility that the entire database is built with no user interface or service layer, or the opposite, a great looking UI and service layer but the data model is a mess and not scalable.  Either way, much rework is involved for further scalability.  Having a proven architecture by developing in vertical slices allows you the ability to continue working and not end up with a fantastic UI but a non-scalable database model.

Don't forget ETL (Extract Transform Load)

When developing a vertical slice, consider the notion of having to importing existing data.  Does this change the implementation?  Can the data model be simplified or restructured to suite an ETL more effectively?  While I'm not saying to develop an application for the sole purpose of an ETL, the ETL needs to be considered in the vertical slice.

But individuals know one layer...

WRONG!  One characteristic of a good agile team are generalized specialists.  Individuals who may specialize in one layer or area but also able to build up the layers.  Ideally, team members' skills should complement each other's in order to create an effective synergy.  Have team members pair often to help facility the synergy and allow team members to grow from one another.  This type of cross functional team mentality allows vertical slices to be built effectively.  Thus coming to value added software quicker.

Identifying the vertical slice and developing a story via a vertical slice rather than by architectural layers proves the architecture and produces a piece of quality, shippable software faster.

Monday, July 9, 2012

URGENT vs. IMPORTANT

We've all had them, clients who have a mile long feature list and want everything now! While the enthusiasm and excitement may be encouraging, it's time to get real.  Realistically, every feature is not going to get developed now, it's just not possible.  Prioritization needs to happen to determine what the team should work on first.  How do you prioritize?  How do you go from a mile long list of features to a much leaner, prioritized backlog that a team can burn through?  One way is by having the urgent vs. important discussion.

The Urgent vs. Important Chart

uvi

This graph can help visualize and put in perspective what is urgent vs. what is important and take us one step closer to a groomed, prioritize backlog.

Here are a couple examples:
-Broken arm
-Need eventual surgery

How would you rate these, urgent or important?

A broken arm is clearly both high on the urgent and important scale.  This requires immediate attention whereas having the need for eventual surgery is very important, however, it's not as urgent as a broken arm.

Let's equate this to the software world:
-Fatal bug that needs fixed
-Adding Authentication

Where would you rate these on an urgent vs. importance chart?  Clients getting a big visible bug is clearly both urgent and important while a feature to include authentication is very important but not nearly as urgent. 

This visual aid helps put in perspective that everything is not as urgent and important as one may originally think.Take a step back and take a hard look at what is urgent vs. what is important to help prioritize the backlog to ensure the team is working on the most important and the most urgent task at any given time.  A well groomed, prioritized backlog is vital to adding value and getting feedback as quickly as possible.

Monday, March 19, 2012

Connect Rails 3.1 From Mac OS X to SQL Server


I’m currently using Ruby on Rails 3.1 and am developing on a Mac.  A requirement was to use MS SQL Server as the database.  There are a couple hoops to jump through to get RoR to work with SQL Server.  Fortunately, the Tiny TDS gem made this a breeze to setup without having to go through the headache of unixodbc/iodbc/rubyodbc configuration.

Here’s the following steps to accomplish:

1.  Install FreeTDS using brew

brew install freetds

2.  Add the following gems to the Gemfile

  gem 'activerecord-sqlserver-adapter'
  gem 'tiny_tds'

3.  Run bundle install to update the gems

4.  Modify the database.yml file to the following:

development:
    adapter: sqlserver
    mode: dblib
    dataserver:   <IP Address>\<Instance Name>
    database: database_name
    username: sql_user
    password: sql_password

Things of note:


1.  Additional ways to configure the connection string can be found here

2.  If you’re using a named instance of SQL, it’s not going to use the default 1433 port.  Through SQL Management Studio, you can run the following command to find out what port your instance is running on:

use master
go
xp_readerrorlog

Troubleshooting


If this doesn’t initially work, there are a couple potential points of failure.  Here are some of the debugging techniques I used to verify I could connect to SQL Server without rails:

1.  Verify that you can make a connection to SQL Server.  From terminal prompt, do the following:

telnet <IP Address> <port>

If you connect, you'll receive the following:

Trying 192.168.31.128...
Connected to 192.168.31.128.
Escape character is '^]'.


2.  Once you’ve verified that you can connect using telnet, second step is to verify that you can connect via FreeTDS.  From the terminal prompt, do the following:

tSQL –H <IP Address> –p <Port> –U sa -P password

If connected properly, you should see the following prompt:
locale is "en_US.UTF-8"
locale charset is "UTF-8"
using default charset "UTF-8"
1>

At this point, this is a SQL editor so you could use SQL syntax to extract queries.  For our purposes, we just want to verify that we can connect this way. 

Type exit to exit out of application

3.  I also ran into an issue when connecting using Rails I received the following error “Adaptive Server timeout”.  I resolved this by doing another bundle install and it has worked after that.

Happy Developing!

Saturday, March 3, 2012

SpecFlow 101

SpecFlow is a Behavior Driven Development (BDD) tool for .NET.  SpecFlow has brought the Gherkin language to .NET and to Visual Studio!  This post will set you up quickly with SpecFlow with a simple example.  

Install

Download the latest SpecFlow install

New Visual Studio Templates

image

Once installed, there are three new Visual Studio templates that will be installed including the

  • Event Definition – this template is to be used for more of global hooks such as
  • Feature – template to write out the feature with scenarios in Gherkin language
  • Steps Definition – template to store the steps from the feature file that will execute the code and do assertions

Our Feature Example

For this example, we’ll use the Roman Numeral kata.  While this is a relatively simple kata, the purpose is to help navigate through SpecFlow.  So, let's begin:

1.  Create a new project and create a SpecFlow Feature File:

image

2.  Create a SpecFlow Step Definition File

The Step Definition template has code with sample steps in the class.  Delete everything inside the class but not the class itself.

3.  Generating Steps from Feature file

There are a couple of different ways to generate steps once a scenario is given.

  • Step by Step – with your cursor over a scenario step, press F12.  image

SpecFlow will offer to put the step binding skeleton in your clipboard and then it can be easily pasted into your steps definition file.  Note that if the step already exists, Specflow will navigate you to the step definition automatically, just like F12 does with “GoTo Definition”.

This is useful when you’re creating a new feature and want to take one step at a time versus having numerous pending steps.  I find this useful when you want to take things one at a time.

  • Bulk Create

Using TestDriven.Net right click on the feature designer file (extension of .feature.cs) click “Run Test(s)”.  For each scenario, SpecFlow will create a task that contains a StepsDefinition class.  This class can be copied and pasted into the steps definition file.   It should look like the following:

image

Observations:

  • With each generated step, the result will be Pending
  • One class per scenario.  When generating steps, SpecFlow will generate one steps definition class that is in the feature file if none exists.  There could exist the same step in multiple scenarios, neither of which have been generated yet.  When pasting in the generated steps, you’ll get compile errors telling you of duplicate steps.  Delete the duplicate steps and you’re golden.
  • If two of the same steps exists and you manually change the method name but leave the regex decorator the same, there will be a runtime error noting ambiguous steps.
  • If attempting to navigate to a step from a feature file with multiple regex step definitions matching, SpecFlow will throw a dialog box up stating ambiguous steps and will navigate to the first one.

Developing Code to Make The Test Pass

By default, SpecFlow is setup to use NUnit.  You can configure SpecFlow to use MSTest, if so desired.  Generate the steps with the correct xUnit assertion statements to make the tests pass for each step. 

Running Tests

Running Tests are very similar to generating the steps.  Once the steps are generated and beautiful code is written to get the tests to pass, right click on the feature designer file and click “Run Test(s)”.  If steps within a scenario are still pending, the following message will be displayed:

image

Hopefully this gets you familiar with SpecFlow and some of the advantages of this tool being integrated into Visual Studio.  Happy trails with your SpecFlow journey!

Sunday, November 13, 2011

My First Week on a MacBook Pro

I’ll admit it, I’ve been a Microsoft fan boy for all my life.  I’ve only owned Microsoft products (even a Zune!), never really gone outside my comfort zone and experienced the “other side”.  For the last week, I’ve been working on a MacBook Pro and, must admit, am really enjoying the experience.  From my employer, I had the option between a PC and a Mac laptop.  I chose a Mac for a couple for a couple of reasons:  1.) I wanted to broaden my OS horizons and learn something new and 2.) The option of potentially doing Mac iOS development is now an option.  I can create a Windows VM (which I have) on a Mac but the other way (creating a Mac VM on a Windows machine) doesn’t work out so well.  So, with that, here’s been my first experiences with the Mac and why I’m enjoying it.

Setup

Setup was a breeze.  Within a few minutes I was up and running with OS X Lion.  Once loaded, I was excited to get started so, off to the App Store I went.  The first thing you’ll want to do is to sign up for a free App Store ID.  This will enable you to download things from the App Store, both free and paid.  There are many great Apps in the App Store to get you started!  I’ve also notice that installing applications are easy, it’s literally a drag and drop into the Applications folder.  It takes away all the “Next, Next, Next” that a Windows setup has a user to do.

Software

  • VMWare Fusion (paid) - this is a great VM product for Mac.  Since I still do the majority of my development in .NET, I needed a Windows machine to develop in.  I had an option of Boot Camp (basically dual booting) into Windows or creating a VM.  I chose a VM for a variety reasons.  Creating a Windows 7 64 bit VM with Fusion was super easy.  It first asked to give it a user name and password and it was off.  I didn’t need to enter any other piece of configuration data.  The VM has been running smoothly all week.  Full disclosure:  I did upgrade the RAM to 8GB and have dedicated 5.5GB or RAM to my VM.
  • Alfred (free in the app store) - this is a quick productive tool designed to keep your hands on the keyboard.  With Alt + Space bar, we can launch Alfred and have it search what we are looking for whether it be locking your system to searching for something locally or on the internet, Alfred can help.
  • Twitter (free from app store) - the Twitter app for the Mac is fairly impressive.  It has a time line bar and everything that Twitter has to offer in a good layout and it’s easy to use.

 

Developer Tools

  • XCode - this is the IDE of choice for Apple development.  While I did experience some serious lag in downloading this application, once up and running it does install easy.
  • HomeBrew - package management tool

Blogging Tools

For me, I find it best when I write a blog to initially write in a “distraction free” writing zone.  That is, an application that is full screen, I can’t see any notifications nor icons that tempt me to get distracted.  Often I’m ADD and just want to click on the next shiny thing so a good distraction free writing tool helps me immensely in writing!  I was looking for a good one for a Mac and found two free ones and haven’t made up my mind which I enjoy more:
  • FocusWriter - I am admittedly writing this blog post in this tool.  I like the fact that you can create and Import/Export Themes.  I am a big fan of a high contrast theme so the first thing I done was created a “Retro” theme with a black background, black foreground, and green text.  Back to the good ole green screen it is!  FocusWriter has a Timer that will go off after set number of minutes.  This is useful if you are using a Pomodoro technique and it also helps keep me focused for a set number of minutes.
  • OmniWriter - this is another great distraction free writing tool.  This gathers more senses than just your sight.  Omniwriter envelopes you in a zen like environment complete with a soothing background and writing space and playing zen like music.  It definitely puts you in a much more relaxed state to allow your ideas to flow freely.

Key Observations

I’ve consistently heard that Apple is great at improving things and that “it just works”.  I have found this to be true in the different accents they put on their product.  Some things I noticed are:

Power Brick

First off, it’s a relatively small power brick that you can easily pack away.  There are small, yet useful improvements such as cable management that allows you to clip the cord to itself not to mention the magnetic plug that plugs right into the laptop.  The little adapter where you can plug the power brick directly into the wall or attach a longer power cord to the power brick for more cord length.  Typically I just use the power brick and not the longer power cord as this is easier to pack away in a bag.

Spaces

Having this concept of multiple Spaces I found very useful.  With a 3 finger swipe, I can just swipe between spaces.  This is useful to help organize the applications I’m in.  I typically use this by having my Windows VM up in a space and having other applications that are native to Mac in another space.  This allows me to switch and organize my spaces easily without minimizing/maximizing a bunch of windows.

TrackPad

While I’m mostly a keyboard guy, I was amazed at all the Apple TrackPad can do.  This is much more sophisticated than the TouchPads I’ve used on a Windows machine.  With the TrackPad you can do a three finger swipe to move between workspaces or a two finger click to bring up a context menu or just swipe from side to side in your browser to go between web pages or just do a two finger swipe or down instead of scrolling.  Apple has really made use of the TrackPad and has brought it up to an entirely different level. 

Backlit Keyboard

To be honest, I never thought I’d use a backlit keyboard.  I thought, what’s the use.  I have found a use!  In our Team Space, we enjoy the room dimly light.  It’s easier on the eyes than all the bright halogens.  Since it’s dimly lit, the backlit keyboard provides just enough soft light to make it an enjoyable experience.
Display The display is fantastic!  I got the 15” glossy screen and am enjoying the experience.  It has a nice, sharp, high resolution screen that is much crisper than the ones I have seen on Windows hardware.


Wrap Up

There are many other aspects I’m enjoying but those are my top 5, not in any particular order.  My first week with a MacBook Pro and I’m really enjoying “the other side”.  The broadening of my horizon has proved useful and would encourage PC users to try out the Mac.  I am enjoying the small footprint, both in size and weight that the MacBook Pro has to offer.  There are some “oddities” with keyboard shortcuts such as Command + C to Copy instead of the good ole Windows Ctrl + C to Copy but am learning everyday!  I’m anxious to continue learning new things about the Mac whether it be hardware or software in the coming days.


What other tips/tricks and/or apps do you have that you find useful (free or otherwise?)

Thursday, June 23, 2011

Scrum Outside of Software Development

I shared the Scrum methodologies to a teacher friend of mine the other day and focused on the Daily Stand Up.  Explaining that this meeting should be short (time block it to 60 seconds/person if need be), yet informative and having everyone answer the following 3 questions:

-What did you do yesterday?
-What are you doing today?
-What roadblocks do you have?

He had an "ah ha" moment and went on to explain how many communication issues this would solve and how much more efficient they could be working if they just practiced this one facet of Scrum.  They plan to implement the daily stand up starting with next year's school year.

At the core, Scrum is about delivering value to customers.  Isn't this what we do on a daily basis?  Professionally, we need to deliver value to our clients; personally, we need to deliver value to our families, friends or ourselves.

-If you're a developer, the value is delivering quality software to your customer.
-If you're a sales person, the value is accurately selling a product to potential customers.
-If you're an author, the value is creating a solid piece of work to your publisher.
-If you're a student, you need to deliver quality homework to the teacher/professor.

I heard of a story of a stay at home mother using a Kanban board (same as Scrum but differs where Scrum has Sprints, Kanban is a continuous workflow) to help manage her tasks throughout the day.  She developed swim lanes and put post its up as her action items and watch them move through the process until they were done.  It was something big and visible and she felt a sense of accomplishment and accountability while watching post its move across the board.  Of course, since the work was "laid out" she could give some of those post its to her spouse to get done.  Maybe she had a swim lane dedicated to her spouse (aka the "Honey Do" list), I'm not sure.

This got me thinking, Scrum is a framework and really can be applied to about anything.  While some would argue just because you could, should you?  While that's a topic for another discussion, the Scrum framework is very versatile.  While Scrum has gained traction particularly with Software Development, it doesn't end there.  Scrum can be applied to a wide array of projects, both personally and professionally.

Let’s take a look at the Scrum framework.  Here’s a graphical representation of it:

scrumframework

We can practically apply these concepts outside of software development.  I’ll use a Sales Person and an Author as two examples through the process.  How?  Think of each stage in the following manner:

1.  Vision – this step is not shown but this step is your final goal; what do you want to accomplish.

  • Sales Person – this could be a territory to cover, preparing for a presentation, any type of goal(s) you need to meet.
  • Author – this is the book or piece of work that you want to create.
  • Coach – to win a game

2.  Product Backlog – this is your high level to do list, the planned work.  Questions like how do you obtain the vision or the goal you want to meet?  Some examples could be:

  • Sales Person – high level list (by company, territory, etc.) of cold calls, follow up calls and/or visits you need to make with customers or potential customers.
  • Author – this could be the chapter titles or chapter ideas for the book
  • Coach – determining the high level, measurable areas of where the team needs to improve in order to win

3.  Sprint Backlog – this is a more detailed account of work to be done.  Break down the high level product backlog into manageable tasks that can be accomplished within a Sprint (2-4 weeks or whatever that time frame may be).  If something unexpected comes up (aka life!) that needs immediate attention, add it to your Sprint Backlog, and consider the additional amount of work it will take and if anything in your current Sprint can be pushed off to the next one.

  • Sales Person – specific call list of who to call or places to visit
  • Author – taking a chapter and determining sub topics, developing a chapter outline
  • Coach – specific activities, exercises, drills for specific player or players to execute

4. Daily Scrum Meeting – the idea of a small feedback loop for your team.  If you are a team of one, this may be reflecting/reviewing for yourself to get yourself re-aligned with the goals such as an author or Sales Person.

  • Coach – gathering the team around, getting re-aligned with the goals

5. Potentially Shippable Product Increment – think of this as your potential deliverable to your client.  This does not necessarily mean that this will be delivered to the client but that this unit of work is done, completed, and “production ready”.

  • Sales Person – finish a specific block of calls or visits of customers
  • Author – finishing a complete chapter and delivering it to the publisher
  • Coach – having the team reach certain goals incrementally and being able to execute to win the next game!

Scrum has a wide variety of applications other than just for software development.  While I’ve only given a few simple examples, I hope it aided in broadening your thinking regarding the application of using Scrum and how it can apply to different areas.

What other areas of life or activities have you practiced Scrum in?

Additional Resources:

Monday, May 2, 2011

Installing and Configuring Cruise Control .NET

Cruise Control .NET serves as a good Continuous Integration (C.I.) Server.  CCNet works with many applications and is relatively quick and easy to setup.  CCNet is primarily configured using XML.

This tutorial will outline how to install, setup, and configure a CCNet project using MSBuild. I’m installing this on a Windows 7 SP 1 instance with IIS 7 installed and CruiseControl.NET v 1.6.

  1. Download Cruise Control .NET
  2. Accept all the defaults for installation

Post Installation

Once installation is complete, do the following:

  1. Verify that the “ccnet” virtual application exists in IIS
    1. If it doesn’t create a Virtual Application underneath the Default Web Site and point it to C:\Program Files\CruiseControl.NET\webdashboard
  2. Give the “Network Service” Account both “Modify” and “Read & Execute” rights to the following folder: “C:\Program Files\CruiseControl.NET\webdashboard\packages”
    1. Note: Not doing this will give you an Access Denied error message when attempting to install packages
  3. Populate the Administrator’s password
    1. Open the dashboard.config file (C:\Program Files\CruiseControl.NET\webdashboard)
    2. Look for the following XML snippet: <administrationPlugin password="" />
    3. Populate the password string with your admin password. The password does not have any limitations other than it can’t be blank.
  1. By default, the CruiseControl.NET windows service is not started. Start it.

Once these steps are complete, you can browse to http://localhost/ccnet and should see the following screen:

clip_image002

 

Installing Packages:

  1. Click on the “Administer Dashboard” link
  2. Enter the Admin password you entered in the dashboard.config file
  3. The list of available packages to install will be on the right hand side.

Configuring of CruiseControl.Net

The project configurations and the build tasks are all configured in the ccnet.config file (C:\Program Files\CruiseControl.NET\server)

*Note that when changing this file, you need to restart the CruiseControl.NET service

Here’s an example of building one solution using MSBuild and running automated tests after the build using MSTest. (Thanks to Ben Hall for the sample file)

<cruisecontrol>
  <project name="HelloWorld">
    <artifactDirectory>C:\CCNet\HelloWorld\Artifacts</artifactDirectory>
    <tasks>
      <msbuild>
        <executable> C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe</executable>
        <workingDirectory>E:\CCNet\HelloWorld\Build\src\</workingDirectory>
        <projectFile>HelloWorld.sln</projectFile>
        <buildArgs>/noconsolelogger /p:Configuration=Debug</buildArgs>
        <logger>C:\Program Files\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MSBuild.dll</logger>
        <timeout>900</timeout>
      </msbuild>
    </tasks>
    <publishers>
      <xmllogger logDir="C:\CCNet\HelloWorld\Logs" />
    </publishers>
     <modificationDelaySeconds>10</modificationDelaySeconds>
  </project>
</cruisecontrol>

Additional Resources