Live data from Hacker News

Wikileaks To Leak 5000 Open Source Java Projects

steve-yegge.blogspot.com

51–60 of 140 posts

Re: Wikileaks To Leak 5000 Open Source Java Projects

#51

Can someone please explain what this means to people not familiar with Java? I'm confused because I thought open source meant open source, as in "all of the source-code is available." What does 'open source' mean in this context, if not "open'??? When I read the title I thought it was a joke. Thanks and sorry for my ignorance, I'm a lowly perl hacker.

A big part of OO languages is encapsulation. Private fields encapsulate state and private methods encapsulate implementation details. The intention there is to make the code more robust to restrict the way collaborating classes can interact with it.

Example, if you have a type representing a game score, you may want to implement a public Increment() method instead of letting other types access the score value directly.

The author of the post is pointing out the irony of people saying "this code is totally open" yet forcing you, ostensibly for your own good, to interact with it in a prescriptive way.

Re: Wikileaks To Leak 5000 Open Source Java Projects

#52
post #27
post #21

Earlier quoted context omitted.

Encapsulation is completely orthogonal to access modifiers.

Your view differs from some of the OO language designers. For example, Stroustrup defines encapsulation as "the enforcement of abstraction by mechanisms that prevent access to implementation details of an object or a group of objects except through a well-defined interface. C++ enforces encapsulation of private and proteced members of a class..." http://www2.research.att.com/~bs/glossary.html#Gencapsulatio... Since t…

Every useful software engineering term is actually undefined, until you define it for the purpose of some discussion. Encapsulation, strong typing, object orientation, you name it, it's undefined. By undefined I do not mean "completely without meaning", but that the term is used so many ways that the information content of pointing at something and calling it "encapsulation" is actually very low.

Some OO traditions choose to combine encapsulation with language-enforced access control. Some schools then teach that if you don't have enforced access control, you don't have encapsulation. They're right... by their definition. They are not right by all definitions. If you don't lay out the definitions you are using when you explain whether one is necessary to the other, you're just making undefined statements. And usually one will be related to the other by definition, which means the other basic alternative is to make a vacuous argument.

I say that like a lot of other things that are mistaken as language features, encapsulation is an attribute of the program, not the language. Encapsulation is when there is a clear boundary of code that accesses a certain data structure. I have seen many C programs that have perfectly well encapsulated data structures, despite the lack of language support for access control enforcement. But that's just my definition. It is not the definition.

Re: Wikileaks To Leak 5000 Open Source Java Projects

#53

Can someone please explain what this means to people not familiar with Java? I'm confused because I thought open source meant open source, as in "all of the source-code is available." What does 'open source' mean in this context, if not "open'??? When I read the title I thought it was a joke. Thanks and sorry for my ignorance, I'm a lowly perl hacker.

A big part of OO languages is encapsulation. Private fields encapsulate state and private methods encapsulate implementation details. The intention there is to make the code more robust to restrict the way collaborating classes can interact with it. Example, if you have a type representing a game score, you may want to implement a public Increment() method instead of letting other types access the score value directl…

Thanks for the response, but can you not see the source code of these private methods? And wouldn't that allow you to re-write them yourself to behave however you want?

Re: Wikileaks To Leak 5000 Open Source Java Projects

#54
post #50
post #48

Clojure has tools to make it easy to bypass private/protected : http://richhickey.github.com/clojure-contrib/java-utils-api....

Granted it's just using Java calls (no magic), but still fun.

Are those called wall-hack for the reason I think they are? If so, awesome.

Re: Wikileaks To Leak 5000 Open Source Java Projects

#55

Earlier quoted context omitted.

A big part of OO languages is encapsulation. Private fields encapsulate state and private methods encapsulate implementation details. The intention there is to make the code more robust to restrict the way collaborating classes can interact with it. Example, if you have a type representing a game score, you may want to implement a public Increment() method instead of letting other types access the score value directl…

Thanks for the response, but can you not see the source code of these private methods? And wouldn't that allow you to re-write them yourself to behave however you want?

Yes.

If you over-analyze the joke too much it becomes less fun :)

Re: Wikileaks To Leak 5000 Open Source Java Projects

#56

Earlier quoted context omitted.

If the language isn't enforcing the encapsulation, how is it encapsulated? For me, encapsulation comes down to "What I hide, I can change. What I expose, other types may couple to in an inappropriate way."

Most dynamic languages use convention, which seems to work pretty well in practice. My take is that if other developers are accessing the encapsulated parts of your library, then your API or your documentation is broken - possibly both - and you should, like, fix that. Not use language features to lock them out.

One of the things that I have used access controls for is to simplify the exposed surface that collaborators work with. This isn't a condescending "I don't trust you" intention. It's more along the lines of "of all the types and methods here, you only need to know about this small subset". It's customer service, I tell ya!

And if the API isn't sufficient by not exposing enough, that's fine. It's always easier to expose something later than to make it private later.

Re: Wikileaks To Leak 5000 Open Source Java Projects

#57
post #25

Earlier quoted context omitted.

continued "fun" (read dangerous) redefines: #define true false #define false true #define true 0 #define false !true #define if while #define continue break :)

#define struct union

That is by far the evilest of the bunch. }:-D

Re: Wikileaks To Leak 5000 Open Source Java Projects

#58

"If I buy you a house and put the title in your name, but I mark some of the doors 'Employees Only', then you're not allowed to open those doors, even though it's your house. Because it's really my house, even though I gave it to you to live in." Love it!

This actually reminded me of Apple...
Post reply on HN