Skip to main content

Decouple that Decoupled Code

Decoupling code is the process of separating concerns. In programming, it refers to separating the code into pieces and ensuring that each piece works on its own. Kind of like a robot might have a robotic arm that can work independently of the rest of the robot.

While not the first, Ruby on Rails has made decoupling popular in Web applications.  Everyone decided to get on the bandwagon here, so even Microsoft came out with an MVC Framework, now in it's 3rd edition.  Developers seem to love MVC.  It's simple, elegant, and most importantly, it's decoupled.

If you ever do Enterprise development, you'll quickly learn that MVC isn't the only way that apps are decoupled.  In many applications, particularly on the .NET side of things, you'll find that code is compartmentalized into components that plug into each other.  It's because of this that I am starting to perceive decoupling as happening in layers.

Let me try to map this out.  In a very very very broad view of things, there is the Database and the application and those things in between.  We'll call these the Database Layer, the Application Layer, and the Service Layer, as this is often how I see things in enterprise code.
Within each layer, however, we find ourselves writing code.  The database gets broken up into tables and normalized.  Each service in the service layer is broken up with a Model, the webservice front end, and the Application logic.  In Visual Studio this is really prevalent because of the way projects are in both appearance and compilation.  Here's an example of a WCF Service.

Then things start to get real interesting.  We see this on the front end as well.  The solution looks like the one for the WCF Service, except the front end is an MVC Application.  That's correct, our Decoupled Project, is full of decoupled Applications, and when we get to the front end, we decouple the front end further.

Now, I'm not going to post my opinion on this.  I'm not even sure if I have one.  But, since we're in the process of decoupling our front end.  Why not decouple the View in our MVC project?  Enter KnockoutJS.  This is a spectacular library for JQuery.  It's purpose is to decouple your HTML and Javascript, enabling your javascript to host your Model and your View Model, while your HTML is a crisp clean View.  Plus, it has some awesome tutorials.

Now we can use MVVM to decouple our View, which is decoupled from our Web Application, which is decoupled from the Application, which is decoupled from the Data.  Dare we decouple further?


Popular posts from this blog

Managing Developers is HARD

I've been a software dev for a long time.  I've also been running my own software company for a few years now.  This is important information because of why I do these things.  I am a sofware developer because I love learning.  I slack off when doing a job that bores me, and software development always has something new to experience which keeps me excited and interested.  Why start a software company then?  That puts me in the role of manager rather than developer.  The truth is simple.  I've worked for a lot of companies, and I don't see any of them doing a great job of managing their software development.  That's not to say none of them have done a good job, but no one out there seems to be doing a great job.

How are they different?
A lot of companies get this part right.  Software developers are different from other employees.  The distinction is important in the same way it's important to acknowledge that an insurance agent is different from a construction…

Managing Programmers

Working with other programmers is tricky.  That said, it's nothing compared to the job of managing programmers.  One of my favorite quotes about Perl is that (paraphrased) "a Perl developer is like a rockstar.  Now imaging having a bunch of rockstars in one room together and you will understand why you don't want an entire team of Perl developers."  It's not about Perl here though. What's important to understand is that any developer worth his salt is going to be like a rockstar.  And yes, there are a lot of professional developers out there who aren't worth their salt, but that's for another post another day.  Rockstar may not be the right term here, but think of it this way.  These guys are smart.  They may not be geniuses, but there's going to be things that they know that you don't and probably never will.

I've seen it more than once and it's not going to make some Product Managers happy, but I'm going to state a fact, an eleph…

How to identify a skilled programmer during an interview

How does one identify a skilled programmer?  No company that has interviewed me could tell the difference between myself and other programmers they'd interview.  The interview process is truly a game of luck in this industry--on both sides.  Both the programmer and the company are basing their actions entirely on luck.

Companies have come up with numerous methods to attempt to discern a good programmer from a bad one.  The best tricks they have include a series of math problems, algorithms, problem solving technique tests, and even obscure programming questions, some without definitive answers.  As an example: Is there an authoritative source of information on the core principles that define object oriented programming?  I've heard everywhere from 3 to 7.  In a field of research about a synthetic concept, an authoritative answer is almost impossible to obtain.

Programmers were then forced to study to the interview.  Careercup is one of my favorite sites for this.  This almost …