Monday, April 6, 2015

Core Frameworks Don’t Work (most of the time)


I work as a consultant, mostly for large software development organizations at public companies that maintain large systems that handle millions of transactions each day.  My typical engagement is at least 1 year, no longer than 2 years.  It’s long enough that I’m able to dig deep but it’s short enough that I get exposed to many different organizations.  This gives me a unique and informed perspective on how software development works at a fair number of .Net shops.  I’m kind of like Marlin Perkins, able to observe the natural behavior of cutting edge software development organizations in the wild.  

One interesting ritual that I’ve seen practiced over and over is rite of THE CORE FRAMEWORK.  Some organizations actually go as far at to call it THE FRAMEWORK.  Others are content to simply call it core.  Regardless of what you call it, it’s usually a terrible idea that will cripple the productivity of your organization.

A point of clarification

I want to be clear. This post is about company-wide core frameworks.  That’s a common framework that is used as the foundation for multiple applications across the company.  That is not the same as an application core library.

An application core library is usually just the business layer for a single application that can be shared across different assemblies at the application layer.  For example, the SquareHire core library is used for the SquareHire public website, the SquareHire ATS (webapp), the SquareHire admin app (another web app), the SquareHire processor, and the SquareHire webapi. All of these are different assemblies that share a common data and service backend.  Together they make up the SquareHire application so it makes sense that they would share a common SquareHire core library.

A company wide Core Framework is something different.  That’s when a company has multiple applications that do not share a common data and service backend.  They may have nothing to do with each other.  However, the company wants to standardize software architecture across the company so the decision is made to build every application on top of a common, company-wide Core Framework.  Often these Core Frameworks are named after the company, like AcmeInc.core.  These company-wide core frameworks force a common architecture and code base on apps that do NOT share a common data and service backend. These are the frameworks this post is about.

How does it happen?

A group of programmers build an application.  The application works, the company grows, and it hires more developers.  As time goes on the more features are added to the application by developers who really don’t understand the original designs. They just kind of bolt code on that works in the way they’re used to doing things.  The new code doesn’t follow the patterns established by the original designers, but it does accomplish the short term goal.  Besides, the new approach is probably better than the original design anyway.

More time goes on.  The company becomes even more successful which means the app is supporting more users.  It’s now maintained by a completely new group of programmers, nobody’s really sure who the original developers were.  Each new wave of developers implements features using what they feel are the best practices.  The new features hang off the original application like tumors.  Growths that are powered by the original organism, but refuse to cooperate with it.

Things go on this way. The company is now so successful that it is developing multiple applications, or maybe they’re acquired and merged with another organization and their software projects.  However it happens, the point is that we now have a situation where the organization has multiple teams maintaining multiple applications.  Each application has a different architecture and is becoming increasingly more difficult to maintain as new generations of programmers keep bolting stuff on that doesn’t work in the way the original app was designed.

This is the moment when somebody has the bright idea “You know what would make our software development efforts much more efficient and would make all of our applications work much better… if we standardized on a single perfect architecture and made everybody in the entire organization adopt it.  In fact, we should create a set of Core libraries, and then every new project will be built on top of them.”

The theory of company-wide Core

On the surface, a Core Framework makes a lot of sense.  There are some good arguments for standardizing and implementing a common framework across your organization.  Here’s a few of them.

1. New development should be faster/easier
New projects will be much easier to get off the ground. They won’t need to write plumbing code like persistence, they’ll get everything they need from the “Core”.

2. Managing development resources (people) should be easier
If you standardize it should be easier for developers to move between teams.  They’ll already be familiar with the architecture. 

3. The smartest guys can guide us
Since the “Core” will be designed by the architect (or architects) it will embody the best possible architecture for the organization and it will enforce a set of best practices that will be implemented by less capable programmers who might otherwise go astray. 

I may have overdone the sarcasm on that last one but the point is that creating a core really does seem like a good idea on paper.

The reality of company-wide Core

The theory sounds good, but the reality doesn’t work out that way.  Here’s some real world observations pulled from my time at real organizations that were in various stages of implementing Core libraries.  Keep in mind that the architects and developers at these organizations are some of the smartest that I’ve ever worked with.  The problem definitely was not a lack of skill or programming experience.

1. New development should be faster/easier
The Core may actually get the initial phase of a new project off the ground a bit quicker, but it doesn’t last.  Quickly developers find that the Core brings with it limitations as well as benefits. It’s not long until the developers of the new application are scheduling time with the architect and the Core team to try and figure out how Core can be changed to accommodate the needs of this new application.  Did you catch that?  Not only does core not meet the needs of the new app, the new application actually winds up driving changes to Core. This happens for every application that consumes it.  What’s really been created is a massive cross-application dependency.  Nothing brightens my day like pulling the latest build of core and discovering that my entire application is now broken because some other team decided that we needed a better way to manage transactions or the DI container or any of the other things that find their way into these core libraries. 

2. Managing development resources (people) should be easier
This benefit actually does happen to some extent. Different apps in the organization will be structured in a similar way so that it’s easier for developers to move between them.  Unfortunately this commonality comes with negative side effects.  

The worst effect is that software development becomes uniformly slow and difficult.  The Core is a cross application dependency that forces the decisions made by one team onto every other team in the organization.  This also means that when your team needs a change made to core, it’s not going to happen quickly.  You’re going to have to wait for buy in from the architects and other team leads.

I’ve also seen Core negatively effect organizations’ ability to hire. Core usually goes hand in hand with a dramatic increase in complexity.  I’ve heard managers express that it’s incredibly difficult to find programmers and once they do it takes 5 or 6 months for them to be productive because the app architecture is just so complex.  Does the Core have to be that complex? No, but for some reason it always is… which brings us to number 3.

