Archive

Archive for the ‘Development’ Category

Layers of Architecture

October 16, 2009 Leave a comment

There are tons of architects out there today. It seems when you’ve spent enough time as a developer, you end up becoming an architect.  Architecture is not just the next step in a developers career. There are whole new disciplines and methodologies applicable to architecture. That said here are the common levels of architecture.

Enterprise Architecture (planner)

Enterprise architecture is a high level field that concentrates on how the various domains or subject areas interact. This layer spends even more time focusing on how technology will be utilized in the future, and governing how it is used today. Enterprise architects work to create technology roadmaps and work with the business to plan for the implementation. Enterprise architects create technology projects. It is at this layer where frameworks like TOGAF and taxonomies like Zachman come into play. This layer view the enterprise as a holistic entity.

 

Solution Architecture (designer)

A solution is an answer to a question. The question in this case is typically an IT project. The solution architect’s primary objective is to design a solution that meets the projects requirements and also falls in line with the domain and enterprise architecture guidelines. The solution architect is responsible for coordinating with multiple domain architects to design the most appropriate solution. A solution architect may interact with domain architects in infrastructure, web services, data management, and so on. During the course of the project a solution architect will typically create many work products either for communicating the solution to a governance board, to explain the implantation to a developer and various other uses. These work products are eventually owned by the domain architect as codified knowledge of the system after the project implementation.

 

Domain Architecture (owner)

A domain is an area of focus. Domain architects are primarily focused on maintain a specific area of technology or a specific application. These architects are the owners and gatekeepers for a specific area. The work in this area is primarily concerned with the current state of the system. These architects are charged with managing the knowledge for their area. These architects are also responsible for keeping up to date on future projects related to the domain and guiding the designs to meet the overall objectives of the domain. A successful domain architect will know that a future project will require x functionality. When an active project is debating between two possible implementations, the domain architect will be able to guide solution toward the best of the two solutions that meet the future goals.

 

Application or System Architecture(builder)

The application or system architect is primarily focused on the implementation at hand. This is the most detailed level of architecture. An application architect, for instance, would be concerned with the most appropriate design pattern to use in a certain programming situations. These tend to evolve from the most advance developers and engineers. The primary focus here is to implement the best solution for a specific task. Work products that may be produced during this layer are primarily used to communicate to the developers or implementers. In many co-located environments a lead developer often fills this role and very few work products are actually produced. Instead the team may utilized whiteboards or code stubs to communicate the implementation. For larger more dispersed projects, or for outsourced solutions, the application or system architect has a more demanding role for providing detailed implantation instructions. 

 

Conclusion

The various layers of architecture are not meant to be isolated entities. In most situations one architect will fill multiple roles at various levels. Each layer has a unique focus. Understanding the layers helps clarify responsibilities, activates and deliverables. From a career development standpoint individuals can use the layers as the basis for a personal gap analysis and learning plan.

 

I look forward to reading your thoughts and comments.

 

Best of luck in all your endeavors.

Code Quality with Eclipse Plugins

November 5, 2008 Leave a comment

image Tech leads are continually challenged with identifying and governing code quality. The common response is to look to test coverage as a measure of quality. Previously I was challenged to monitor code and architectural quality for over 50 developers both on and offshore. The shear amount of code made manual reviews a nightmare. While had reports on coverage it became apparent that the quality of the tests themselves  was also in question. It was time for a more automated review of quality.

After reviewing a series of tools and working through various industry best practices, here is the list of tools I ended up relying on regularly.

Automatically Format on Save

The standard fare

Often Overlooked

Code Coverage

Focus on the important code

There are a few really good articles to help you get up and running with these

Check out:

Andrew Glover: In Pursuit of code quality

Metrics

Use the tools available to analyze faster and make your code stronger.

FEEDBACK: Let me know if there are other tools or resources that make your life easier.

Bite Size: Refactoring in Eclipse

August 6, 2008 Leave a comment

IDEs offer many tools that speed up the development process. Among the many features in eclipse for coding are a series of commands for refactoring code. Understanding how to quickly utilize these commands will dramatically speed up your development process.

  • Display Available Refactor Commands (Alt+Shift+T)
  • Rename (Alt+Shift+R)
  • Extract to Local Variable (Alt+Shift+L)
  • Extract to Method (Alt+Shift+M)
  • Change Method Signature (Alt+Shift+Y)
  • Undo Refactoring (Ctrl+Z)

Bite Size: Object Oriented JavaScript

May 28, 2008 Leave a comment

JavaScript is typically thought of as a procedural scripting language, however it contains many aspects that allow for Object Oriented style scripting. Below you will find a few examples of how to script JavaScript in an Object Oriented style.

Before you start
The best way of studying this tutorial is to have Firefox with Firebug handy. This way you can test the tutorial examples immediately.

Install both of them if you haven’t already done so.

Also review the tutorial on using Firebug and additional tips on debugging with firebug

{tip}

The Firebug command line, found at the bottom of the Console tab, is no different than any command line you’ve used in UNIX, DOS, or Windows—except that it accepts commands written in JavaScript.

The command line is more than just a place for one-liners. You can expand it to become a full-size editor. When you’re working in your external editor, you can quickly copy-and-paste code into the Firebug editor to execute them immediately and how they effect the live page. Once you’ve gotten the result you’d like, copy the finished code and paste it back into your editor.

{tip}

Variables
Global variable definition

var myVariable = "myVar";

function visibilityExample(){
	/* visibility: public */
	this.publicVar="";
	/* visibility: private */
	var privateVar="";
}

Methods
Simple method with return

