A class represents a template for an object that can have attributes and/or behaviours. The object itself normally represents something in real world i.e. Person or something that physically does not exists but one can define it i.e. a Blog Post.
In .Net development platform classes and structs are the core object templates. Classes and Structs derive from .Net’s Object class. Then there are Interfaces. An interface is a contract template that you can sign with class and struct types to ensure they implement the same members on the contract.
Quite often I use the phrase “Rich Class” to suggest the class in question exposes common services to its users. Also a “Rich Class” is the type that encapsulates all possible logics within itself. This is the most fundamental design strength of a class.
Here is an example to what I mean. You have a class called Person with FirstName and LastName properties that the user can use to retrieve values and to assign values to the designated fields. Now imagine the Person class is used by hundreds of developers. If the developers need to show the full name of the person they need to write a concatenating statement like the code snippet below:
textBox1.Text = person.FirstName + “ “ + person.LastName;
If the Person class was “rich” then it would have either a ReadOnly property called FullName or overrided the ToString() method of System.Object to make it easier for the users of the Person class.
Examples:
textBox1.Text = person.ToString();
or
textBox1.Text = person.FullName;
The poor design of Person class made all developers to code extra unnecessary.
You can also design rich classes that expose services to its users. For instance, I look at the implemented Dispose() method of IDisposable pattern as a service for types. This is up to the user whether they want to call it or not. Incidentally, in C# 2.0 if you intend to use the “using” keyword the type now is required to implement the IDisposable interface.
Similar to IDisposable you can introduce ISerializable and ICloneable as services too. Developers can’t predict everything to what the user of the type would intend to do therefore it would always be a good practice to make a type as rich as possible.
I like to design rich types because I know such types would save me a great deal of time later on when I have less time. Creating rich classes is very difficult and time consuming something that developers never have.
Considering that developers are required to learn more to be able to use the never ending new technologies it makes time ever more precious. I have noticed in the past 2-3 years software quality has dramatically dropped. Obviously apart from the lack of time and rushing the product out to bring in the money there are other factors involved too, the lack of skills/experience, out-sourcing, and few more to mention.
Now to the good part…
Smarties 2008 helps developers designing better types by reducing the coding time and freeing the developer to work more on the types. With Smarties 2008 many painful routines can be done with a couple of clicks.
Smarties 2008 features:
Region Commands: If you use #regions to organise code that will boost productivity then you would find Smarties 2008 very handy and even if you dislike #regions then Smarties 2008 gives you all the commands you to remove them from your source files.
Refactor Commands: Common refactor commands plus many unique commands that are pure time-savers.
Smart Interfaces: You can click 2-3 times and implement one of the supported Interfaces with full statements generated. The supported interfaces are IDisposable, ISerializable, and ICloneable.
Data Commands: Even though Smarties 2008 is not an OR/M or DAL Generator we have recently added Data Commands related commands. One of the things you can do is to create Flat BO/VBO from one of the nine supported database engines. I’m currently working on adding DAO support to save you even more time.
This is true to say if developers have the right tools they would be more productive therefore can produce better software. A single feature in photoshop the king of graphic applications doesn’t do much and it doesn’t make you creative either but collectively you can do so much and make eye catching graphic images. In that sense Smarties 2008 might appear not to do much at first glance but collectively you can achieve a lot.
Imagine you need to create a class that has four properties, of any types, the class has to implement IDisposable, ISerializable since it would be transported over the wire, and ICloneable interfaces. I’m not done yet… Then the class also need to produce an XML string to pass the data to a legacy system. With Smarties 2008 all you need to do to declare the fields and the rest is done by few clicks. With a couple of more clicks you can even create a generic collection of above type. When you have powerful features at your feet then you wouldn’t need to be so economical in your design.
I really just touched the surface as to what you can achieve with Smarties 2008. Please free to visit the site to download a free trial or to watch the videos to see what Smarties 2008 can do for you.