Welcome to The
Java Mathematician!
I
started this blog as a place where I could waffle on about
whatever little thing has caught my fancy lately. Those things will
usually be mathematics or programming-related, so I guess the blog
name is fitting.
A little about me before we start:
A little about me before we start:
I'm a
mathematician. Well, not technically – one more year of undergrad
before I can really call myself that. The point is that I like
mathematics.
Now back when I
started my degree I had designed it so that I would graduate with a
major in Pure Mathematics. Of course, over the years I've found that
I have a much more pragmatic nature than I was banking on. The theory
is fine – beautiful even – but I seem to have the most fun
whenever I'm dealing with things that have a more immediate utility.
In particular,
the fields that interest me these days are linear algebra, operations
research, and discrete mathematics; as well as fields that have a
more obvious computational flavour, like algorithm analysis and
numerical/scientific computing. All of these areas of mathematics
also allow me to flex my programmer's muscle and write code to solve
problems, which is the best part.
So why the “Java”
mathematician? Well obviously I love programming. However I've really
come to like the Java Virtual Machine lately, and am currently
obsessed with learning as much as I can about it and the languages
that have been written for it.
In fact, Java was
the first programming language I ever learned. I've been programming
in Java in a non-professional (academic?) capacity for the last 5
years. I've been taught to program in a whole heap of other languages
since, like C++, C, Matlab (that counts, right?), R, Visual Basic .NET
(yes, really) to name a few. But what struck me about Java was the
ease to which I could program up some software and have it just work
on any other computer without too much mucking around.
It didn't hurt
that it was an object-oriented paradigm language either. For a while
there I was truly an OOP hipster. It happened the same way it usually
does; I had never understood the concepts of programming to an
interface and polymorphism when I was first taught them (with those
silly, contrived examples in the lectures) until I had to write my
first few non-trivial programs and saw how beautifully it worked in
practice.
Then I moved on
to read that infamous Design Patterns book and, of course, just went
completely overboard with it. It's truly cringe-worthy seeing some of
the programs I wrote during that bender: Singletons everywhere, a
Mediator for no other reason than an excuse to use one, and Factories
just for the sake of having Factories.
I seem to have
gotten most of it out of my system though, and have since tried to
broaden my programming horizons with the functional paradigm instead.
I got my first
taste of functional programming when I was learning Ruby back at the
start of last year. On top of learning about the Ruby Way*,
I was fascinated by the notions of blocks and lambdas, and the idea
of passing functions between other functions. So I had made my first
steps towards learning about first-class functions, higher-order
functions, lazy evaluation, and all that good stuff.
(* As
a side note, I'm quite fond of the Rubyist community and
actually agree with a lot of their programming philosophy, which I'm
told is an odd thing to hear a Java programmer say. In particular
their preference toward rigorous testing methodology and small
(testable!) functions has definitely instilled some good habits in
me.)
After
that I had a brief, unremarkable ride with Haskell. I'm not sure why
I didn't seem to click with Haskell as much as I thought I would,
particularly since I've known a few people that absolutely rave about
it. I think I got maybe 10 pages into the Haskell Road?
It
wasn't all for naught however. What I didn't find in Haskell I sure
seemed to find in Scala.
Scala
programming is truly a delight. While I have yet to get anywhere
close to mastering the language, it already feels immensely powerful.
It seems just as easy to write large-ish object systems as it does to
write small scripts – and fun, too! It's definitely my favourite
programming language at the moment. In fact, my first open source
code project was written in Scala (available here).
Perhaps
the best part of learning about Scala for me was that it worked well
with where I was at in my programming experience. One of the harder
things about learning Haskell was that I was tossed straight into the
deep end with functional notions like immutability and recursion for iterative processes. Given my OOP/procedural
background, not having variables or looping constructs as I'd known them was quite jarring.
Though Scala shares
many of the same functional ideals, it never enforced them in the
same way. As an example, Scala provides both Mutable and Immutable
versions of many of its data structures, and instead gently encourages the
use of the latter. This meant that I could explore functional techniques at my own pace, and still have all the old tools that I was familiar with at hand.
Then
when I was ready to dive right in to using functional ideas
exclusively, Clojure came along.
My
next absolute favourite language to code in would have to be Clojure. This
language, on top of its functional nature and awesome approaches to
state and concurrency, also introduced me to the timeless perfection
that is Lisp. I've since programmed a little in both Steel Bank
Common Lisp and Scheme. I still prefer Clojure though –
having the Java libraries right there is always a massive plus. I've
currently got an open source project in Clojure (here) that uses the
Swing GUI framework, for instance. Doing the same sort of thing in
either SBCL or Scheme would definitely not have been as straight-forward.
As for other JVM
languages: I have a passing familiarity with JRuby, and I've done some basic
programming in Python so using Jython likely wouldn't be too much trouble.
Admittedly I haven't looked into Groovy yet either, so that's the New
Year's Resolution – getting some decent experience with all three of
these languages.
Finally, though
it's not a JVM language I'll mention that I do enjoy the Scheme
programming language too. I've been working my way through that good
old Structure and Interpretation of Computer Programs book (the text
is available online here, and my worked solutions go here as I finish them.)
I have
to say that of all the programming languages I've written code in,
Scheme appeals to my mathematical side the most. I plan on
working through all the exercises in SICP this year, and the
Little/Seasoned Schemer books are on my list too.
A lot of the
exercises in SICP were quite interesting, so expect to see some of
them explored here. I will probably rewrite the exercise solutions in
Clojure (or Scala, or Ruby/Python, or Java, etc.) Partly because the Scheme solutions are already done, but mainly because this blog
isn't called “The Scheming Mathematician” (which just sounds
sketchy.)
As one last note,
I'm a Linux user (and have to tell absolutely everyone about it,
right?) I've been using
various flavours of Linux for 5 years – in fact I started using it
right before I learned how to program.
I began with
Ubuntu 9.10, and then quickly fell into my compulsive distro-hopping
routine where I bounce between various versions of Ubuntu, Fedora, openSUSE, Arch Linux, Mageia, and Debian. Admittedly I'm rarely on a single distribution for more than a few months. I always learn a lot though.
No comments:
Post a Comment