[racket] Beginners request for code review.

From: Piotr Klibert (piotr.klibert at 10clouds.com)
Date: Wed Jan 30 20:20:09 EST 2013

Hello all.

TL;DR: I "want" a code review. Link to the repository at the end.

This is my first post here so I think it's appropriate to introduce myself.
I'm a professional programmer and I have been programming for nearly twenty
years now. At work I use Python and CoffeeScript; before that I used PHP,
C++ and C, but I have no formal education in the field, which means that I
missed an opportunity to learn about many interesting, but not immediately
usable things.

For the last few years I have been trying to compensate for this in my
spare time. I have learnt, to various degrees, languages such as OCaml, F#,
Smalltalk, Erlang, J and Prolog among other more or less interesting
languages, dialects and environments.

Still, until about a year ago I knew nothing about Lisps. I decided to take
a look at one of them and by pure chance I chose Racket. I am in love with
it ever since.

For the last year I was scribbling Racket code from time to time and
reading a lot about it: from docs to blog posts to source code. Everything
I wrote was short and incomplete, I was essentially playing with newly
discovered features without trying to build anything in particular.

It took me so long, because Racket is vast and because I was concurrently
playing with Erlang and Smalltalk. I still don't know much about Racket and
I consider myself a beginner, but I decided that it's time to actually do
something instead of just playing.

Two weeks ago at work I was asked to prototype a JS app that would display
on <canvas> and would allow a user to type some text and then bend it
freely along the curve.

I needed to figure a bit of math for this. HTML canvas API is rather low
level one and essentially everything in the app would have to be computed
by hand. I chose to play with math in Racket, using its GUI capabilities
and I planned to switch to JS once the equations and basic algorithms were
established. Which I did, the project started and the app is being
developed right now (I'm not involved anymore).

All this left me with about 200 lines of Racket code - the greatest amount
I've written to date. I thought that this is the chance I was waiting for -
all I had to do was to refactor the spaghetti into modules, add some event
handlers and I would end up with a working Racket app.

For a few days more I was cleaning up the code and optimizing it, trying to
transform it into something I wouldn't be embarrassed of. I still didn't
write a proper contracts nor docs, but I somehow succeeded - I have a
little app that works and looks ok to my eyes.

And that's the problem.

I know very well that I'm a beginner and I know that there are vast parts
of Racket that I don't know of. I would like to ask anyone who has a few
 moments of free time to review what I wrote and tell me if it is a "good"
- ok, passable - Racket code; what should I do to make it better, what
mistakes I made and - maybe - what I managed to get right. I'm especially
concerned with the style of the code and it's structure, but any comment is
fine.

The code lives here:
http://bazaar.launchpad.net/~klibertp/+junk/bezier/files

I will really appreciate any feedback from anyone. Thanks in advance!

Best regards,
Piotr Klibert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20130131/8cb68fcd/attachment-0001.html>

Posted on the users mailing list.