Data Access Layer Responsiblities

Of all the segments of layers and designs for software one of the most common is the Data Access Layer, often referred to as the DAL.  For well over 5 years I’ve used dedicated DALs to segment the business logic and user interface from the actual database.  The data access layer serving the purpose to seperate the intricacies of the referential integrity and other such important necessities of the database from the programmer dealing with the business logic and flow from the user perspective.

Often times I’ve used DALs simply to describe my data objects, which are related directly to the tables and schema of the database itself.  When doing so I’ve been able to use the DAL that is generated from Codesmith by the default business object templates or other items that are included.  I’ve been able to grab some really great add ons to Codesmith such as .NET Tiers.  Following Microsoft’s Patterns and Practices this “extra” for Codesmith rocks.  It enables one to develop the DAL, deep fills, WCF bases, and other features.  A very nice set of generated procs are included along with that.

I’m still amazed how many groups still churn out their own “custom” and very proprietary data access layers.  The amount of time, money, and proprietary knowledge investment in such a layer is extensive.  I’ve always thought the effort, time, and money could be spent more specifically on the business logic and processing layers instead.  DALs are usually simple, no matter the complexity or chores performed by such a layer, the generated DALs that are provided via Codesmith and especially .NET Tiers are well worth the swap.  Dedicating human resources to write up this layer manually seems counter intuitive.  Of course, there are always reasons to hand code parts if need be, just rarely does this opportunity arise.

I wonder though, what other purposes should a data access layer serve?

Apress and O’reilly

So I had a miniature epiphany today while coding away on a multi-tier application I’m building for interactions with one of my other blogs and with a database driven website application.

That epiphany is that I have two books, the have basically outlined the difference between a $70,000 developer and a $105,000 developer or architect.

The first book is Pro ASP.NET 2.0 in C# 2005 from Apress.  If a developer knows all the ins and outs of each piece of technology in this book they are easily worth 65-75k.  Probably a little bit more depending on their location, but definately NOT less.

The second book is Head First Design Patterns from O’Reilly Press.  This book is not for the beginning developer really as the design patterns, any design patterns, aren’t really of any use until after one understand object oriented programming, basic project management, and various other topics at different levels of software development.  A developer that knows at least 1/2 of what this book offers up is easily worth $105,000 or more depending on position as developer or architect.  A developer with this knowledge would probably top out at about $90-95,000 with this knowledge, but tag Senior Developer, Architect, or Senior Architect and that range is easily somewhere in the $100-125,000 yearly range.

So to those budding developers, if you want a gauge of where you are, hit up these two books and you’ll have a good idea of where you stand.  If you’re under that bracket and you live somewhere out on the left coast (LA, San Fran, Portland, or Seattle) you REALLY better renegotiate or find a new job.  You’re bringing the rate down for the rest of us.  Even India has brought it’s rate up that the flow of offshoring has slowed to a trickle as of late.

As for developers out in the midwest or southern US, I’d estimate these ranges accordingly with cost of living, usually about 15-30% less than what is above… but then of course you guys in those areas can buy 3,000 square foot houses on 2 acres of land for the price of a 700 square foot condo out on the left.  🙁

anyway… enough of my rambling off topic discussions.

Projects

So I wondered on the bus out to a dive called Spawnpoint on 63rd and Foster.  Basically a black light gaming center.  It’s perty kewl if your into gaming, which I am, but I’m sitting writing code samples and checking stuff out at the moment.

Speaking of projects though, I’m somewhat focused on the idea of Six Sigma Software Projects and writing code libraries based on that.  Pareto ideas of benificial and mutual success etc., etc… etc.

The big question though is, “What code libraries would be most benificial for doing just that, six sigma product, manufacturing, and streamlinging of such processes?”

So just a quick overview of what exactly Six Sigma entails and what I’m trying to acheive with it.  First off, Six Sigma is not a software development cycle, it would be better described as a “do something perfect the first time” cycle.  GE, Bank of America, Toyota, Honda, Nissan, Sony DuPont, Merill Lynch and other major groups have used Six Sigma to create products and processes that are amazingly accurate and repeatable.

The title Six Sigma itself is in relation to the Greek symbol used to denote the deviations from mean.  Six Sigma specifically is the acheivement of no more than 3.4 defects per million, or 99.997% perfection.  That might seem like an impossible idea but it is far from it.  Many companies and processes far exceed that measurement.

Airlines, doctors, and other entities have to stay far better than 99.997% and often times stay far above 99.99995% or better.  They have to, or it would be a slaughter!

Simply put what I’m thinking of is creating a base library package to streamline Six Sigma Projects, based on a root level at integrating systems that currently exist, CRMs, ERPs, or whatever is in place at a corporation that needs integration.  The amazing this is that these systems promise so much integration but then are usually setup without the said integrations, thus a company ends up with completely seperate and disparate systems that cannot communicate with each other.  Just ticking away employee time in correlating data, attempting to provide information that is useful.  Some companies have used Six Sigma to such a degree as to know how much time is wasted and how much money is lost by non-integrated systems.

