Persona Patterns
Categories
I love working on large projects - especially ones which live atop framework code. Typically a relatively small group of really bright people come in and create the initial architecture, write the framework and service plumbing code and then the project is built on to of that.
In the months that follow applications are built in, on, and around this core and you get to learn some really interesting lessons; lessons about diversity. I'll bet that on any large, mature framework I could go through the code base and find that, at various times it had been worked on by each of the following persona's:
The over-coder
This person has a knack for turning a one-liner into about 30 lines of code:
120
121 Sub SaveButton_Click(sender as Object, e as EventArgs)
122 dim c as SqlConnection
123 c = new SqlConnection("Server...")
.....
452 End Sub
The under-coder
This guy would write the entire framework in a single line if it was possible:
ToyService.AddStuff(new Foo(1).Whatever()).Go()
The risk taker
No checking required here...
int Bar( MyType o ) {
int x = o.GetAge() ;
return MIMIMUM_INTEREST_RATE/x;
}
The XML nazi
SOAP me up! Flexibility, Interoperability, Transformability, stupidity! Inheriting a project from the XML nazi requires that you learn how to code in Spaghetti.NET.
string xml = DataLayer.ExecuteSQL("<xml...>...</xml>") ;
XmlDocument dom = new XmlDocument() ;
dom.LoadXML(xml) ;
string newUI = new XsltTransform(dom, pathtoXSLT).Transform() ;
Page.MainContainer.Controls.Add(new LiteralControl(newUI)) ;
The "I love classes" guy
Generic, Polymorphic and encapsulated is where it's at baby:
Input input = new Input(...) ;
Processor processor = new Processor(typeof(Input)) ;
processor.AddInputs(input) ;
Transformer t = new CustomTransformer(processor) ;
t.CalculateBuilderType() ;
GenericBuilder builder = BuilderFactory.CreateBuilder(t.BuilderType) ;
CustomPage page = new CustomPage(builder) ;
PageRenderer.Render(page, t) ;
The "WTF are classes" guy
Scrolling is good for you, it exercises your mouse finger and your eyeballs...
void DoesSomething(arg1, ....... arg15) {
// INSERT 1000 LINES OF EYE-BLEEDING CODE
}
The "look at my exception handling" gal
This person learned all about structured exception handling while studying for their MCP. They understand that catch blocks allow us to catch exceptions and handle them in code. They also understand perfectly that the order in which you stack your catch blocks matters - and so you must always catch the most specific exception types at the top and the least specific at the bottom.
void Method1(string filePath) {
try {
File f = File(filePath) ;
f.Attributes["approved"] = true ;
}catch( ComInteropException e ) {
Log( e ) ;
throw ;
}catch( FileNotFoundException e ) {
Log( e ) ;
throw ;
}catch( NotAuthorizedException e ) {
Log( e ) ;
throw ;
}catch( InvalidFileCharsException e ) {
Log( e ) ;
throw ;
}catch( Exception e ) {
Log( e ) ;
throw ;
}
}
The day programmer
It's just gotta compile right?
string ReceiveInputFromDialogToOutput(int EnterdInDialog1) {
string outputVeriabel = "" ;
if( EnterdInDialog1 > 10) {
outputVeriabel = "true" ;
} else {
outputVeriabel = "false" ;
}
// int e = int.Parse( number.ToString() ) ;
// int e =
//
return outputVeriabel ;
}