Apr 30 2009

Generic Object Suffixes for Naming your Classes

Category: Design | Design PatternsJonathan @ 05:03

When creating a large project, it is sometimes extremely hard to find names for certain things. So I have a small list. I mix and match ActivityItem, PropertyItem, ElementFactory and so on. Helps with those generic classes you cant find names for!
you probably already using most of them, if not all ..... (got more for me?)
More...

Tags: ,

Apr 27 2009

The Every Project Framework - Introduction


Do you think of a Framework as a large 'hole, to be avoided'? Are they too complicated to develop within your project, for everyday development?
I take the view, that a Framework can very easily be part of every project you build, and with great benefit. You just have to understand how.

A Framework has two very important characteristics to give to Applications. A Framework provides structure and infrastructure.

More...

Tags:

Apr 20 2009

Refactoring complex classes using Composition Part 3

Category: .NET | c# | Design | Design PatternsJonathan @ 02:55

To conclude the previous two posts on using composition for refactoring complex classes

Refactoring complex classes using Composition Part 1
and Refactoring complex classes using Composition Part 2

Why should complex classes be refactored? To make code smaller and more manageable. To separate code that changes at different rates, and which are not concerned with the same things.

Composition vs Inheritance? Composition = "has a" relationship, Inheritance "is a" relationship. Inheritance quickly makes you feel like you create Object-Oriented code, but its one of those devices that should be used for a real reason, not just off the cuff.

Reading
- Some background from C2 Wiki - Composition Instead Of Inheritance
- A good principle from Evolve aggregations from inheritance heirarchies - Brian Foote and William F. Opdyke
- Look at Adaptor, Facade, Proxy from Design Patterns (GoF) and also the Stategy, which is mentioned here by Erich Gamma A Conversation with Erich Gamma, Part III
- Refactoring Catalog - Martin Fowler
- Refactoring posts - Martin Fowler

Tags: , , , ,

Apr 9 2009

Refactoring complex classes using Composition Part 2

Category: .NET | c# | Methodology | Refactoring | Visual StudioJonathan @ 04:07

Please Note: Please make sure you have proper unit test coverage on your classes, as you refactor.

From Part 1, I showed you how I initially split a large class into a few more, splitting the complexity of having the code in one place. However, you will still find that for a really complex class, there will still be quite a lot to do. Here are a few more composition based things to consider for continuing the refactoring process.

More...

Tags: , ,

Apr 8 2009

Refactoring complex classes using Composition Part 1

Category: .NET | c# | Methodology | RefactoringJonathan @ 04:09

Please Note: Please make sure you have proper unit test coverage on your classes, as you refactor.

Using Design Patterns which deal with compositional power, such as Wrapper, Facade, Adaptor, Bridge, Proxy and others are extremely useful for breaking large classes down. Rather have 10 smaller classes than 1 large one.

Well here is a very simple start to how to get your refactoring of that large class under way. Please be sure to compile your project after each step, to fix any errors, before moving to the next step.

More...

Tags: , ,

Apr 3 2009

Smegging Code Metrics

Category: Jonathan @ 07:05

Traditional Code Metrics such as LOC an CC is absolutely rubbish. It is pretty much as useful as Flesch-Kincaid is for reading. A C# code file measures quite readable.

More...

Tags: