: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:
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
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:
- Write a class for one record
- Declare each variable
- Write out a property statement for each variable
- Include and Get statement
- Include a Set statement
- Put all the functions I have in my original code into the Class - doh!
- 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
- 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