12 ms·
Wikileaks To Leak 5000 Open Source Java Projects
- runT1ME 16y agoAhhh... That was the sigh of vindication after reading this post and confirming my opinion of Steve Yegge.
- deleted 16y ago[deleted]
- deleted 16y ago[deleted]
- lanstein 16y agoChrist, this guy never ceases to amaze. His talk at I/O a couple years ago was absolutely fantastic: http://www.youtube.com/watch?v=BttI-y9VzXQ http://www.youtube.com/watch?v=BttI-y9VzXQ
- moron4hire 16y agoOne of the points he makes is that VMs are obvious for the purpose of language interop. Seems like C and Lisp (and D, another language he mentions) have been interoperating with each other without a VM in common for quite a while.
- Goladus 16y agoBut it's not a many to many mapping, that's the point he was making. Lots of languages interop with C, but you can't just import a ruby module into a python script very easily. In fact if you want to link to C libraries from D you have to modify the C header files to turn them into D modules.
- moron4hire 16y agoSure, but it doesn't seem intractable to be able to design native languages to be able to interop. Lisp has been around since the late 50s, C since the 70s. The fact that they interop at all is kinda awesome.
- andrewf 16y agoI think Microsoft actually did a reasonable job with the "original" COM (ie OLE 2.0 - the stuff that let you put an Excel 95 spreadsheet into a Word 95 document). It had a bit too much bolted on, probably due to its origins in OLE, and I think "dynamic OLE" was a tragic mistake. And its reference counting approach was a lot more appropriate in the early 90s than it is today (where a compacting GC may be the smart choice, performance-wise). But for making calls between objects in C, C++, VB6, Delphi, and pretty much every other language that lived on the Windows platform, it worked really well.
- limmeau 16y agoFor a compacting GC, you'd have to hunt down a complete set of references from running programs written in unknown languages, with strange errors if the set is underapproximated even once. I'd rather have reference counting.
- nickik 16y agoIt works but it is WAY HARD. Interact from ruby to common lisp. On a VM its easy a call from Jruby to clojure is not to hard. Its stupid to implement your own GC with every knew language and there are way more things that every C-Based language has to reimplement. Thats why it always took around 10 years until a language got really good and fast. Today you can have a language in 2 years with the biggest set of libs out there.
- wglb 16y agoAwesome. Tweaks Java, Agile League of Agile Methodology Experts (LAME), Wikileaks, Oracle on one short non-steve-yegge-length post.
- aphyr 16y ago...run through a Perl script that removes all 'final' keywords except those required for hacking around the 15-year-old Java language's "fucking embarrassing lack of closures." This guy feels my pain! :)
- openfly 16y agogod help us all.
- robwgibbons 16y agoThis reads like an Onion article.
- pvg 16y agoModulo the funny.
- Eliezer 16y agoYou don't think the Onion is funny?
- infinite8s 16y agohe's saying this reads like the Onion without the funny.
- wzdd 16y agoIt's interesting to see how important compiler-enforced access specifiers were to C++ and Java. It seems they are going out of fashion. In the Python world they were always considered a bit silly.
- sliverstorm 16y agoThe languages have fundamentally different goals. If you explained Unix file permissions to a Windows guy, he'd probably think it was silly. They exist for a purpose though- just not a purpose the Windows guy has spent much time with.
- chrisduesing 16y agoPersonally I would prefer a script that made all variables private and removed setters, but I suppose that would be more useful than funny.
- malkia 16y agoIn a global header long time ago, a friend of mine (and big "C" lover) did this to his best buddy once (a C++ and especially boost lover): #define class struct #define private public #define protected public
- jmatt 16y agocontinued "fun" (read dangerous) redefines: #define true false #define false true #define true 0 #define false !true #define if while #define continue break :)
- chaosgame 16y ago#define struct union
- moultano 16y agoThat is by far the evilest of the bunch. }:-D
- shasta 16y ago#define true false #define false true Did you know that if you do both of those, they cancel each other out? True story.
- troels 16y agoMy head hurts. Explanation, please?
- malkia 16y agoDunno about explanation, but experiment shows it to work at least with two preprocessors - Microsoft's and GCC: First make a file a.c that has in it: #define true false #define false true int A = true; int B = false; then from the command line, do (with the Microsoft compiler): D:\>cl -E a.c int A = true; int B = false; Now with gcc (I'm using cygwin's gcc): D:\>sh -c "gcc -E a.c" int A = true; int B = false; I've stripped the other stuff.
- mmaunder 16y ago"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!
- raquo 16y agoYeah, it's fine for our software but not their music
- angusgr 16y agoIs open source music a particularly big phenomenon?
- deleted 16y ago[deleted]
- angusgr 16y agoAs far as I know, sheet music is usually licensed under traditional copyright and remixing/sampling is usually licensed under fairly complicated closed licensing terms, for the cases where samples & remixes are cleared legitimately. Creative Commons licensing of sheet music & samples would count, but I don't think that's what the parent comment was alluding to - it was a misunderstanding between the concept of "open sourcing" something and the concept of licensing it from the author under more restrictive traditional copyright terms. Wow, this is a lot less snappy when you have to spell it out.
- raquo 16y agoOpen-source is irrelevant here. It's (1) "I own this copy of music/software and can do anything I wish with it" vs (2) "I licensed this copy of music/software from you on the terms we have agreed on, and I will adhere to these terms". Both music and software are usually licensed (2), but people often disrespect music license thinking they are entitled to more rights for some reason.
- spivey 16y agoI sympathize, yet encapsulation is appropriate for some projects. Not all users of a library want to frequently update to their own code. Forbidding encapsulation and deprecation would increase this cost. Also, it's comforting to be able to refactor the guts of a class without harming users.
- j_baker 16y agoThe issue is less about encapsulation and more about language-enforced encapsulation. Encapsulation is good, but encapsulation that's enforced by the language is debatable.
- MartinCron 16y agoIf 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."
- anthonyb 16y agoMost 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.
- MartinCron 16y agoOne 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.
- deleted 16y ago[deleted]
- alextgordon 16y agoEasy. Because I'm laughing at it.
- TeHCrAzY 16y agoDoes Java have something similar to .Net's reflection?
- jackowayed 16y agoI'm not sure how .NET's reflection works, but it does have reflection, where you can say stuff like "tell me all of String's methods" and for each of those you can find out public vs private vs protected, final vs not, etc. See http://download-llnw.oracle.com/javase/1.3/docs/api/java/lang/reflect/package-summary.html http://download-llnw.oracle.com/javase/1.3/docs/api/java/lan...
- TeHCrAzY 16y agoIt looks very similar, albeit a bit tidier than .net's implementation.
- wmf 16y agoConsidering the history, don't you mean "Does .NET have something similar to Java's reflection?"
- TeHCrAzY 16y agoNo, if I meant that, I would have written that. I know much about .net, and not a great deal about java.
- JeremyBanks 16y agoI don't understand the up-votes on this. He asked a reasonable question and phrased it with respect to his knowledge base. Your reply assumes he knows the answer to the question he's asking. Huh?
- wmf 16y agoMy comment was a joke. (Which I thought appropriate given the root of this thread.)
- 16y ago
- matrix 16y agoI like it, but making fun of Java (and Java's "thought leaders") is just too easy. It's like shooting fish in a barrel. With a grenade launcher. Eclipse is another matter: far more ridicule is called for. Far, far more.
- ckuehne 16y agoExactly: Or Smalltalk or Ruby for that matter, which both facilitate information hiding via private access. It's great to feel superior, isn't it?
- mxavier 16y agoYeah except in Ruby (I don't know about smalltalk) private access has the loophole of the send method. FreeHouse.send(:open_employees_only_door) Matz would never deny us of our right to snoop around where we don't belong.
- jamesshamenski 16y agoThis is the best thing to happen to Java. Hopefully, this gives that community a ladder to catch up to the innovation around true open source communities.
- angusgr 16y agoThe doubly great thing about this article is that maybe Steve Yegge will start blogging again. :)
- deleted 16y ago[deleted]
- nickik 16y agohe already said that he will start blogging again in a blog post like 2 -3 weeks back.
- sprout 16y agoFor a second I was actually hoping someone leaked Google's internal stack and all of it was GPL.
- infinite8s 16y agoEven if it was GPL, it doesn't mean they would have to give anyone the source code.
- tamersalama 16y ago"and turns all fields without getters/setters into public fields." Why not all fields perid. Even those with getters,setter?
- deleted 16y ago[deleted]
- afhof 16y agoFirst note: I have never dealt with the internal workings of the Java VM, so this is just speculation. I also haven't tested any of this, but its still fun to speculate. In java private variables and functions are not accessible from outside the class. This means that the compiler would be able to make some assumptions about the nature of these members in the effect of optimization. When calling a public function of another class in java, I suspect that the name of the function is mapped to the actual bytecode at invocation time after being looked up in some sort of trie/tree/hashtable. So, for every function call or varaible access, there would have to be a lookup. On the other hand, if the members were declared private, the compiler could directly link a caller to the function and skip the lookup. If this is the case, then setting all these projects' sources to use only public would mean a substantial performance loss. I would love to be corrected if this is not the case, as I haven't taken a course in OO compilers yet.
- SoftwareMaven 16y agoAll Java method calls use the virtual function table, if for no other reason than to be able to throw a "MethodNotImplementedException" (or whatever the actual exception is, can't remember now). You can also inject code into the call stack using aspect programming.
- ewjordan 16y agoIn java private variables and functions are not accessible from outside the class. Not quite - using reflection you can dig into private fields and do your worst to them, you just need to tag each private member's Field object with with field.setAccessible(true) before accessing it reflectively. The only hitch is that you might get a SecurityException, but you can avoid that if you're running your code on your own JVM (by default, it should work just fine, it's if you're deploying applets or something like that where you might get the exception due to the different sandboxing rules).
- roadnottaken 16y agoCan 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.
- MartinCron 16y agoA 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.
- roadnottaken 16y agoThanks 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?
- brown9-2 16y agoYes. If you over-analyze the joke too much it becomes less fun :)
- shasta 16y agoI agree, this is a worrying possibility. Luckily, with a good reflection library, you can have other obfuscated parts of the code that check for such malicious tampering and abort.
- mechanical_fish 16y agoA sign of experience with open source: You become incredibly reluctant to hack directly on the source of a popular library. With great power comes great responsibility. In Drupal, for example, there is a saying: "every time you hack core (or a module you didn't write) god kills a kitten." In the spirit of open source, we probably borrowed that saying from some earlier project, because it is generally true. The standard Java String library is the same for everyone. [1] If you download Random Java Library X, and X works with the String library, you can probably be assured that X has been tested with the standard String library. As soon as you change one line of the library this is no longer the case. You must now face the possibility that your "minor" change will lead to side effects when combined with other things, and the responsibility for finding those side effects is now entirely yours. Plus, the sheer mechanical tedium of preserving your patch, making sure to apply it to every new version of the library as it comes out, relearning how the patch works every few months, porting the patch when it fails to apply cleanly to a new version, figuring out how to distribute your personalized package to others because they can no longer simply `apt-get` your package from the canonical repository, dealing with the fact that the standard docs and the published books might not cover your variation... Tools like Github have made all this stuff much easier, but it's still a bad idea to tinker with others' libraries without a good reason. The more typical advantage of open source is that you can read exactly what your library is doing, which makes it easier to figure out how to work around it without actually editing it. --- [1] Until it isn't. But at that point it will generally get a different version number, and an official release notice, and it will have a community that is aware of the change and will promptly coordinate to find and fix any new incompatibilities with other libraries.
- arohner 16y agoClojure has tools to make it easy to bypass private/protected : http://richhickey.github.com/clojure-contrib/java-utils-api.html#clojure.contrib.java-utils/wall-hack-method http://richhickey.github.com/clojure-contrib/java-utils-api....
- fogus 16y agoGranted it's just using Java calls (no magic), but still fun.
- bretthoerner 16y agoAre those called wall-hack for the reason I think they are? If so, awesome.
- dedward 16y agoIt's a spoof alrticle -a joke - and "private" and "protected" were never about the legality of letting other parties access things - they were just conveniences for the developers and the tools to make it clear what could be optimized how, and what should and should talk to what.
- bretthoerner 16y agoHm? I was referring to the Clojure link in the comment above. (And they're the functions linked are no joke)
- deleted 16y ago[deleted]
- joegaudet 16y ago"If I make something private, it means that no matter how desperately you need to call it, I should be able to prevent you from doing so, even long after I've gone to the grave." I am pretty sure this can be defeated without taking private out. Reflection will get you there with the security checking turned off.
- lanstein 16y agoIt wasn't until I re-read this that I noticed the two fake 'more news' entries.
- deleted 16y ago[deleted]
- eneveu 16y agoSome context: WalterGR commented on reddit that this rant is actually in response to this tweet by Marco Tabini: ------------------------- "@ijansch Private has absolutely no useful role in open-source code." ( http://twitter.com/mtabini/status/18867470296 http://twitter.com/mtabini/status/18867470296 ) ------------------------- Marco is the co-founder of "a consulting firm that specializes in information architecture, code and security auditing, large-scale deployments and optimization". More information: http://www.reddit.com/r/programming/comments/cusyw/wikileaks_to_leak_5000_open_source_java_projects/c0vfj1w http://www.reddit.com/r/programming/comments/cusyw/wikileaks...
- Zarkonnen 16y agoThis reads to me as "let's make all state mutable and remove all indication as to which bits of the code are the interface, and which are implementation details". I like immutability and minimal interfaces, they make it easier to reason about what the code will do, freeing brain cycles to work on more interesting things than "but what if someone modifies foo between invocations of bar". If you need access to a library's private or final fields, the library API is badly designed. Or, if you're that keen on wanting to change how the library works, fork it. That's kind of the point of open source.
- dustrider 16y agoI can't decide whether this is serious or not. Don't doubt the actual wikileaks announcement just the comments from the various sources seem too funny to be true. favorite: "But use it exactly how I tell you to use it, because fuck you, it's my code. I'll decide who's the goddamn grown-up around here."
- infinite8s 16y agoReally? Why would wikileaks care about the source to open-source java applications
- Tichy 16y agoI have to say, for me private methods and fields are not a security thing. They are a way to keep the public interface clean and only confront the user with the information they need.
- someone_here 16y agoAnd that's the problem.
- Tichy 16y agoWhy? It conveys a piece of information. Would you feel better about it if instead of writing "private" in front of it, I would write a comment "it is probably a bad idea to use this method in your own code"? What would be the gain - it is simply more verbose?
- uxp 16y agoThere is no reason to use a private/protected method. If the library/class you are using doesn't fulfill the qualifications you want, expand the library, not the code that uses the library.
- snorkel 16y agoNot just for cleanliness but more importantly change protection: denying direct access to the internals assures that you can rewrite those internals and not break any external dependencies.
- yason 16y agoI thought Java had interfaces for public APIs?
- NewSoftzzz 16y agoIf you really try to make the OO as beautiful as humanly possible, you neither make the member variables public nor do you offer getters and setters. Everything is realized by functions which have a meaning, you really give the class the power to manage itself, not be managed from the outside with getters and setters! If you successfully adopt this thinking pattern then you have so many problems less...
- seis6 16y agoI think this could be a good example for making a program that creates jokes for programmers. In essence, substitute words Goverment => Java Privacy => Private Method Public Alarm => ...