function MyMethod1() {
    var rtnVar1 = null;
    this.pubVar1 = "1";
    rtnVar1 = this.pubVar1
    return rtnVar1;
}
alert(MyMethod1()); // returns 1

Static Objects
Demonstrates Object with static methods foo and bar

var MyObject2 = {
    foo: function() {
        var rtnVarFoo = null; //private variable
        this.pubVar2 = "2"; //public variable
        rtnVarFoo = this.pubVar2;
        return rtnVarFoo;
    },  // notice the comma
    bar: function() {
        var rtnVarBar = "2";
        return rtnVarBar;
    }
}
alert(MyObject2.bar());  //returns 2

Basic Object Instantiation
Demonstrates basic object instantiation

function MyObject3(r,g,b)
{
  this.Red = r;
  this.Green = g;
  this.Blue = b;

  this.bar = function(){
        var rtnVarBar = "3";
        return rtnVarBar;
  }
}
myNewObj3 = new MyObject3("red","green", "blue");
alert("Bar: " + myNewObj3.bar());  //returns 3

Basic Prototype Example

/* Base object */
function MyObject4() {
    // constructor code goes here
    this.myVariable4 = 5;
    this.bar = function(){
        var rtnVarBar = "4";
        return rtnVarBar;
  }
}
/* Adds method to Base object */
MyObject4.prototype.memberMethod = function()
{
    return this.myVariable4;
}
myNewObj4 = new MyObject4();
alert(myNewObj4.memberMethod());

Basic Inheritance Example
prototype = base object type (think extends)
objects not defining a prototype are thought to extend Object
(think extends Object)
objects (objA) that have their prototype set (to objB) are thought to extend the second object (objA extends objB)

// Base Object
function Employee () {
    this.name = "";
    this.dept = "general";
}

// Manager extends Employee
function Manager () { // defines initial Manager constructor
    this.reports = "Bob, Jane";
}
Manager.prototype = new Employee;  // sets Manager as an extention of Employee

// WorkerBee extends Employee
function WorkerBee () { // defines initial WorkerBee constructor
    this.projects = "SalesProj, MarketingProj";
}
WorkerBee.prototype = new Employee;  // Sets WorkerBee as extention of Employee

myManagerJohn = new Manager();
myManagerJohn.name="John";
alert("Name: " + myManagerJohn.name + "\nDept: " + myManagerJohn.dept + "\nReports: " + myManagerJohn.reports);

myWorkerBeeBob = new WorkerBee();
myWorkerBeeBob.name="Bob";
myWorkerBeeBob.dept="Sales";
alert("Name: " + myWorkerBeeBob.name + "\nDept: " + myWorkerBeeBob.dept + "\nProjects: " + myWorkerBeeBob.projects);

Extending the base prototype
Adds to base object AFTER child objects have been created aka. Dynamic Inheritance

// Base Object
function Employee () {
    this.name = "";
    this.dept = "general";
}

// Manager extends Employee
function Manager () { // defines initial Manager constructor
    this.reports = "Bob, Jane";
}
Manager.prototype = new Employee;  // sets Manager as an extention of Employee

// WorkerBee extends Employee
function WorkerBee () { // defines initial WorkerBee constructor
    this.projects = "SalesProj, MarketingProj";
}
WorkerBee.prototype = new Employee;  // Sets WorkerBee as extention of Employee

myManagerJohn = new Manager();
myManagerJohn.name="John";
alert("Name: " + myManagerJohn.name + "\nDept: " + myManagerJohn.dept + "\nReports: " + myManagerJohn.reports);

myWorkerBeeBob = new WorkerBee();
myWorkerBeeBob.name="Bob";
myWorkerBeeBob.dept="Sales";
alert("Name: " + myWorkerBeeBob.name + "\nDept: " + myWorkerBeeBob.dept + "\nProjects: " + myWorkerBeeBob.projects);

Employee.prototype.hourlyRate = "50"; // << Dynamic Inheritance

alert("Name: " + myManagerJohn.name + "\nDept: " + myManagerJohn.dept + "\nReports: " + myManagerJohn.reports + "\nHourly Rate: " + myManagerJohn.hourlyRate);
alert("Name: " + myWorkerBeeBob.name + "\nDept: " + myWorkerBeeBob.dept + "\nProjects: " + myWorkerBeeBob.projects + "\nHourly Rate: " + myWorkerBeeBob.hourlyRate);

Working With Constructor Parameters

/**
 * Base Person object with empty constructor
 * @constructor
 */
function Person(){
    this.name="Name: ";
}
/**
 * Base Person object with 1 element constructor
 * @constructor
 */
function Person(name){
    this.name="Name: " + name;
}

bob = new Person("Bob");
alert(bob.name);

/**
 * Extended object with constructor
 */
function Teacher(name, subject){
    this.base = Person;
    this.base(name);  // Think super(name) from java
    this.subject="Subject: " + subject;
    this.toString = function(){
        return this.name + "\n" + this.subject;
    }
}
Teacher.prototype= new Person;  // Ensures dynamic inheritance

jim = new Teacher("Jim", "Math");
alert(jim);

/**
 * Using ".call" for parent rather than ".base"
 * for a 'cleaner' implementation
 * .call was implemented in: JavaScript 1.3
 */
function Janitor(name, shift){
    Person.call(this,name); // Think super(name) from java
    this.shift="Shift: " + shift;
    this.toString = function(){
        return this.name + "\n" + this.shift;
    }
}
Janitor.prototype= new Person;  // Ensures dynamic inheritance

stan = new Janitor("Stan", "Night");
alert(stan);