Posts
58
Comments
103
Trackbacks
10
August 2007 Entries
The Pervasiveness of xGeneration

I was just thinking about just how much xGeneration (code generation, database generation, artifact generation) has filtered into software development.  I tried to throw a few categories together (based on Input), but I'm sure they aren't complete by a long-shot.  There's some overlap in there as well.

Reflective/Runtime Generators- Generators which work at runtime or just before/just after compile time

  • System.Reflection.Emit
  • Castle.DynamicProxy
  • SubSonic
  • Mock Object Frameworks
  • Runtime Aspect Frameworks
  • ASMX Webservices

Inferred Usage Generators- Generators which check context in order to allow us to create code more easily

  • ReSharper- the ability to generate code from the inferred context in Test-First development
  • Intellisense- the ability to finish our thoughts based on the current snapshot of our application and libraries
  • GhostDoc- the ability to produce a semblance of documentation from a method name and parameters

Artifact-Driven Generators- Generators which can take an artifact and produce something from it

  • CodeSmith- the ability to generate nearly anything from a template and an optional set of variables
  • Webservice Clients- the ability to produce a client proxy from metadata (WSDL, MEX, etc)
  • NHibernate- the ability to generate a database schema from a mapped object model
  • RhinoCommons- the ability to produce a fluent interface for database querying from a mapped object model
  • Model Driven Architecture

Visual Generators- Generators which work through some visual process

  • Visio
  • WinForms
  • WebForms
  • RAD (drag and drop)
  • SQL Enterprise Manager

It's interesting in that you can find a combination of tools to fit nearly any preferred style of development--any random combination of design artifact, application design, and relational design in any given sequence.

Looking a bit deeper, you might wonder what the difference is between interpretation and generation.  I might suggest interpretation is the initial step of generation.  The "compilation" of C# to MSIL and the runtime JIT process are other examples.

[Update: I think we need to build more Inferred Usage Generators.]

posted @ Thursday, August 30, 2007 11:04 PM | Feedback (0)
Who will champion the health of the business?

Let me tell you a fictitious story.  Ok, so it's not fictitious, but I swear I've never seen it happen where *I* work.

The salesmen are pushing customers hard.  Sell. Sell. Sell.  Gotta make that comission and feed the kids!

What did you say?  If we just customize the Worbler you will sign? SOLD!!

At some random point in time down the road, a business analyst sees the contract.

Ah!  To customize the worbler, we will need to integrate these two systems.

The Business Analyst writes up the requirements and calls the two Solution Architects.

You guys need to integrate to make this customized Worbler work.  Go do it.  Here are the requirements.

The two solution architects argue for a while.  One is closely aligned to database work.  He wants to integrate the two solutions at the database.  The other has most of his logic pulled out into a set of cohesive webservices.  He wants to integrate using Xml and Webservices.

They bicker for quite a while until one caves in--which one isn't really important.  They quickly make the arrangement and pass the requirements and design off to their team to implement.

What's wrong with the above scenario?

No one is there to champion the long-term health of the enterprise.  We have four stakeholders involved:

  • The Customer wants his functionality (as of yesterday).
  • The Business Analyst wants his requirements met and the project completed.
  • Each of the 2 Solution Architect wants his preferred method of integration (database vs webservices) used.

You'll notice that no one is there to champion the long-term cause of the business.

Why does it matter?

In our fictitious example above, the enterprise had 20 systems.  The same scenario played out over and over again during a multi-year period.  The solution architects designed the best solution they knew to integrate each time the requirements came up.

Guess what?  That company just paid for 190 integration projects!!

Since no one was there to watch out for the interests of the business, each project implemented a point-to-point integration project.  They did the easiest and cheapest thing 190 times and spent a crapload of shareholder money in the process.

You might wonder where I got the 190 figure from.  It comes from a little math formula which tells us the number of connections between nodes in a system, (n^2 - n) / 2.  For only 3 systems, there are only 3 lines of communication.  For 10 systems, there are 45 lines of communication.  For 20 systems, there are 190 lines of communication.

The Lesson

When dealing with boundaries between systems, you need someone to champion for the enterprise.  It needs to be someone who understands the long-term implications of architecture, and it needs to be someone who doesn't already have a horse in the race.   This is the role of an Enterprise Architect.

