??? 10/05/11 15:40 Read: times |
#184068 - not arguing that part Responding to: ???'s previous message |
Because the language strings are hidden inside a function, you add code that looks at a locale setting to switch language without the caller needing to know.
for that purpose they need not be 'hidden' only "declared only accessible through function call" rather than "accessible directly" And you can make use of this function from many places, while always knowing that there is a range check performed. Directly accessing the array means you are distributing the responsibility for such things into an unknown number of places. Not arguing that part; however, when discussed in a '51 forum the array should be 'code'. Encapsulation really is one of the cornerstones when discussing software design not really more like "Encapsulation really is one of the cornerstones when discussing software where you are protected against yourself and others working on the project." I can, to a large extent, agree with your points when discussing projects larger than you see implemented in a '51 e.g. in the current 512k ARM project with about 7 people working on ir there is much encapsulation (some done by me). Erik |
Topic | Author | Date |
Another static question... | 01/01/70 00:00 | |
WIthout Static In This Case | 01/01/70 00:00 | |
Thank you | 01/01/70 00:00 | |
It is worse than that | 01/01/70 00:00 | |
could add 'const' | 01/01/70 00:00 | |
That's the key! | 01/01/70 00:00 | |
Thanks Neil | 01/01/70 00:00 | |
True - but not quite the point here | 01/01/70 00:00 | |
isn't it explained in the book itself? | 01/01/70 00:00 | |
Yes, it is | 01/01/70 00:00 | |
Yes, but... | 01/01/70 00:00 | |
If the pupil does not understand... | 01/01/70 00:00 | |
In this instance... | 01/01/70 00:00 | |
That is why the call it learning. | 01/01/70 00:00 | |
isn't this just another example of .... | 01/01/70 00:00 | |
Information-hiding | 01/01/70 00:00 | |
not arguing that part | 01/01/70 00:00 | |
Not just protection. Also better overview (and reuse) | 01/01/70 00:00 |