|
![](/i/fill.gif) |
nemesis <nam### [at] gmail com> wrote:
> Warp escreveu:
> > nemesis <nam### [at] gmail com> wrote:
> > No, data hiding is seen as "limited" by self-taught hackers who don't
> > know jack s**t about programming. Those people just can't understand what's
> > the idea, and want everything to be accessible.
> It's not because it's accessible that it is going to be used.
Yeah, sure. If you are the *only* person making the entire program, then
perhaps that might be the case.
> It is
> only accessible because the implementation didn't care to bother putting
> loads of chains and belts and bureaucratic measures that are there only
> for the sake of bad programmers who can't understand the concept of
> interfaces and have to have their knees broken so they can't jump the fence.
So in your opinion the concept of "interface" is a verbal agreement about
what should and shouldn't be used from a module? *That* is what sounds like
bureaucracy to me.
And why is a verbal agreement better than telling the compiler about the
interface?
> For people who know it better, the lack of such measure does not mean
> irrestrict access to things, it simply means less stupid typing to make
> the compiler happy. Modularity is conserved.
In Utopia, maybe. In the read world, not so.
And I don't consider having to write "private:" once to be significantly
more typing. If I had to document what you should and should not access
in the module, *that* would be significantly more typing. And the kind of
text which most people will not read anyways.
> > I enjoy being able to create modules which I can safely improve later
> > without the fear of breaking existing code.
> Why would you fear breaking your own modular code with clear interface?
Maybe you, Mr. Perfect, never make mistakes. I like the compiler telling
me possible mistakes, especially since telling the compiler what the interface
of my module is, is rather simple.
Also, if I make a module for others to use, how can I guarantee that
I can change the implementation later without breaking code others have
written? There are two options:
1) I write "private:" once in my class definition.
2) I write extensive documentation about the subject and hope people will
read it and obey it. Many people won't.
Which one of these two options is easier and less trouble?
> > Increased productivity... until the day that you actually need to heavily
> > change some module because of new requirements or improvements, and you end
> > up breaking thousands of lines of code which are carelessly using public
> > members as they please.
> It's all about scope. If it's public, it should be used. If it's not,
> you shouldn't.
And what's wrong with the compiler telling you if you try to use it
regardless? I really can't understand that.
The compiler is not limiting anything that you aren't *already* limiting
by your verbal agreement. The only thing the compiler is doing is checking
that the agreement is not broken. Why that is a bad thing is beyond my
comprehension.
--
- Warp
Post a reply to this message
|
![](/i/fill.gif) |