posted @ Tuesday, August 21, 2007 7:25 PM | Feedback (1)
Maintainability - Table of Contents

Introduction

This is going to be my first attempt at Table of Contents Driven Writing.  In the spirit of Test-Driven Development, it will be a living, breathing index to a collection of thoughts which I hope to write over the next couple of weeks (which will make my TOC pass).  As such, it's also up for refactoring at any time.  Mostly, it's an easy way for me to organize my thoughts and give more direction to where I'm taking my blog posts.  Feedback is welcome.

Context

I want to look at maintainability a bit deeper.  To put this stuff into context, we are talking about application design.  I also want to rule out the possibility that our application is in a family of products (think "editions" of visual studio).  Those impose additional forces on our design and given that I've never worked on one, they are uncommon in my personal experience.

In maintainable application design, there are four things which are inextricably linked.  I'm going to use these are the main parts, with a set of posts on material related to each.

Table of Contents

  • Variance
    • Problem Space
    • Problem Space Variance
    • Solution Space
    • Solution Space Variance
    • Overlapping Problem and Solution Space Variance during Solution Design
  • Robustness
    • Design Robustness as a Measurement of Overlapping Problem/Solution Space Variance
    • Cohesion and Granularity and their effects on Variance and Robustness
    • Loose Coupling and Robustness
  • Reusability
    • Reusability as a Side Effect of High Robustness
    • Reusability of Code
    • Reusability of Logic
    • Granularity and Reuse
  • Maintainability
    • Maintainability and Sustainable Development
    • Reusability is the icing.  Maintainability is the cake.
    • Comparison with Principles of Object-Oriented Design
posted @ Sunday, August 19, 2007 11:51 PM | Feedback (1)
Design and Maintainability

In my last post, we compared the developer in an unmaintainable project to a lobster in a slowly heating pot.  Fortunately for us, unlike the lobster, we know that maintainability comes through good design.  But what is good design?  Can we learn good design by experience?  If the lobster had multiple lives, would he know next time that he was about to die?  What if we doubled the time we took to raise the temperature of the water?  Would he learn the fourth or fifth time?  Maybe.  Maybe not.

My point is this.  Good design is extremely hard to learn by experience alone.  The lobster may learn that a 30 degree jump in temperature is a *bad thing*, but it's the slow warming that ultimately gets him every time.  Much like the lobster, we may learn to look for the obvious things by experience, but learning what really bad design looks like might only give you the gut instinct to recognize good design.  I recognize a good movie or a good poem when I find one, but I couldn't create a good one.  Recognizing quality work and performing it are different thresholds of understanding.

This leads us to our next question.  What is good design?  Several "principles of good design" may pop into your head.  If you were no longer in the language or paradigm they were designed for (say, OOP), would you know good design?  Or would you be back to hoping the water doesn't start getting too warm?  The principles may give us a rough guide to producing good design, but who creates the guides when something new and completely different emerges?  Are the design principles of object-orientation applicable to erlang, ruby, and python?  If not, would it be safe to say that there is a better underlying definition of good design?  Maybe it's something deeper.  Maybe it's closer to the truth.

So again, I ask you dear reader, what is good design?  If we are to produce it, we should at least be able to define it.  If c# goes the way of the functional languages, will you know how to recognize and produce good design?  In terms of SOA and messaging, what comprises good message design?  Does that differ from good object-oriented design?

posted @ Wednesday, August 15, 2007 7:05 PM | Feedback (4)
Maintainability and the Lobster

I would like to pose a rhetorical question to you.

When does a system become unmaintainable?

Regardless of the way the system is built (ie..techniques, tools, frameworks, languages, processes, etc) they are always maintainable at the beginning.  If the application is a total of 300 lines of code, no one cares how those 300 lines of code were written.  In a worst case scenario, I can rewrite the entire application without missing a deadline.  I'd say a 300 line procedural program is maintainable if nothing else than because of its small size.

So there we are with a 300 line program.  We add an additional 50 lines of code for the next feature that our project stakeholder is requesting.  The feature after that is a bit bigger and requires an additional 200 lines of code.  We continue to incrementally grow the system as requested.

Assuming that the code in the example above is written in an unmaintainable way, at what point do we stop and realize that our system has become unmaintainable?

