I recently had to update some code with a new parameter that needed passing between the calling code and a series of lower level business and data classes. Over a period of years the classes have had more and more parameters added and adding another one meant changing 50+ objects plus all the calling code.
An example of this code is shown below
The Data Class being instantiated
Public Sub New(ByVal _DbType as common.DbType, ByVal _UserID as Integer, ByVal _Signature as String)
….
The calling code
Dim mDataObj as new myClass(common.DbType.SQLServer,myUserID, “John Ellis”)
So adding a new parameter was going to be time consuming and on the off chance any new parameters were going to be added in the future a better solution was required.
To resolve this I created a new Class to hold all the values that would be passed. It is important to consider which parameters are globally needed or you can end up moving them all into this class.
Public Class GlobalParams
Public mdbtype As iapCommon.Enums.DBType
Public mUserID As Integer = 0
Public mUserName As String = “”
Public mSignatureLine1 As String = “”
Public mSignatureLine2 As String = “”
Public Property DBType() As iapCommon.Enums.DBType
Get
Return mdbtype
End Get
Set(ByVal value As iapCommon.Enums.DBType)
mdbtype = value
End Set
End Property
Public Property UserID() As Integer
Get
Return mUserID
End Get
Set(ByVal value As Integer)
mUserID = value
End Set
End Property
Public Property UserName() As String
Get
Return mUserName
End Get
Set(ByVal value As String)
mUserName = value
End Set
End Property
Public Property SignatureLine1() As String
Get
Return mSignatureLine1
End Get
Set(ByVal value As String)
mSignatureLine1 = value
End Set
End Property
Public Property SignatureLine2() As String
Get
Return mSignatureLine2
End Get
Set(ByVal value As String)
mSignatureLine2 = value
End Set
End Property
End Class
This now changes the code above to
The Data Class being instantiated
Friend mGlobalParams as new common.GlobalParams
Public Sub New(ByVal _GlobalParams as common.GlobalParams)
mGlobalParams = _GlobalParams
The calling code
dim mGlobalParams as new common.GlobalParams
mGlobalParams.DbType = common.DbType.SQLServer,myUserID
mGlobalParams.UserId = 20088
mGlobalParams.Signature = “John Ellis”
Dim mDataObj as new myClass(mGlobalParams)
This may not seem a great improvement but now if we want a new global parameter we can add it to the GlobalParams class and we only have to change the code the requires the new parameter. This reduces maintenance also as the GlobalParams are usually set up in the load function of the main program they only need to be populated one and then each time the class is instantiated you are only coding the one line for the New.
Better solution, let me know.
-
Delivery of IAP Applications System
This week has seen the delivery of the Institution of Analysts and Programmers, Applications system.
This system takes online applications from their web site and manages the application through the various processes from ensuring all the relevant material has been supplied, that the application is reviewed and the applicant informed as to whether they were successful or not. It then awaits the payment of the membership fee and will then automatically create a member record in the IAP’s Membership System.
If you are in need of a custom written membership system, why not give us a call or email us. -
Just for fun
Try these Easter Eggs from the BBC web site, I particularly like the Tardis and Breakout.
http://www.bbc.co.uk/news/technology-25826678 -
Wellis Technology wins prestigeous award
Wellis Technology has won an award from the Crawley Community & Voluntary Service.
We won the prestigious CCVS Corporate Supporters Award for our work with them on their mailing database. Enabling them to target the volunteer groups more effectively with more accurate and intelligently derived information for the mailings.
For more information please contact us on 01903 692762 or email me at john.ellis@wellis-technology.co.uk -
Virtual Driving
Here is a great link that allows you to drive your car, virtually from A to B. It draws its images from Google and Bing maps.
http://www.gaiagi.com/driving-simulator/ -
IOS 7
As a fairly keen iPhone owner, I downloaded the new IOS 7 this morning and wow is it different, from logging in, the Icons and many of the apps have changed appearance.
There are hundreds of changes, of course some only apply if you have a iPhone 5 or better, but many are nice enhancements.
Security as ever is a improvement.
Try it and see -
Service Update
Our hosting agent has restored services after they suffered a Denial Of Service Attack. -
Service Update
Please be aware one of our hosting agents is experiencing a network issue at their installation. They are working to resolve this, but some web sites and email may not be accessible. They hope to resolve this in the next few hours -
Photo Editing Service
We have over the years taken many photos for our client web sites etc, and of course personal photos.
Like you we often don’t always get quite the photo we were after and using tools like Adobe Photoshop edit the pictures to suit our needs.
Whether it is cropping an image, removing red-eye, straightening a Church tower in the background, getting rid of the spots in a photo caused by dust, dirt or a flying bird we can help.
We can offer 1-2-1 training on this and other simple editing to lift your photos up a notch or edit them for you if you wish.
We can change the colour of Aunty Mable’s hat in the photo, or even add someone into the picture who was not there.
-
Email and Telephone Services Outage
During Saturday we experienced a lighting strike near our office, This led to our telephone systems being down and our broadband running at 1% of normal.
This has meant that emails coming through were delayed and we may have missed the odd call via our IP phone system.
We now have our primary telephone system back and our broadband back at full kilt.
We apologise for any calls we missed
