• What We Do
    • CUPAS
    • Security
      • Business Recovery Planning
      • Cyber Security – Business
      • Cyber Security – Home Users
      • Cyber Security – Software Developers
      • UK Security Threat Index (UK-STI)
    • Standards (BSI/ISO)
    • Solutions
      • reMarkable
  • Links
    • The IAP
    • The RSA
    • The BCS
    • Llanelli Chamber of Trade and Commerce
    • 4 The Region
    • UK Cyber Security Council
  • In the Community
  • Blog
  • VB.Net and Object Parameters

    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.

    John Ellis

    12/03/2014
  • 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.

    John Ellis

    28/02/2014
  • 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

    John Ellis

    23/01/2014
  • 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

    John Ellis

    06/11/2013
  • 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/

    John Ellis

    30/09/2013
  • 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

    John Ellis

    19/09/2013
  • Service Update

    Our hosting agent has restored services after they suffered a Denial Of Service Attack.

    John Ellis

    16/09/2013
  • 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

    John Ellis

    15/09/2013
  • 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.
     

    John Ellis

    26/08/2013
  • 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

    John Ellis

    26/08/2013
Previous Page
1 2 3 4 5
Next Page
GDPR – Legal – Contact Us

Website Created By Wellis Technology and Powered by WordPress