10 ms·
Which part of the Java experience did you hate? 1. Java the language? It has abominable syntax and execrable semantics. Clojure fixes this; interop makes even
by gcv 16y ago
Which part of the Java experience did you hate?
1. Java the language? It has abominable syntax and execrable semantics. Clojure fixes this; interop makes even strongly Java-flavored code tolerable. With Clojure, even Swing sucks less.
2. The JVM? Honestly, the JVM is rather nice. Except for the startup time, it's refreshingly fast. With Clojure, you don't really need to restart the JVM very often.
3. Learning about the classpath? It's no worse than PYTHONPATH or GEM_PATH, and far more self-contained by default. This makes deployment much easier. Yes, you have to understand it up-front, but what is difficult about it? It's a list of libraries your app depends on. Clojure is one of those libraries. Unless you need to compile your Clojure code into .class files, that's it.
4. Ant? It's a poorly-designed monstrosity with horrific XML syntax. Don't use it. You don't need it.
5. Maven? Yes, it's a beast, and unfortunately, you need it. Luckily, the latest version of Leiningen wraps it very nicely, so you don't need to learn the details. You also don't need to look at its XML. You just make a project.clj file, put in your dependencies, and run "lein repl".
- deleted 16y ago[deleted]
- qjz 16y agoThe JVM requires unexpected tweaks. It's surprising to discover that it doesn't use the time zone files provided by the OS, or that it might not use the available memory on your awesome new server. It's scary to realize that a lot of applications are deployed and certified to run only on a specific JVM version, and that getting security/bugfix updates for that version will get increasingly harder as time goes by. Before long, you have a proliferation of different JVMs that all need to be maintained, along with the host OS itself. These problems are acute with Java, compared to other languages, at least where the n00b is concerned.
- gcv 16y agoBy "specific JVM version", do you mean a major release version, such as 1.3, 1.4, 5, and 6? Or do you mean 1.6.0_20? While Java code is generally not backwards compatible, it is typically forward-compatible. Most 1.4 programs run fine on JVM 6. In fact, I don't think I've ever seen one that doesn't — but I'll take your word that they exist. Personally, I've had more trouble with OS distributions shipping Python 2.3, 2.4, 2.5, 2.6, 2.7, and 3.0. I've also had trouble with Ruby 1.8.6, 1.8.7, and 1.9.x. JVM applications have generally just worked for me, regardless of platform version number. In any case, applications being certified to run on a particular platform is hardly unique to Java. Any application whose vendor wants to reduce support load will be certified for a particular set of supported platforms. The situation is hardly better in C, with versioned .so objects and incompatible libc implementations. Back on topic: I somehow doubt that these questions seriously turn off beginners thinking about learning Clojure.
- qjz 16y agoIn general, I mean the major release version, although I have seen applications pinned to a specific minor release because an update introduces a critical bug (which is especially frustrating when you want the update for security reasons). I'm not a beginner programmer, but I avoid languages built on Java or .NET for these reasons, among others.
- joe_the_user 16y agoWell, I know with Scala, the claim is "improved syntax" but the actual code I've seen is an abominable concatenation of colons and stuff to make the horrible Java stuff less horrible - but only relative to Java. If Clojure can stand on its own, it could be nicer. But if its a push-me/pull-you language that's a half-breed of another, horrible language, it is just not appealing.
- gcv 16y agoJudging by your comment, you have not actually looked at Clojure. I'll assume from your karma score that you aren't just a troll, and respond. 1. Clojure and Scala have nothing in common with regard to syntax or language semantics. Clojure is a parenthesized, fully-prefix notation dynamically-typed language from the Lisp family. Scala is an infix object-based language with a tremendously complex static type system. 2. Clojure stands on its own well enough. It has a maturing CLR implementation. In the future, it will be reimplemented in itself, which will permit simpler implementations on platforms such as, e.g., LLVM. Google for Clojure-in-Clojure. 3. You can write plenty of Clojure code without touching Java interoperability at all. It all depends on your problem domain. The code will not look anything like Java.
- joe_the_user 16y agoThank you...
- jshen 16y ago"t's no worse than PYTHONPATH or GEM_PATH, and far more self-contained by default." Yes it is worse. ruby is far easier to start with. $ gem install json $ irb ruby-1.9.1-p378 > require 'rubygems' => false ruby-1.9.1-p378 > require 'json' => true ruby-1.9.1-p378 > JSON.parse({'1' => '2'}.to_json) => {"1"=>"2"}
- gcv 16y ago$ lein new myproj Created new project in: myproj $ cd myproj $ lein deps [copy] Copying 2 files to myproj/lib $ lein repl Clojure 1.1.0 user=> (use 'clojure.contrib.json.read 'clojure.contrib.json.write) nil user=> (read-json (json-str {"1" "2"})) {"1" "2"} I admit I cheated a bit: clojure-contrib comes with a JSON parser, and lein automatically includes a dependency on clojure-contrib. If I needed a different library, I'd have edited project.clj to include the dependency.
- technomancy 16y agoThe main difference is that you can modify your $LOAD_PATH at runtime in Ruby, while on the JVM it's fixed at startup. This is particularly ironic because it's a cultural norm in the Ruby community to launch lots and lots of short-lived ruby processes to run your tests, while in Lisp-land it's much more common to have very long-running repl sessions with uptimes often lasting in the days range.
- weavejester 16y agoYou could put a temporary directory on your class path, and then unzip any jars into it. You could then reload Clojure source files, although I'm not sure if you'd be able to do anything about Java class files without a custom class loader.
- thangalin 16y agoThe CLASSPATH can be modified at runtime by writing custom class loaders. It isn't trivial, but it is possible. I had to do it to implement Hierarchy: http://www.whitemagicsoftware.com/software/java/hierarchy/ http://www.whitemagicsoftware.com/software/java/hierarchy/
- mechanical_fish 16y agoThe part of Java that I hate is having to read a whole lot of documentation about features and libraries that I do not want to use, and will strive not to use, and that I may not even have to use, and that the best critics agree are ugly as sin and overdesigned and counterproductive, but which I still need to understand because they're the standards. I don't want "alternatives" to Ant and Maven and Swing. I do not want to have to know what Ant, Maven, or Swing are. If they are so terrible why are they still around? Can't we throw them away? Well, no. We can't. Java is mature. You cannot throw anything away because existing libraries and codebases have dependencies on the old stuff. And you cannot throw away the existing libraries and codebases because they are why you are using Java in the first place; the language's maturity is its strength, perhaps its only remaining strength now that other languages are targeting the JVM. So you can only bolt more stuff on. Which just makes the whole edifice even larger. If Clojure is forever tied to Java then I don't think it will ever be friendly for newbs, because I don't think Java is very friendly for newbs. ;) And if Clojure is nearly independent of Java -- and some of the comments here give me renewed hope that this is the case -- my advice would be to forget about advertising it to newbs for the time being. Get the Java out. Get it all out. Until you can write a book, akin to the Pickaxe book for Ruby, which teaches a newbie programmer all about Clojure and never mentions Java at all. Then sell me that book.
- fauigerzigerk 16y agoI share your sentiment to a degree, but you could say something similar about Python and its C/Unix roots. Not everything in the Python API is pretty or consistent and throwing everything out once in a while definately has advantages. But it also means you're losing a huge potential constituency. More importantly, the constituency loses a potential language. Some people must be compatible with the enterprise to do their work but don't want to use Java the language. In any event, there are things that could and should simply be scrapped. I dont' see why maven is an integral part of the Java platform for instance. Maven is actually a very depressing example because it shows that the complexity culture of Java isn't limited to the bureaucratic enterprise types who gave us J2EE.
- edu 16y ago
- Raphael_Amiard 16y agoThe part of java i DO hate in relation to this discussion about clojure is the very poor integration into the underlying operating system, be it windows or linux. You have no keys in hand way of configuring system wide libraries for example. A very simple example would be, let's say i want to open mp3 files and get their metadata, in python and in clojure, from a clean fresh ubuntu install : The python way of doing this would be: $ apt-get install python-mutagen $ python >>> import mutagen >>> (proceed) For clojure, i developped a whole website http://www.radiozerozero.com http://www.radiozerozero.com with clojure, and i wouldn't even know exactly where to start. It's totally dependent on your installation, whether you use emacs + swank-clojure, if you integrate with leiningen or not, etc. Granted if you are already fluent with leiningen and you know which library you're looking for, it could be fast. But that's the point, you have to KNOW what to look for and to know how to use it. Every programmer knows how to use apt-get. And if ubuntu doesn't have it, there is easy-install, with every python library you could possibly think of. And honestly that's why i use linux for development. I don't have to care about those things. Clojure is 10 times younger than python, and is very far from its level of stability, so it isn't a fair comparison. But when you start using clojure for real world projects, you'll have to do this comparison anyway.
- india 16y agoOh cool! Maybe you can help me here... The part I could not stand about java was getting tied up to an IDE. Every tutorial, book and "experienced" java programmer in college seemed to insist on one (mostly eclipse or netbeans). That just is a strcit no no for me. Btw, this is the same thing that's prevented me from getting on with the whole lisp family of languages. They all ask me to either work in some kind of a sandbox or learn emacs. I want to get started in a way that allows me to code and ship a hello world program in vim/notepad (ie in a n IDE independent fashion) from day zero. I can handle complexity and steep learning curves. I cannot handle not knowing and fully understanding whatever it is that the IDE is simplifying for me. And I don't want to be treated like a kid. Tell me how to get my hello world app into production the same way people shipping code in that language do as soon as possible. Is there any way for me to shed my java and lisp newbieness?
- aerique 16y agoI'm a Common Lisp (CL) zealot and use it through Emacs but I have always disagreed with the suggestion a lot of experienced Lispers make to newbies that to get started with CL you should use a commercial IDE, Emacs+Slime or at least some kind of Slime clone for Vim. I understand their reasoning but it is simply too big an obstacle if you just want to check a CL out. I do suggest picking a CL implementation with Readline support on the REPL and that usually means CLISP (http://www.clisp.org/ http://www.clisp.org/) since it offers just that on the most platforms without a hassle. Then you can just edit "whatever.lisp" in your favourite editor and go through the command history for reloading, evalling, etc. You can even skip the Readline support and pick other implementations and just start your script from the commandline. Just check the commandline options and CLISP even has #!/usr/bin/clisp (hashbang?) support. So you can do a hello world in an IDE independent fashion. Hope that helps, mail me otherwise :-)