3. The smartest guys can guide us
The core is indeed designed by the smartest programmers in the organization.  This has to be a good thing right?  Wrong.  There are two big problems here. 

First is the problem of misaligned incentives.  When a group of programmers is working together to ship a product, their incentives are all pretty much aligned.  They want to ship the product.  If the product doesn’t ship it’s a big problem for everyone.  When you take your smartest programmers and you pull them out of that team and tell them their priority is to build the core architecture that all other applications will be built on, you’ve just given them a different set of incentives.  You just told them that it’s not their job to ship product. Their job may be to create beautiful architecture or develop new techniques for modeling business domains, or researching new technologies, or to instruct developers who are shipping products on how they should be implementing the core.  The point is, incentives are no longer aligned.    

The second problem is a phenomenon that I’ve labeled Smart Guy Disease.  This is another thing I’ve seen repeated in multiple organizations.  The basic idea is that the worst mistakes that have the most negative impact on an organization are consistently made by the “smart” programmers not the “dumb” programmers.   If you want more detail, I wrote a whole post on it here


The company-wide core framework is an idea that seems like an obvious win to management and architects.  But be warned.  Here there be monsters.  I have never, not once, seen a company-wide architecture solve more problems than it solved.  I have seen two examples where company-wide frameworks had hugely negative impacts on their respective organizations.  So think twice before starting down that path. 

One alternative I would suggest is to maintain a base application code-base.  But instead of forcing every application to consume it and inherit from it (thus creating cross-application dependencies), just fork it when you create a new app.  That way you have a solid starting point, but you’re free to make changes without worrying about how those changes will affect other apps in your organization.

Sunday, January 11, 2015

You might be using TFS

If your dev computer has 500GB of disk space taken up by 237 branches of the same code even though 99% of the files in those branches are identical…  you might be using TFS.


If you spend 45 seconds watching a little spinning icon each time you rename a file… you might be using TFS.


If your supervisor requires that you log your time in 15 minute increments and track those increments against work items in your current sprint… you might be using TFS.


If the workflow for tracking a bug fix requires a simple 27 click process that includes setting values in 3 different status fields and manually reassigning the work item and still doesn’t map to your actual process… you might be using TFS.


If the most productive team in your company manages their sprints in Excel instead of the company standard ALM software – and you wish you were too… you might be using TFS.


If creating a new branch requires more than 10 seconds… you might be using TFS.


If you ARE NOT CONFUSED when you hear people say things like “It took me 5 minutes before I was able to switch to disconnected mode” or “I spent a full day trying to fix a corrupted workspace”… you might be using TFS.


If you’ve ever heard the phrase “Yeah it’s kind of inefficient and it has some rough spots and the constantly connected model is a pain, but it’s sooooo much better than Source Safe”… you might be using TFS.


If you’ve ever lost 2 days trying to fix history after a bad merge… you might be using TFS


If your company has ever sent all of the devs home because the source control server was down and nobody could work… you might be using TFS. 


I find it tragic that so many .Net teams use what I consider to be the “worst of breed” solution just because it’s made by Microsoft.  TFS is a cumbersome, poorly designed system that extracts a productivity tax on every developer, every day that they use it.  The constantly connected model alone is reason enough for me to never use this tool.  So why do people use it if it’s so bad? I think it comes down to 3 unfortunate facts of life:

1. SCM (Source Control Management) and ALM (Application Lifecycle Management) software is typically selected by managers, not by the developers who will need to use those systems.

2. Microsoft makes TFS.  It’s a safe choice.  Nobody is going to get fired for picking the solution made by Microsoft.

3. Most of the teams using TFS have either never used another SCM, or were previously using Microsoft Source Safe, the only SCM so horrible that it actually makes TFS look good by comparison.

So the next logical question is “Ok Mr. Complainer, if TFS is so bad what do you use instead?”

I’m glad you asked.  In my opinion there is only one choice, git. A git repository hosted on either Bitbucket (from Atlassian) or GitHub, and managed using  SourceTree (also from Atlassian) is such a gloriously simple and low friction solution that I’ve never found cause to use anything else.  If you find yourself in the position of picking an SCM, do yourself a favor and try the git/SourceTree/(GitHub or Bitbucket) solution first and see if it meets your needs.

ALM/sprint planning/bug tracking is another matter.  There are lots of SAAS apps that provide this functionality and I find all of them easier to use than TFS.  GitHub itself has some basic ALM functionality that will be good enough for most small teams.  There are also 3rd party SAAS apps that plugin to GitHub or Bitbucket to provide additional features.  Huboard is one such app that provides a Kanban board for your issues on GitHub.  The bottom line is try something simple and see if that works for you before moving on to a more complex solution like Jira or (shudder) TFS.

One last thing.  I know some people will read this and say “You’re totally out of touch, you can use git as your source control within TFS, get all the git advantages, and still get all the great TFS vertical integration.”  That might be true. I’ve never used TFS with git and I’ve never seen it used in any of the TFS shops that I’ve worked with. That’s worth noting. I’ve heard a lot of people talk about TFS with git, but I’ve never actually seen it implemented in the wild. So, it might be the land of milk and honey. It might fix every problem I’ve ever had with TFS. I doubt it, but it is possible. 

To conclude, I don’t have an informed answer to the TFS with git question because what I’m doing works great and I’m not willing to invest another iota of my precious time into the sinkhole of productivity that is TFS.   I think the great philosopher Samuel Jackson (Pitt) from Pulp Fiction said it best. “Sewer rat might taste like pumpkin pie, but I wouldn’t know, because I wouldn’t eat the filthy mother-scratcher.”