degausser wrote: |
---|
.... when we first started going over getters/setters ..... |
I think it is a shame that your prof 'taught' you all set functions - even as an introductory idea. Hopefully everyone agrees that they are appallingly bad. Much better IMO to emphasise not to do it, and promote constructors instead. Of course there is a difference between the naive ones which are straight assignment, as opposed to Update functions which have checking & validation in them. If you have a bit of spare time It may be worth your while to read all of the Topic I made about get / set functions (The link I gave above)
degausser wrote: |
---|
..... but my next class is Data Structures and I'm assuming we'll be covering the topics you guys brought up then? |
Not necessarily, and this is why I think it's a good idea to mention things early - who knows how long you may have continued with a bad practice?
Data Structure courses tend to talk about more efficient ways to store data like linked lists & trees etc - they probably won't deal with get / set functions.
It looks as though you have been taught about constructors (you have a couple of them in your classes) - I am just saying use them more (that is use them to initialise ALL the member variables), rather than the set functions. Even without the idea of initialiser lists, that is way better than set functions.
Maybe they taught the get / set functions, then at some stage about constructors - but the connection wasn't made about using constructors instead of set functions. It happens quite easily - there is lots of info presented in lectures and tutors aren't always the most helpful (In my experience)- they tend to react to what questions are asked, rather than try to pre-empt bad ideas.
@Andy
I just saw your last post.
I agree with you about the pace and order of learning.
andywestken wrote: |
---|
Learning ideas as early as possible is good. But I've also come across the notion that you can only (really) learn so many on each step; so you should focus on a limited number of ideas at a time, getting to really know them, before moving on. |
Ok, I see what you are saying, but I don't think my suggestions were that tough - and I suspect the constructor stuff had been taught - and that was really the main problem.
andywestken wrote: |
---|
There are structural issues with degausser's code that, when repaired, would lead to elimination of most--but not all--of the setters. |
I guess you mean the part of encapsulation that means that all the code to do with an object should be in the object. It is ideas like this which are gold IMO, but you are right - how much info should the Lecturer throw at these guys?
Any way I suppose it gets down to how much info the OP is willing to soak up! Hopefully degausser has some spare time before the next semester.