Skip to main content

Articles

Featured Products

Windows Mobile Developer Controls
Windows Mobile Developer Controls
Stay in touch using the DEVBUSS RSS feeds.
 

News

Windows Mobile Developer Controls
Sapphire Soltuions

.NET Compact Framework - Making the Switch!

Written by Derek Mitchell  [author's bio]  [read 48729 times]
Edited by Derek

Page 1  Page 2  Page 3 

Architecture

The overall architecture of your application is critical. What do I mean by architecture? I'm talking about the way you create classes and the forms that use the data they expose. The more strictly you adhere to the principles of OO the better chance you have of reaping the rewards OO programming; ease of maintenance; speed; readability etc. That said however you will also discover that you can easily take this concept over the top. Now this might offend the OO purists in our midst but be careful not to take the approach of "I'm only going to write this piece of code once in my entire application; I'll encapsulate it into an object and just use it everywhere!" Sure this works for some things - like having generic methods you can inherit to handle validation and data access but at a point your code will become unreadable - exercising some constraint in your newfound OO fervor is advisable for your sanity.

The Singelton class

One of the first architectural challenges you will come across is the question of how to build your application so that there is a central place to store and retrieve application wide settings. There are two approaches; one is to write a singelton class approach as discussed in the MS article Exploring the Singleton Design Pattern; the other is to declare a sub routine in a Module as the startup object. This will provide a central place to manage application wide objects and settings.

Putting OO to work for the first time

One of the simplest examples of putting OO techniques to work is using simple inheritance. Many times you will have a multitude of lookup table items, for example Status, Priority, Types etc. with very similar properties typically and ID and Name. Each time you create a class you instead of explicitly creating the properties every time; create a baseitem class which encapsulates the common ID and Name properties (see below) then create the new class that inherits the baseitem class.

Public Class Status
  Inherits BaseItem
End Class

 

Previous Page  Next Page