SOLID Thoughts

SOLID came up again in discussion.  What is SOLID?  Well, glad you asked, because I am going to elaborate on the SOLID Principles a bit.

Initial Concept
S Single Responsibility Principle
O Open/Closed Principle
L Liskov Substitution Principle
I Interface Segregation Principle
D Dependency Inversion/Injection Principle

The Single Responsibility Principle (SRP) is stated that every object should have a single responsibility and should be entirely encapsulated by the class.  This helps keep cohesion.  Here is a short example, starting with a basic class.

public class Car
{
    decimal Gas;
    int Doors;
    int Speed;
    decimal RampJumpSpeed;
}

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }Now I will refactor a little bit to make it a bit more SRP friendly.

public class Car
{
    decimal Gas;
    int Speed;
}
 
public class DuneBuggy : Car
{
    decimal RampJumpSpeed;
}
 
public class EconomyCar : Car
{
    int Doors;
}

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

What we end up with, instead of one class, is an abstract class and two classes that have their respective methods or properties to keep the responsibilities were they need to be.

The Open Closed Principle (OCP) is one of my favorites, which states simply, that you should be able to extend a classes behavior without modifying it.  There are a couple of ways one can extend a class, by inheritance, composition, or by proxy implementation. 

The Liskov Substitution Principle (LSP) states that a derived class must be substitutable for their base classes.

The Dependency Inversion Principle (DIP) states that one should depend on abstractions and not on concrete implementations.

Finally, the Interface Segregation Principle (ISP) states that fine grain interfaces should be client specific.

So hope that helps with kicking off a basic understanding of SOLID Principles.  I will be following this entry up with some new bits in the near future related to good software design and practice.

ALT.NET Seattle

Time to rock the ALT.NET scene and head up to the conference this weekend.  I must say, out of all the conferences I have been to the ALT.NET Conference is by far one of the best.  Great minds, great attitudes, awesome chances to learn, awesome changes to expand on one’s ideas with others that hit on the same hurdles!  All in all, last year was great and I am expecting it to be a great conference this year also.

For more information check out the ALT.NET site:

To get more involved in the monthly ALT.NET events in Seattle:

If you are in the Seattle area this weekend, be sure to hit up the conference.

Techie Land Silly Questions as Promised with My 2 Cents

Last week I posted the "Techie Land Silly Questions" and promised a response.  So here it is.

Question #1:  If you did not have to work, had a few dollars stashed away so that you could live comfortably and do whatever you wanted, what would you do?  Would you still code?  Would you still create?  What would you create?  Would you be able to stay idle?

I would create fun SaaS style web apps running in the cloud.  Probably a few phone apps too.  If I made tons of extra money, ya!  If not, oh well.

I would also setup time to drift, hard core style, probably own at least 2-3 S13s, 1 370Z for road trips, and possibly either an R34 or R35 GT-R for time attacks.  The catch of course is IF there was that much money to live on.

The other bits would be to, if possible, have a country house far away from others in a tranquil and awesome place were I could think and be away from the world once in a while.  The other would be to have a modest, 1000-1400 sq ft loft or condo of some sort in an urban environment in a preferred city (like say New York, Seattle, Portland, or some place of that sort) that would allow me appropriate parking or access to transit to get to my parking for the above mentioned vehicles.

Last but not least, I would love to write tons and tons of music until forever.

So put simply, I would absolutely NOT stop coding, but I would work on a LOT of other things without a regular 8hr daily gig.  The thought is fun, but even then I'm sure one of the above things would become a "job" of sorts.  Something always is the daily job.  : )

Question #2:  Based on whatever you did with your free time, what would you title yourself?  Chief Potato Masher, Pencil Pushing Writer o? Stories, or Coffee Endeavorer o? Tastiness?

Cowboy is one I like lately.  Cept' not in the "Modern Country Cowboy music hick", but in the honest, by the earth, live by the seat of my pants, keep the holster filled with a loaded 6 shooter type of Cowboy with integrity.  Yeah, that I dig.

I suppose the other one I go by is ok, Agilist Mercenary has cool ring to it.

Webtrends Web Analytics End of Week, 26th of March 2010

Within Webtrends Insight one has the ability to check out the story, an automatically generated feature that gives a written overview of the activity on your site.  I really like this feature as it gives verbal perspective.  Below is a screen capture of my blog as of today for the last 7 days. Click on the image for a larger image for readability.

The other really great looking bit is the Visits Overview Report.  All Web Compliant, and I’d show you the page, but you have to have a Webtrends Analytics Account.  😛

That is it for this week.  I am out on vacation next week, so the blog will be nice and silent.

Techie Land Silly Questions

Ok, it is time for an off the cuff, random, oddball, just for fun blog entry.  Two questions for the readers in Internet Land.

Question #1:  If you did not have to work, had a few dollars stashed away so that you could live comfortably and do whatever you wanted, what would you do?  Would you still code?  Would you still create?  What would you create?  Would you be able to stay idle?

Question #2:  Based on whatever you did with your free time, what would you title yourself?  Chief Potato Masher, Pencil Pushing Writer o? Stories, or Coffee Endeavorer o? Tastiness?

There are a million possibilities, I would love to know what you would call yourself, so please do leave a comment or three. I will have my answers later in the week.  So stay tuned and help me out with some comments.  You can bet it will include something along the lines of what I already do, but I’ll keep it a secret until then.  : )