I needed a quick and dirty way to see the class hierarchy and interface implementation of about 40 to 50 classes / interfaces in a small Java program. I didn’t need proper UML analysis / format or anything fancy.
So a quick Python script + Graphviz did the job.
Having contrasted Quora, positively with StackOverflow, I find that Quora is also starting to play the “word-shaping” game by which either an algorithm or a tone-deaf moderator decides to constrain how you are allowed to express your questions 🙁
No idea why they really feel the need to do this. But it basically has the effect of driving out all personal voice, subtle context to your question, potential for jokes, creative wordplay, malapropism, coining neologisms or anything else that keeps language alive and a delight for the intelligent mind.
Here’s my original (rejected) question :
Should I learn Clojure for Android programming?
I’d like to get into Android programming. But every time I play with it, I find it full of that verbose Java bureaucraticality that we all know and hate.
I’d like to work with a nice modern, higher-level language. (I’m mainly using CoffeeScript / Python these days) So, would it be worth me learning Clojure to do Android programming?
By this I mean two things :
– can you write Android apps. in Clojure at all (is the tooling there?)
– does Clojure buy you anything in the Android world? Or will I still be making the same long sequence of imperative calls to the same Java libraries that I’d be doing in Java? Ie. for this kind of application there isn’t much “compression” in Clojure compared to Java
I’m not saying this is a great question. Or perfect example of writing. But it is MY question, the way I wanted to phrase it.
Update : Got into a certain amount of argument about this. (Partly because I’m complaining.)
Here’s what I found myself replying :
If people prefer not to answer the question, that’s their prerogative. No problem.
The point is, is Quora going to set a “maximum sophistication” limit on questions, so that people who are capable of understanding a question that requires three paragraphs to capture its full meaning, are nevertheless prevented from writing or reading such questions because Quora has decided that only single-paragraph questions are allowed?
I think that will be a catastrophic loss. For me because I like Quora. And, I think for Quora, because it will become a less interesting place to be. I’ve already seen this happen on StackExchange. A place where I used to hang out every day, but where I now spend as little time as possible.
I’ve never had a good relationship with Java.
My first OO experience was with Smalltalk. And that spoiled me for the whole C++ / Java family of strongly typed, compiled OO languages.
Because I’d learned Smalltalk and this new fangled OO thing when it was still relatively new (in the sense of the late 80s!) I thought I had it sussed. But actually I had very little clue. I enthusiastically grabbed the first C++ compiler I could get my hands on and proceeded to spend 10 years writing dreadful programs in C++ and then Java. I had assumed that the OOness of both these languages made them as flexible as I remembered Smalltalk to be. I thought that OO was the reason for Smalltalk’s elegance and that C++ and Java automatically had the same magic.
Instead I created bloated frameworks of dozens of classes (down to ones handling tiny data fragments that would have been much better as structs or arrays). I wrote hugely brittle inheritance hierarchies. And then would spend 3 months having to rewrite half my classes, just to be able to pass another argument through a chain of proxies, or because somewhere in the depths of objects nested inside objects inside objects I found I needed a new argument to a constructor. The problem was, I was programming for scientific research and in industry but I hadn’t really been taught how to do this stuff in C++ or Java. I had no knowledge of the emerging Pattern movement. Terms like “dependency injection” probably hadn’t even been invented.
It wasn’t until the 2000s that I started to find and read a lot of discussions online about programming languages, their features, strength and weaknesses. And so I began my real education as a programmer. Before this, a lot of the concepts like static and dynamic typing were vague to me. I mean, I knew that some languages you had to declare variables with a type and in some you didn’t. But it never really occurred to me that this actually made a big difference to what it was like to USE a language. I just thought that it was a quirk of dialect and that good programmers took these things in their stride. I assumed that OO was a kind of step-change up from mere procedural languages, but the important point was the ability to define classes and make multiple instances of them. Polymorphism was a very hazy term. I had no real intuitions about how it related to types or how to use it to keep a design flexible.
Then, in 2002 I had a play with Python. And that turned my world upside-down.
For the first time, I fell in love with a programming language. (Or maybe the first time since Smalltalk, which was more of a crush).
Python made everything explicit. Suddenly it was clear what things like static vs. dynamic typing meant. That they were deep, crucial differences. With consequences. That the paraphernalia of OO were less important than all the other stuff. That the fussy bureaucracy of Java, the one class per file, the qualified names, the boilerplate, was not an inevitable price you had to pay to write serious code, but a horribly unnecessary burden.
Most of all, Python revealed to me the contingency of Java. In the small startup where I’d been working, I had argued vehemently against rewriting our working TCL code-base in Java just because Java was OO and TCL wasn’t. I thought this was a waste of our time and unnecessary extra work. I’d lost the argument, the rewrite had taken place, and I hated now having to do web-stuff with Java. Nevertheless, I still accepted the principle that Java was the official, “grown up” way to do this stuff. Of course you needed proper OO architecture to scale to larger services, to “the enterprise”. Ultimately the flexibility and convenience of mere “scripting” languages would have to be sacrificed in favour of discipline. (I just didn’t think we or our clients needed that kind of scaling yet.)
What Python showed me was we weren’t obliged to choose. That you could have “proper” OO, elegant, easy to read code, classes, namespaces, etc. which let you manage larger frameworks in a disciplined manner and yet have it in a language that was light-weight enough that you could write a three line program if that’s what you needed. Where you didn’t need an explicit compile phase. Or static typing. Or verbosity. Or qualified names. Or checked exceptions. What I realised was that Java was not the inevitable way to do things, but full of design decisions that were about disciplining rather than empowering the programmer.
And I couldn’t stomach it further. Within a few months of discovering Python I had quit my job. Every time I opened my machine and tried to look at a page of Java I felt literally nauseous. I couldn’t stand the difference between the power and excitement I felt writing my personal Python projects, and the frustration and stupidity I felt trying to make progress in Java. My tolerance for all Java’s irritations fell to zero. Failing to concentrate I would make hundreds of stupid errors : incompatible types, missing declarations or imports, forgetting the right arguments to send to library methods. Every time I had to recompile I would get bored and start surfing the web. My ability to move forward ground to a halt.
I was so fucking happy the day I finally stopped being a Java programmer.
1) Something I realized a while after my bad experience was how important the tools are. My period in Java hell was trying to write with Emacs on a small-screen laptop without any special Java tools (except basic Java syntax colouring). I realize this is far from the ideal condition to write Java and that those who are used to Eclipse or IntelliJ have a totally different experience and understanding of the language.
2) A few years later, I taught the OO course in the local university computer science department. All in Java. By that time, I’d read a couple of Pattern books. Read Kent Beck’s eXtreme Programming. Picked up some UML. And I had a much better idea what Polymorphism really means, how to use Interfaces to keep designs flexible, and why composition is better than inheritance. I tried to get the students to do a fair amount of thinking about and practising refactoring code, doing test driven development etc. It all seemed quite civilized, but I’m still happy I’m not writing Java every day.
3) A couple of years ago I did do quite a lot of Processing. I was very impressed how the people behind it managed to take a lot of the pain of Java away from novice programmers. I wonder how far their approach could be taken for other domains.
Answer : Yes. Quite a lot at the moment. Though it’s a bit all over the shop.
I’m dipping a toe into Android programming. (And, hmmm … Java …. I thought I’d got over my Java hangups by doing a lot of Processing, but it turns out that Processing just hides the crap and Android doesn’t. Why hasn’t Google picked up on Processing to turn it into a first-class Android art / game app. development environment?)
I’m mainly writing CoffeeScript. Some stuff related to my ongoing 3D modelling / desktop manufacturing projects. (Did I forget to mention those? I’m sure there’s a half-written blogpost somewhere.) Some work towards an SdiDesk-derived network diagramming plugin for Smallest Federated Wiki (held up by silly problems). Some other bits and pieces. I’ve recently been playing with Jison, which rocks. And I’m about to investigate angular.js which looks pretty good.
There’s a project for small stand-alone web-servers that I’ll talk about more if / when it takes off.
I’ve been trying to compile example VST instruments (C++) for some of my work with the Brasilia Laptop Orchestra, but it’s driving me crazy. (I may go back to Pure Data which can be embedded in a VST.)
A bit of PHP, just simple small web-services.
I’m going to be teaching an Arduino course soon. So I’ll be writing a bit of C and I want to try Occam-Ⲡ.
I’m still writing Python too. Mainly for short file transformation scripts or to prototype algorithms that later get translated into CoffeeScript.
Some of this stuff is headed for GitHub soon.
Interesting to see the state of the art here. It’s an improvement on XML … but still, not as far forward as you’d hope.
The Java.next world