elehack.net

Posts tagged "programming"

Getting Things Typed: External Trusted Systems for Programming

One of the major tenants of David Allen’s Getting Things Done methodology is the concept of an external trusted system — a system for storing information outside your brain so that it can be retrieved as needed and/or brought to your attention when appropriate. Our brains are often fickle, and we are apt to forget things. Further, by trying to remember them, we spend mental energy trying not to forget them so that, even if we do remember, our productivity is decreased by the stress of trying not to forget. Getting notes, appointments, tasks, and pretty much anything else we need to remember out of our heads and into a reliable external storage and retrieval system enables us to free up our minds to focus on what we really want to accomplish.

I’ve been realizing lately that robust static type and module systems fill a similar role when programming. I have better things to do with my brain cycles than remember the details of functions, what they require, and where they are used.

Read more...

Idea for OCaml browser extension

This week, a variety of things clicked in to place for an idea.

I was thinking about how to do some cool web development in OCaml, supporting fast computation and manipulation in the browser. There exist a few projects, such as ocamljs and OBrowser, for running OCaml in the browser; ocamljs compiles it to JavaScript, and OBrowser interprets OCaml byte code in JavaScript.

Read more...

Tuning the OCaml memory allocator for large data processing jobs

TL;DR: setting OCAMLRUNPARAM=s=4M,i=32M,o=150 can make your OCaml programs run faster. Read on for details and how to see if the garbage collector is thrashing and thereby slowing down your program.

In my research work with GroupLens, I do a most of my coding for data processing, algorithm implementation, etc. in OCaml. Sometimes I have to suffer a bit for this when some nice library doesn’t have OCaml bindings, but in general it works out fairly well. And every time I go to do some refactoring, I am reminded why I’m not coding in Python.

Read more...

My first OCaml syntax extension

Preface: In this post, I describe my adventures figuring out how to write a syntax extension for the OCaml programming language and attempt to provide something of a tutorial on writing a basic extension. I assume that you’re somewhat familiar with basic parsing technology and context-free grammars — if not, a good tutorial on parser construction with a tool like Yacc would be worth a read first.

One of the oft-touted benefits of OCaml is Camlp4, a pre-processor that facilitates extending the OCaml syntax to provide natural support for various constructions. This has been used for a variety of purposes, such as database type-checking, monad sugaring, and logging. In the hands of a capable author, a variety of wonders can be introduced to the OCaml language.

Read more...

DVCS selection woes

I’ve been a convert to distributed version control, and in particular a user of Mercurial, for a few years now. I love Mercurial — its user interface is simple, the core concepts make sense, and it generally does an intelligent job of managing my programs (or config files, or homework assignments, or whatever).

I’ve tried to learn Git a few times, and even started converting to it some time last year, but go back to Mercurial for its user-facing simplicity. Internally, Git is simpler, but mapping use cases on to that simplicity is entirely exposed to the user. Mercurial’s UI is much more task-driven, such that there’s really one obvious way to do most useful things. I usually am able to keep my Mercurial repositories in somewhat sane states; Git’s failure mode seems to be leaving your branch refs in an incomprehensible state.

Read more...

Perl 6 operator table

This is kinda cool and kinda scary. Why do we want Perl 6, again?

Insight into the Java design process

Found this today while reading FreeBSD Planet. While I actually find Java’s enums somewhat useful, I do agree that they are a bit wonky...

Solution on simple world post

Some weeks ago, I wrote an article on my dilemma trying to determine which language to use for a calendar system. I just thought I’d make a public update to not leave it hanging.

The solution is Emacs. I’m now using org-mode, combined with diary. I’m working on some Perl and elisp hacking (so far just the Perl) to create a calendar system that synchronizes with my Clie (using PilotManager, since it already has a conduit for BBDB). This, combined with Gnus for reading my e-mail, is working rather well, and using remember.el I can easily convert an e-mail into a task. I even switched from IMAP (nnimap backend) to the nnml backend and that seems pretty nifty (so far).

Read more...

Why can't the world be simple?

I’m presently facing a programming task to work on, and am thinking through which language to work on it in. It’s a simple calendar & address book app, so it needs to work with vCard/iCalendar and network/VFS type things (at least HTTP). It also needs a GUI; preferably GTK+.

Contenders:

Read more...

OO: the new spaghetti code?

Many moons ago, Simula was created. From it came Smalltalk, and C++, followed by Java and a host of other languages sporting this new programming paradigm: object-oriented programming. Objects are everywhere — most new/modern languages, at least in the mainstream, are based on them — and are used for everything. In Java, all the core data structures are implemented in an object-oriented fashion.

I’m not convinced that all this is a good thing. In fact, I submit that excessive use of object-oriented principles leads to a new kind of spaghetti code, rendering programs perhaps as unreadable as when implemented with unscrupulous GOTOs. OK, maybe not quite, but it can still be pretty bad.

Read more...

Page 1 of 2 | Next >>>