Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
*TRUE* OOP and Other Paradigms
#8
(04-03-2016, 09:24 PM)Someone else Wrote:  Setters are often a sign of a poorly designed interface, because values are usually related (length of a dynamic array is related to the data in the array), so allowing them to be modified in isolation can often cause bugs, and many properties that really can be changed in isolation are often set once when the object is created and then never changed again (color of a label for example), so allowing the value to be arbitrarily changed at runtime is a terrific way to waste memory.
I completely disagree. Setters are not often poor design. Sometimes they are, but it's rare and not hard to notice (like your length example). The real problem is public variables, they are head to head against encapsulation.
Also, your label color example is horrible. Why would I waste memory for assigning color a different value? Why on earth color of a label is not changed in runtime? And why should it be immutable?
Ultimately, my constant dissatisfaction with the way things are becomes the driving force behind everything I do.
[Image: sigline.png]
LF2 IDE - Advanced visual data changer featuring instant data loader
LF2 Sprite Sheet Generator - Template based sprite sheet generator based on Gad's method
[Image: sigline.png]
There is no perfect language, but C++ is the worst.
Reply
Thanks given by:


Messages In This Thread
*TRUE* OOP and Other Paradigms - by A-Man - 03-31-2016, 06:51 PM
RE: *TRUE* OOP and Other Paradigms - by Som1Lse - 04-02-2016, 04:05 PM
RE: *TRUE* OOP and Other Paradigms - by A-Man - 04-02-2016, 08:59 PM
RE: *TRUE* OOP and Other Paradigms - by A-Man - 04-03-2016, 08:37 PM
RE: *TRUE* OOP and Other Paradigms - by Som1Lse - 04-03-2016, 09:24 PM
RE: *TRUE* OOP and Other Paradigms - by NightmareX1337 - 04-04-2016, 03:54 PM
RE: *TRUE* OOP and Other Paradigms - by Som1Lse - 04-04-2016, 05:19 PM
RE: *TRUE* OOP and Other Paradigms - by A-Man - 04-04-2016, 06:25 PM
RE: *TRUE* OOP and Other Paradigms - by Som1Lse - 04-04-2016, 06:41 PM
RE: *TRUE* OOP and Other Paradigms - by ayalx - 04-04-2016, 07:37 PM



Users browsing this thread: 1 Guest(s)