Archive for the 'Visual Studio' Category

Visual Studio 2008 UK Launch Event

I’m now registered to attened the UK launch event for Visual Studio 2008 which is happening at the ICC in Birmingham on the 19th March.

There are two tracks for this event the IT pro track and the developer track, make sure you register the right track as you cannot change this after.

You can read more about the events over at http://www.microsoft.com/uk/heroeshappenhere/default.mspx

And you can register yourself here https://msevents.microsoft.com/cui/EventDetail.aspx?culture=en-GB&eventid=1032366502

Should be a good event, will definately feed back on how it went.

DDD5 at Microsoft TVP Reading

Yesterday I traveled to Microsoft’s campus in Reading for the fifth Developer Day event and I must say I was very impressed with the presentations and the organisation of the whole thing.

The first presentation I attended was IIS7 for ASP.Net developers. IIS7 as the presenter Andrew Westgarth said is definitely the most significant release since version 1.0 and really puts the power of the Microsoft web server in the .Net developers hands. It’s highly customizable with .Net, gets rid of the need for writing ISAPI filters and falls in line with the .Net configuration model utilizing XML configuration files extensively. Also as Andrew pointed out it’s the first time the version of IIS is the same on the desktop as it is on the server, so you get the same features on Vista as you would on Server 2008. The only restriction on Vista is a maximum of 10 simultaneous requests, which nobody doing development should ever notice.

The second presentation I attended was Visual Studio 2005 IDE Tips and Tricks presented by Guy Smith-Ferrier. I wanted to attended this because I always say to myself I’m going to learn the short cuts in VS and never get round to actually doing it so this presentation gave me alot of pointers that I could go away and use in my daily work and hopefully improve my productivity. There was alot stuff that I already knew which was inevitable but I got a good few gems out of it which is what I was looking for.

Now the third presentation was An Appraisal of Object Thinking which was presented by Alan Dean. The presentation was essentially talking about the concepts outlined in the MS Press book Object Thinking. The author of the book is basically saying that our formalized perception of Object Oriented Programming is not how the founders of the term OOP intended for it to be used. I won’t go into detail of the concept as you can always buy the book or check Alan’s blog for the presentation slides but I did eventually come round to the new way of thinking and can actually see the benefits it would bring. The only thing is that everyone you are collaborating with on a programming project would also have to buy into the concept and that wouldn’t be an easy thing to do, as it’s hard to change people ways but none the less it was good to get another perspective on OOP as we all nowdays take the concept for granted and we all conform to the standard way of developing objects.

The last presentation I attended was Agile Methods for ISV’s presented by Gary Short. Gary’s presentation was very good and he has a good way of getting his point accross and was very humorous so I did actually enjoy the presentation alot. Gary basically outlined the pro’s and con’s of implementing an agile methodology in ISV’s and Enterprise’s.

I didn’t attained the last presentation as I had to shoot off but would just like to say thanks to the organizers and the presenters on the day who did a fantastic job and can’t wait for the next installment keep up the good work.

Refactoring with Visual Studio 2005 - Encapsulate Field

One of the basic principles of object oriented programming is ‘Encapsulation’, and to me one of the fundamental ways to acheive encapsulation when creating classes is to only allow access to it’s private members through public accessor methods.

For example using C# I create the following class:

public class LeeClass

    {

        public String _name;

    }

 

 

The problem with this code is it directly exposes the classes data to the outside world and this breaks the encapsulation rules of OOP.

What we need to do to allow the outside world access to this variable is define a public accessor method which effectively ‘encapsulates’ the variable.

We can code this by hand but Visual Studio provides you with a handy refactoring function that handles all the work for you.

Do the following

Right click on the _name variable and select Refactor -> Encapsulate Field as show below.

Refactoring - Encapsulate Field

You will now be presented with a dialog box which allows you to give your new method a name.  You can also from here select the ‘External’ option in the ‘Update References’ option group which will update all references to your variable to point to your new accessor method.

You show now have a class that looks like this

public class LeeClass

    {

        private String _name;

 

        public String Name

        {

            get { return _name; }

            set { _name = value; }

        }

    }

 

 

Notice how Visual Studio changes your publicly exposed variable to private and inserts get/set methods to access it.

 

You now have a class that conforms to the encapsulation principle of object oriented programming.

Next Page »


A Thousand Threads Logo
View Lee Dale's profile on LinkedIn

    Archives