Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27349

VS 2013 Classes and Object - The Emperor's New Clothes?

$
0
0
:confused:Are classes and objects just a modern version of the emperor's new clothes?

I learnt to program many, many years ago and, although I have been slowly prodded and shoved towards new developments, I have avoided the chatter and discussions about using classes - now I'm bored and want to stretch my brain cells a little.

So I looked at these classes thingies and they seem to be a waste of time and totally pointless, writing more than twice the amount of code to achieve the same thing. Having, almost, completed a project using XML files, which are a great invention, I would like to try and get to grips with using classes instead. Hopefully this way I might come to appreciate what so many of you out there find interesting or useful about classes.

At the moment I have a windows form with some controls placed on it or generated through code. If I wish to find a piece of information in the xml file I create a filestream or XMLReader run through the nodes and check the inner.text value of each relevant node. If I find the search for information I can copy the info to the different variables ready for processing.

It would seem, from what I have read that in order to use classes I would have to:
  1. Write a class for one record
  2. Declare each variable
  3. Write out a property statement for each variable
  4. Include and Get statement
  5. Include a Set statement
  6. Put all the functions I have in my original code into the Class - doh!
  7. Then go back to the button on my form and write out a similar amount of code in order to use the class I have just created
  8. Why?


A few years ago whilst writing a very large application I created a public function and contained all my reusable code for functions. It worked and used a lot less coding time. So can anyone persuade me that using classes is good for me - please?

If, after reading this, you are saying to yourself, this is an idiot who doesn't know what he is missing out on, then you are probably right! But I would still like to know what it is I am missing.

Penfound

Viewing all articles
Browse latest Browse all 27349

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>