Could it be that the developer on the project never realizes that the system is unmaintainable, much like a lobster in a slowly heating pot.  The lobster has no idea what's coming. 

Slowly over time, much like the lobster, the team slowly finds itself grinding its wheels.  Productivity has not decreased.  They are probably starting to work overtime even.  Costs are starting to very slowly spiral in terms of labor per feature.  Bugs might be incrementally getting worse.  The team, however, hasn't noticed any drastic change in the project or the way they work. 

In one scenario, management eventually cancels the project or a rewrite is undertaken.  This is the death of the lobster.

In another scenario, management decides that even though the project is quite expensive, team morale may be low, and team member turnover is great, the costs justify the end result.  This is equivalent to leaving the lobster at 5 degrees below the death mark.  He will still die eventually.  It's just going to be very slow and painful.  Companies, like development projects, go through cycles.  The project may just have to wait until the company enters a cost-cutting phase before ultimately meeting its untimely demise.

If you are a professional developer, you are the lobster, and you are in a pot of water.  How do you know what temperature the water is?  Is it getting warmer, cooler, or staying the same?  If the temperature is staying the same, how do you know you aren't simmering just below the death mark?

posted @ Wednesday, August 15, 2007 6:23 PM | Feedback (2)
IASA Nashville Kickoff

You know to tune out of a presentation when you hear....

I was never good at coding, but when I read that description of architecture, I knew I had found my calling.  "Hey! That's what I'm good at!"

If that doesn't do it for you..

You don't start building an $800k house without the blueprints do you?

Comparing yourself to the skilled labor in a process of skilled and unskilled labor is not very nice.

And another one..

Every architect carries around a set of Visio or other template documents that he uses when he starts architecting..

Finally, when a presenter starts bashing Fowler or ThoughtWorks, I'm out.  While I can't say anything for ThoughtWorks as a company, I can say that some of the most intelligent people I know of are ex-ThoughtWorkers.  If you have a personal vendetta against someone there, you should take it up with them privately.  Don't bash the company in public--particularly when you are the President of a newly formed Association of Software Architects.

Overall, I enjoyed the kickoff meeting.  Paul Preiss *is* a good speaker, however, I found parts of his presentation less than enjoyable.  He seemed to make a big deal out of being a titled "architect".  I'm there because I want to learn about architecture.  Let's talk about scalability, reliability, and other concerns.  Leave vendettas and other crap at home.

[Obligitory Note: The quotes above are paraphrased.]

And yes, those were the things which stuck out to me.

Luckily, I can tell that the local guys will be fun to get to know.  I've already found another Domain Driven Design guy.

And for the record, if you resort to "googling" your architecture (such as Paul says he did *for security* at one of his previous jobs--huge red flag), you might want to rethink some stuff.  There is no such thing as a theoretical architect.

If this post pisses someone off, so be it.  You are not above coding.

posted @ Tuesday, August 14, 2007 7:34 PM | Feedback (4)
MS Patterns and Practices to Become Test-Infected?

I may be a bit late on this one, so I apologize if so.  First, it seems that Grigori Melnik is taking over for Tom Hollander, the "father of EntLib", over at Microsoft Patterns and Practices.  While that may not catch your attention, you might want to take a look at the current issue of IEEE's Software magazine.  It has a broad focus on test-driven development.  Look a little closer, and you will find an article written by Ron Jeffries and Grigori Melnik, TDD--The Art of Fearless ProgrammingRon Jeffries was one of the original signers of the Agile Manifesto.  Now, I'm not sure what role Grigori will play over at P&P, but let's just say this is a very promising development. :-)

While I realize that Grigori is only one person, we all know how infectious the agile mentality is.  It'll be quite interesting to watch over the next few months.  I recommend subscribing to Grigori's blog.  Here's his RSS feed for those who are interested.  You'll notice the post on TDD was his very first.

I think it would be wise for the community to align itself behind Grigori.  He appears to be a clear voice for Agile inside the MS P&P world.  Maybe we could recruit him for the upcoming ALT.NET conference.  Spread the word and let's show the guy we support him. ;-)

Update:  I think the following PDF speaks volumes, Test-infecting Future Software Engineers.

posted @ Wednesday, August 01, 2007 6:28 PM | Feedback (1)