Pages

Showing posts with label generics. Show all posts
Showing posts with label generics. Show all posts

Wednesday, 1 August 2007

A reflection of generic thoughts attributed to software design

Techniques such as Reflection, Attribute-based programming and Generics (to name a few) provides the developer with a high degree of flexibility when designing today's software components and classes. Flexibility in design is a key notion that should be nurtured well, and with proper paradigms and patterns in place, should allow for adaptable constructs to be developed.

I put myself to task with a simple problem: Create a mechanism that allows importing CSV files. Each type of CSV file would represent an object in the real world. There would be a CSV file for Employees, with their details, another one for Departments, with department details and so on.
The number of CSV files, and their internal record structure can vary drastically.

You must make your class design flexible enough that with minimal effort, you are able to model different types of files and objects; you must ensure flexibility and minimum amount of work in modelling new objects and minimum re-work when modifying existing classes to suit new record structures.

I thought about this for a while, and came up with a solution involving reflection, attributes, generics and even a factory design pattern. I might have gone way over my head, but feel free to read my article at CodeProject, get a head about what's going on and tell me what you think.

After all, programming is sometimes just damn fun. :)