It seems a lofty goal to want to integrate such and provide such a service, but it is needed and there are not enough people out there doing this.  The question is, what approach, what tools should be used, what ways can be called upon to integrate said software?

…maybe I’ll come up with some good ideas, maybe I won’t.

CAB, SCSF, and getting that first smartpart going!

Read ** First (bottom of entry) – then continue – Ok, so my first task that I’ve set out to complete is to get an actual SmartPart displayed.  I’ve dug through the documentation and hands on lab that are available at this point and must say that I’m somewhat unhappy with the documentation available at this point.  So with that I’m going to start writing up some of these how-to things as I work through this.  So at some point I might possibly put together and submit some of these things via a book on CAB and SCSF.  But I digress, back to the topic at hand, how to get a SmartPart displayed on screen.

So here’s the approach to getting a SmartPart to display on a simple old screen.

First start a standard Guidance Package based SCSF/CAB Based Application.

Smart Client Application

Set the root namespace next.  Feel free to uncheck the “Show related documentation after running the recipe”.

The completed project should display as below.

At this point the skeleton of the project is available.  At this point I deemed it necessary to split the default Shell up a little bit.  Navigate to the ShellForm.cs file in the Shell Project.  Bring up the ShellForm.cs file and delete the DeckWorkspace control that is currently on the page.

Once you’ve deleted the DeckWorkspace do a quick build by hitting Ctrl+Shift+B.  You should get two errors and a few warnings as displayed below.

Double click on the #5 error and the ShellForm.cs file will open up.  Delete the line of code that it links to.

_layoutWorkspace.Name = WorkspaceNames.LayoutWorkspace;

then do the same for the #6 error.  Delete that line of code.

Microsoft.Practices.CompositeUI.SmartParts.ISmartPartInfoProvider ensureProvider = this;

Next open the primary ShellForm back up and drop a split container on the screen.  Name it splitPrimaryDivider for good measure and to give it a non-default name.  Next drag a DeckWorkspace on each section of the screen split.  Click on the task arrow…

 …and select Dock in parent container.  This will push the corners of the DeckWorkspace into the edges of the respective split sections.

Name the right hand side name for the DeckWorkspace to deckPrimaryContent.  Name the other DeckWorkspace to deckLeftItems.

At this point open up the Infrastructure.Layout Project and delete the three files; Module.cs, ShellLayoutView.cs, and ShellLayoutViewPresenter.cs.  Now the application can actually be executed and the shell will display.

Now one can get down to getting some SmartPart Components to display in the Shell.  The tasks left to get the DeckWorkspace to display the deckPrimaryContent and deckLeftItems SmartParts is;

  1. Place some controls on the SmartParts so we can make them do something and also be able to tell when they display (the standard gray on gray doesn’t really help us).- Create an interface to describe the methods needed to show the SmartParts in the Shell.- Create a WorkItem Class to implement WorkItem and show the SmartParts.- Write code in the ModuleInit to actually start the application and begin the loading process.

PLACE PICTURES HERE FOR CONTROLS ON PAGE

Create in the Infrastructure.Layout Project a ShowInShell.cs file.  Toss in an interface to use to pass SmartParts in for display.

using System; using System.Collections.Generic; using System.Text; // Added Reference using Microsoft.Practices.CompositeUI.SmartParts;

namespace MySmartClientTest.Infrastructure.Layout {  public interface IShowInShell  {   void Show(IWorkspace sideBar, IWorkspace content);  } }

Create a WorkItem Class to implement the WorkItem and IShowInShell interface to show the SmartParts.  Add a directory (just to keep things neat) name WorkItems to the Infrastructure.Module and then place a file called MyWorkItem.cs in the Project Folder.  Before adding any code make a reference to the MySmartClientTest.  You might need to add a few using references, which are listed below and then just toss in the following code.

// Added References using Microsoft.Practices.CompositeUI; using Microsoft.Practices.CompositeUI.SmartParts; // For the IWorkspace implementation. // Added Local Projects using MySmartClientTest.Infrastructure.Layout;

public class MyWorkItem : WorkItem, IShowInShell {  private IWorkspace contentWorkspace;  public IWorkspace ContentWorkspace  {   get { return contentWorkspace; }  }

public void Show(IWorkspace sideBar, IWorkspace content) {   contentWorkspace = content;

  //this.Items.AddNew(“MainContent”);

  MainContentSmartPart mainContentView = this.Items.AddNew();   LeftMenuSmartPart leftMenuView = this.Items.AddNew();

  sideBar.Show(leftMenuView);   content.Show(mainContentView);   this.Activate();  }

 protected override void OnActivated()  {   base.OnActivated();  } }

At this point just click on old F5 and run that dog…

…ok so at this point I ran into a stupid problem.  The name according to what I’ve given then project is too long.  ?!  Stupid stupid problem to have…   so anyway.  Hopefully you read this line first because I don’t feel like changing the text.**