bloggo ergo sum
msgbartop
msgbarbottom

07 May 09 Sololance

I’ve got a full-time job with benefits, and it’s a blessing to me and my family because it allows me to provide for them in full. We want for nothing, really.

However, I do someday want to start my own business. I have some ideas, but it will take time and even if I bootstrap and patiently build something worthwhile, it will still take money. I’ve been looking for small but worth-it side jobs to do to generate a little cash for a new business (e.g., purchase a license for basic developer tools, pay for basic hosting, etc). I’ve registered at a few of these “freelancer” work websites, thinking that if I fish around, I shouldn’t have much trouble picking up a job a month and netting an extra $100 or so to put away for a startup. Seems like a reasonable way to start bootstrapping something, no?

You know the sites: sologig.com, elance.com, guru.com, and most recently, werkadoo.com.

I’m entirely frustrated. Werkadoo looked promising, but since it launched it looks like a huge flop – I can only ever find one job listing, and it’s a very generic “send us your resume and we’ll be in touch” kind of listing. Not only that, but a full membership on Werkadoo costs $20/month. Sorry. Cash flow is the whole reason to do it in the first place, and when I really only envison doing 1 job per month, a cost of $20/month just to be there is not doable. Sologig.com? Just a feeding ground for employment companies and recruiters – which I’m entirely uninterested in. Sologig is a waste of time.

Don’t even get me started on rent-a-coder and get-a-freelancer and the like. Most of the projects are junk, and the employers that post non-junk projects are swarmed by bidders who can’t communicate, have no idea how to bid a project, or both.

Elance.com and guru.com are probably the best remaining options. Both have free membership options, but they limit your ability to bid and communicate with clients. They aren’t as bad as the other sites, but they still have their share of junk projects (you know the kind: “I need a complete clone of eBay for $500″). Those two sites don’t seem too bad, but bidding on a free membership plan is difficult because you’re not allowed to ask questions, and the projects posted are rarely detailed enough to elicit a complete bid. I’m basically structurally unable to compete because I’m not a paid member, but it’s not economical for me to shell out for a paid membership.

The other problem I have is that most of the software development projects are web applications. I’m not incapable of doing those projects (web applications are what I do for a living now), but the ideal project is one for which I can draw on my experience, and most of my experience is in distributed systems, clusters, backend server applications, systems programming, and embedded systems. Those projects are few and far between (and only on guru.com, as far as I can tell).

*Sigh*. Does anyone else have this problem? I want to find small, discrete chunks of work to do to make a little extra cash on the side, and in principle, the freelancing sites seem like a good avenue for finding such work, but in practice, they aren’t working well.

What is a freelancer with minimal availability to do?

Tags: , ,

03 Feb 09 Client Perspectives

I’ve been trying to write a web application in my free time. It’s been going on at varying degrees of intensity for months now, and I’ve got virtually nothing to show for it. Part of that is due to a lack of time to devote to it; at best, I can add 2 hours to the top of my day by getting up early.

But the point of the post is really the other compounding factors that the various technologies impose on me, and how that relates to the client perspective in typical contracted software work.

My day job involves almost exclusively Microsoft technology; .NET in particular. We use Sharepoint to build client intranet applications, do custom C# development, etc.

In my hobby projects, I tend to play on a Linux platform with Lisp or C++ (although I certainly am no stranger to the Windows platform or other languages). The webapp I’m working on has been based on Weblocks, a continuations-based web framework for Common Lisp. I have an idea of what I want it to be and do, but Weblocks isn’t well documented and I’m not very experienced with it yet, so I come to it asking this question:

what can I do?

The framework is also pretty liberal, so even once I know what it provides, I still have the same question because the possibilities are limitless. In a way, this expanse is paralyzing: I have to spend a lot of cognitive energy figuring out among the zillion design choices at each step, in addition to learning a technology I’m inexperienced with. Consequently, it takes a really long time to get something working. However, once it starts to roll, it can roll fast because once I’ve made my design decisions and worked out my requirements (informal as they may be), I understand where I’m going and generally how to get there.

I have another hobby project, a Git client for Windows built in WPF and C#. With that project, I ask a different question:

How do I do that?

This is because of the nature of the platform. True of closed, proprietary platforms in general, but in particular of comprehensive frameworks like .NET, most of the design decisions have already been made. I don’t have to choose among the zillion ways to render a components in HTML/CSS/Javascript and process user activity – there’s already a mechanism just for that in ASP.NET called “web parts”. I don’t have to make a hundred design decisions about the desktop GUI framework to use and how to use it or roll my own or extend one, etc, because the Visual Studio and Blend designers support WPF. With this platform stack, the tradeoffs are reversed: I can get rolling on a project almost immediately, but at some point, things get really hard because of the box you find yourself in down the road (and at least part of the box is hidden from you because of the proprietary nature of the stack – the Sharepoint object model is a perfect example because it sucks). I once worked on a system that had it’s own threadpool because the .NET threadpool didn’t perform well enough, for example. That was not a quick project.

What struck me about this contrast was that I found myself empathizing with the position of a client.

As in the first case, the possibilities are endless – unmanageable – at first, and I didn’t know what I wanted, and nobody was there to tell me – but later on, the freedom in those design choices was favorable.

In the other case, I had some very concrete ideas about what I wanted because the technology limited my choices, but those limitations created pain points later on because they became very confining.

Conclusion? I don’t know, really. Each position has it’s advantages and drawbacks. I tend toward the former as a craftsman, but toward the latter as a consultant for a variety of reasons, including market inertia.

Tags: , ,

03 Feb 09 Continuations

By training and experience, I’m largely an object-oriented programmer. I was a freshman comp. sci. student when the Java wave hit my university, so that’s what I was fed. I didn’t learn anything else but Java until the summer after my sophomore year; then, I was involved in a summer research program for which I used C++. Between then and the end of my undergraduate tenure, I had picked up more C++ and learned C (I should add here that my department was and is a very good c.s. department – they just didn’t use functional languages as teaching tools).

Where did that leave me? I knew how to write nice object hierarchies, tight structural/procedural code. However, Boost wasn’t a big deal yet, and I had only barely dabbled in anything else, so I was missing a huge piece of the puzzle: functional programming. I used lisp for a couple of programming assignments in graduate school because I wanted to learn the language – and I did learn the basics, but what I didn’t learn was important functional concepts.

Now, as a working professional programmer, I’m still trying to learn functional concepts. Some are pretty easy: immutability and recursive computation. These are very basic – even recursive functions were taught in Java programming classes.

But the most interesting element of functional programming is higher order functions, which are the basis for some very powerful forms of abstraction. This is what I was really missing in my repertoire.

So now, the point: I’ve been trying to learn a web framework called Weblocks. It’s freaking cool – but it makes heavy use of continuations for control flow (one of its major features). I had never learned about continuations before, so this was (and still is, to some degree) making it hard to learn the framework. So I was reading about continuations online (here ,here, and here) and came across a reference to Paul Graham’s book, On Lisp. I have a copy that I printed for myself, so I looked up the chapter on Continuations to gain some insight, and found the best explanation I’ve seen so far:

A continuation is a function representing the future of a computation. Whenever an expression is evaluated, something is waiting for the value it will return. For example, in

(/ (- x 1) 2)

when (- x 1) is evaluated, the outer / expression is waiting for the value, and something else is waiting for its value, and so on and so on, all the way back to the toplevel…

We can think of the continuation at any given time as a function of one argument. If the previous expression were typed into the toplevel, then when the subexpression (- x 1) was evaluated, the continuation would be:

(lambda (val) (/ val 2))

That is, the remainder of the computation could be duplicated by calling this function on the return value.

I found the little example shown here to be the best way try to explain continuations. Trying to understand the applications of continuations is a beast, and without this basic understanding it’s very easy to get lost.

Now…back to Weblocks…

Tags: , ,

29 Jan 09 Visual Studio is a Pretender!

Can I just rant at you for a minute, gentle reader?

The editor in Visual Studio is from the stone ages. Really – it’s retarded (I don’t mean that in a derogatory sense – it really is retarded).

Sure, it does syntax highlighting, but really….so do the little code-paste tools like pastebin, and those little tools highlight for dozens of languages, so color me unimpressed.

Intellisense? Yup – very nifty, very advanced – oh, wait! Lisp environments have been doing “intellisense” for years decades.

What else….let’s see….feature or failure?

Visual Studio characteristic Feature/Failure Notes
consistency of indentation FAIL ever tried to use another editor to open files authored in Visual Studio?
efficient keyboard shortcuts FAIL the most often used shortcuts (navigation in text, for example) require me to move my hand off the home row
automatic indentation FAIL Are you kidding? Only if you happen to be typing in a magical combination of keystrokes that Microsoft decided was the one true way to type will auto-indentation be convenient.

These are just some very basic, fundamental things, and this list could go on – indeed, I might come back and add to it as I become more proficient with Visual Studio. As an experienced Emacs user, it’s quite painful. I tried to use the Emacs keyboard mode, but it was even more maddening than the other modes – they get the keystrokes wrong, and even when they get them right, they don’t work correctly! C-k is supposed to kill a line, but you have to type ‘k’ twice for the kill to happen, and if you try to yank it back in using C-y, you get the killed line twice! M-q doesn’t work, you don’t get registers, typing on top of a highlighted region doesn’t replace, it appends, and ‘C-x b’ doesn’t switch tabs in the editor.

For all the wonders of a modern IDE, can we just please, please have an editor that’s advanced past 1985?

Tags: ,

15 Sep 08 Dedicated window-buffer mapping with Emacs

I use CScope to navigate source code from within Emacs. It’s very, very useful and integrates will into Emacs. However, I’ve been wanting a way to control how cscope updates the buffer/window mappings as it locates search results for you. Sometimes, I like that CScope updates the buffer where I initiated the search to reflect the results, and it’s easy to get back to the point of origin using the C-c s u command.

However, sometimes I want CScope to leave my origin buffer alone and show the result location in another window so I can see both at the same time. It’s bothersome to have to arrange the buffers manually after performing a search, so I asked on stackoverflow.com, and voila! I got a good answer – create a simple keybinding to a function for dedicating a window/buffer mapping:

;; keybindings
(global-set-key [pause] 'toggle-window-dedicated)
 
;; buffer dedication (mostly for cscope
(defun toggle-window-dedicated ()
  "Toggle whether the current active window is dedicated"
  (interactive)
  (message
   (if (let (window (get-buffer-window (current-buffer)))
	 (set-window-dedicated-p window
				 (not (window-dedicated-p window))))
     "Window '%s' is dedicated"
     "Window '%s' is normal")
   (current-buffer)))

Now, using this, I can just hit the pause button on my keyboard when I want to pin down my main source buffer.

Tags: , ,

30 May 08 Lisp: no easy download

Over at LispCast, eric’s got a new post up called No easy download. In it he talks about the difficulty of being new to Lisp, wanting to learn, and not knowing where to start.

He’s right. It’s way too hard – and I’d argue it’s one of the primary factors that hampers Lisp adoption. As one of his commenters points out

Perl, Python, and Ruby have the advantage that they are the only or at least canonical implementation of that particular language. Therefore, you go to perl.com or python.org and there it is.

When I run lisp, I don’t type ‘lisp.’ My implementation isn’t at lisp.org or anything like that because there are a bunch of implementations, none of them strictly canonical. If you’d gone to sbcl.org or cons.org (CMUCL) for instance, you would have found an accessible download link, although not really a mascot.

The comment is correct that there isn’t a canonical implementation of Lisp. But why should it matter? There can be a canonical place to go to for Lisp resources. There’s common-lisp.net, which isn’t bad, but as eric points out, it doesn’t lend itself to the “getting started” meme as well as python.org and ruby.org do. What about lisp.com? Well, it redirects to yeah.com, which has nothing to do with Lisp that I can tell. I can’t be sure though, because my employer blocks it:

\"Lisp.com redirected to yeah.com\"

Alright then, what about lisp.org?

Ok, it’s there and it’s Lisp-related, but it’s mostly about some group called the Association of Lisp Users. What about Lisp? Where can I download it?

Directory index of http://lisp.org

I can learn about the history of this group, read about their board, their members, their meetings, and their sponsors. A little further down, I can read about past conferences. Further down, I can read about Lisp resources.

If the ruby.org page had been this way, there might not have ever been a Ruby on Rails, and there’d be no Basecamp or Twitter (ok, there would be, but they’d be made from PHP).

Now, to be fair, the ALU has a CL Gardeners project that is aimed specifically at dealing with this issue, and the ALU Wiki is actually pretty good – but the wiki should be the index of lisp.org, and that page should have a link to the alu.org homepage.

Of course, eric’s post spurred some discussion over at News.YC, in which I participated. Said radu_floricica:

Arguing between 3 or 4 clicks doesn’t change anything. There are a lot of problems with beginners and lisp, but they’re far from how to get to the first implementation. As a newbee myself, googling for lisp environments was damn easy and instructive: i knew within 20 minutes that I should use linux, and if i really wanted windows (as I did at first) there was only one choice. When I finally had access to a decent linux it took me maybe another 20 to confirm that sbcl is the one I wanted. All that gave me lots of background information on the side.

Now the first brush with asdf on the other hand was a nightmare. I still don’t understand why I have to become an expert in pgp (definitely not just a beginner) just to use asdf-install.

I think the main problem for beginners is the effort it takes to install a reasonable environment. I tried two versions for a web application server: ucw and weblocks. Weblocks meant installing more then 10 different packages and source code is pretty much standard documentation – but it’s ok because it’s understandable and officially beta anyways. UCW is the standard – after a year and a half I still couldn’t produce an installation running on a port different then 8080 (I use 8080 for tomcat for all my machines).

All this effort is way disproportionate to the effects. Installing emacs and slime is may not be a breeze, but once you discover that googling “emacs configuration” brings up a bonanza it’s worth it. (Also that .emacs in windows is _emacs… that’s half a day I’ll never have back). But so much effort just to get a server running… if you want to help beginners write a better ucw tutorial, don’t just rearrange the links on the frontpage of lisp sites.

And my response:

Arguing between 3 or 4 clicks doesn’t change anything.

You’re wrong. And besides, the argument isn’t between 3 or 4 clicks. It should be no more than 2, and preferably one.

There are a lot of problems with beginners and lisp, but
they’re far from how to get to the first implementation.
As a newbee myself, googling for lisp environments was
damn easy and instructive: i knew within 20 minutes that
I should use linux, and if i really wanted windows (as I
did at first) there was only one choice.

You’re still wrong. Not every newbie even knows what to google for, and even if they did, it shouldn’t take them 20 minutes of web searching to figure out what they should download. And even that didn’t lead you to the right place – there is more than one option for Windows (cusp, allegro, lispworks, and clisp for starters – that’s not even counting scheme stuff), Linux isn’t the only way, and SBCL isn’t the only thing going on Linux. But a newbie either

a) has no way to figure all that out in a reasonably short amount of time b) isn’t going to try

And beyond that, you’re still missing the point: he shouldn’t have to.

Once you’re concerned with learning emacs and slime and customizing your environment and installing weblocks and getting asdf and asdf-install to work, you’re already committed. Difficulty doesn’t matter nearly as much by that point. Being able to easily download and dick around in the REPL is the number one hurdle that keeps people from trying Lisp.

The rest of the post I agree with, and I don’t argue that there are hurdles beyond the first one that are bigger and harder to conquer, but that’s irrelevant if newbies aren’t willing to jump the first one.

Tags: ,

15 Apr 08 debugging macro snippet

I wish I could say I came up with the below, and I suppose I did, but I more or less gathered two or three techniques I didn’t come up with into a few lines to code to make a macro useful for debugging. Its primary merits are readable output and extreme ease of use.

#define MY_MODULE_DEBUG_CATEGORY1  0x0001
#define MY_MODULE_DEBUG_CATEGORY2  0x0002
#define MY_MODULE_DEBUG_CATEGORY3  0x0004
 
#if !defined(MY_MODULE_DEBUG)
#  define MY_MODULE_DEBUG                 0x0000
#endif
#define _pp_string(x) #x
#define _pp_str(x)     _pp_string(x)
 
#if (__GNUC__ > 3)
#  define dbg(cat, fmt, ...)					\
   do {								\
      if (MY_MODULE_DEBUG_##cat & MY_MODULE_DEBUG)		\
      {								\
	 printf(__FILE__":"_pp_str(__LINE__)" [%s] "fmt,	\
		__func__, ##__VA_ARGS__);			\
      }								\
   } while (0)
#else
#  define dbg(cat, fmt, args...)				\
   do {								\
      if (MY_MODULE_DEBUG_ ## cat & MY_MODULE_DEBUG)		\
      {								\
	 printf(__FILE__":"_pp_str(__LINE__)" [%s] "fmt,	\
		__FUNCTION__ , ##args);				\
      }								\
   } while (0)
#endif
#if defined(_SOME_OS_)
#  define os_err(cat, errval)					\
   do {								\
      char *errstr = 0;						\
      error_string(errval, &errstr, 80, ERR_GET_ALL);		\
      if (errstr)						\
      {								\
	 dbg(cat, "OS ERROR:\n%s\n", errstr);			\
	 free(errstr);						\
      }								\
      else							\
      {								\
	 dbg(cat, "OS ERROR: %#lx - err_string() failed!\n",	\
	     errval);						\
      }								\
   } while (0)
#endif

Notice the “os_err” macro above, for use with OS-specific error string functions. This particular incantation is oriented toward a particular OS I interact with at work (names changed to protect the innocent), but the same idea would be applicable to any system, really.

Tags:

31 Mar 08 More functional support in C++

Sutter just announced that C++0x will have support for lambdas and closures.

It looks from the N2550 report that these things are motivated by a desire for some syntactic sugar to make using STL algorithms easier (which is understandable), but I hope this will lead to more first-class support for the functional programming paradigm. It has long had support for function objects, but it would be difficult to write predominantly functional programs in C++. I hope it just got a little bit easier.

My question(s): will these lambdas be serializable? In Lisp, there are a couple of ways you could ship around a closure. Ultimately, if you really wanted to, you could express the lambda as a regular list, transmit it, and then call “compile” on it. Since C++ doesn’t have a built-in way to write and compile code from within the language itself, it will have to be somewhat different (or maybe it’s time to start writing a functor serializer for the boost library).

I am a huge C++ aficionado, and this news excites me. A comment over on news.yc captures my sentiments pretty well:

Lambda functions and closures in C++. E-gads man! Wasn’t the language complex enough already!

I have to say: I love it. C++ has always been my favorite language that I don’t program in. It’s like kung-fu for programmers. You can attack any problem. But most times we don’t need kung-fu.

There’s nothing like “getting in the zone” with a good C++ program. It’s a thing of beauty. And if you’re doing stuff that you have to use the tool, like writing drivers, low-level stuff, doing some “break the rules” programming, it’s the best there is. I wrote a shell extender for windows many years ago in C++. I got to change the desktop and file system to work the way I wanted it to. Very neat stuff.

The sad fact is that most of the time you can make more money writing something with a much higher level language. And you can make it faster and adapt to the market faster. So C++ is a tougher language to use for startups, in my opinion (although it is still my favorite)

Can you imagine the trouble you can get into with macros, lambda functions, and unsafe pointers? How about throwing i some operator overloading? It’s like a playground for nuclear weapons.

Tags: ,

03 Aug 07 The Programming and Management Blog » Most Influential Programmers Results

The Programming and Management Blog » Most Influential Programmers Results

Nick Halstead recently took a month-long poll over at his blog recently of what people consider the most influential programmers, and below is the result:

1st – Linus Torvalds

2nd – Alan turing

3rd – Dennis Ritchie

4th – Donald Knuth

5th – Rasmus Lerdorf

6th – John Carmack

7th – Bill Gates

8th – Richard Stallman

9th – Tim Berners-Lee

10th – Bjarne Stroustrup

I can’t say I think this list makes any sense at all. Firstly, while Linus is definitely influential, I think it’s a stretch to say he’s the most influential of all time. Rasmus Lerdorf, similarly created something interesting, but among the most influential of all time? Bill Gates’ influence is due more to his technical strategy and business acumen, not his programming.

His own top ten list is here:

  1. John Carmack
  2. Linus Torvalds
  3. Tim Berners-Lee
  4. Douglas Andrew Bel
  5. Dennis Ritchie
  6. Bram Cohen
  7. asmus Lerdorf, Andi Gutmans & Zeev Suraski
  8. Jez San
  9. Bjarne Stroustrup
  10. Richard Bartle & Roy Trubshaw

He cheated with all the “&”s. Of course, mine would look much different, I think. Remember – this is for all time. The criteria must be something other than simple fame, which seems to be the impetus for the poll-driven list. It also should be something other than riches. Influence that sprang from work as a programmer is the criteria. It might should even be two lists: influence over the world in general (or over multiple industries), and influence in the programming and software industry. Perhaps, put simply, the idea is people who have significantly changed the way we think or do things.

Anyway, here is my list. It is unorderd, as I just don’t know how I could possibly rank the individuals. They are from different times which posed different problems, had influence in different ways which has meant different things in modern times. One might be able to do very lose rankings, but a 1-10 ranking I think isn’t very sensible.

  • Richard Stallman
  • Guy Steele
  • Tim Berners-Lee
  • Brendan Eich
  • Larry Wall
  • Kernigan & Ritchie – OK, I’m cheating a little here too, because you really can’t separate these two in their achievements.
  • David Wheeler
  • Dan Bricklin
  • Bram Cohen
  • Donald Becker
  • Bjarne Stroustrup
  • James Gosling

Have a look at Wikipedia to see info about more programmers.

Tags:

17 Jul 07 Best Programming Language Advice

The demons *must* be ice-skating by now.  There was an almost wholly on-topic thread on /.

The original article was an “Ask Slashdot” regarding programming languages. Below are some of the more informed comments (or so I thought), along with some of my thoughts. My apologies for not having links. I started this post using a firefox blogging plugin, and I somehow didn’t get the links included.

Don’t waste time learning a lot of computer languages. Pick one or two, learn them well, learn their standard libraries, write programs in them, and read/maintain other people’s code.

This sounds reasonable to me, but I think there are some important caveats here. I think I’d pick more than one or two languages to be in your toolbox. My preference is to be proficient in languages that fall across the following categories: statically-typed languages, dynamically-typed languages, scripting languages, functional languages, procedural languages, and object-oriented languages. Of course, there could be plenty of overlap in exactly which languages you choose. For example, my language of choice whenever practical is the C++ programming language (not “C/C++”!). C++ is a multi-paradigm language; it obviously supports procedural and object-oriented programming, but it also provides support (to varying degrees) for functional programming and generic programming (via templates and — if you can hold your nose — the preprocessor). Of course, the realities of my education required that I also be proficient in Java and C.

That takes care of the statically-typed languages. I think dynamic languages (not necessarily including their standard libraries, if there is one) are easier to learn, so why limit yourself to one? If you know C, being able to create something useful in PHP is simply a matter of learning a little Apache HTTPD administration and being handy with the PHP API. I chose to learn a little Python because it’s very useful, but also because it has some neat features and is really hot right now (which means it is gaining traction among developers and people who create tools for it, which in turn make it that much easier to use). Python has really become one of the necessary packages for a reasonably complete OS install these days. If you’ll be doing a bunch of web applications, it may be worth your while to learn Ruby; if not, then Python will be a better general-purpose dynamic language, I think. Python is very practical. There are lots of other dynamic languages out there; among the more popular are Ruby, OCaml, Lisp (and it’s dialects, like Scheme and Elisp), but don’t think it’s necessarily worth your time to be proficient in a bunch of them. Pick one or two that meet your needs.

That leaves scripting languages. The two that have been most useful to me over a number of years, and not by a close margin, are the bourne shell and sed. Of course, that gives me away as a *nix geek. I don’t have anything against Windows; I just don’t do most of my development there (and I don’t think scripting tools are as ubiquitous). I think there are very few things you could do in some other scripting language that you couldn’t do comparably using ksh99 and sed.

Update: after re-reading this, I decided to add a blurb about Perl to hopefully stem the tide of emails and comments complaining that I didn’t mention it. Fine. Perl can do everything the Bourne shell and sed can combined, plus a whole, whole lot more. It’s a true statement. Perl has incredible utility, and it’s (somewhat) portable between *nix and Windows. I just haven’t had a lot of use for it because ksh99 (or bash, as is more common) and sed take less time to learn and are sufficient to meet my needs.

So here’s the point – after the realities of my education, professional environment, and personal preferences are all accounted for, the list of languages I’m reasonably proficient in (or at least comfortable with):

  • C
  • C++
  • Java
  • C#
  • Bourne shell
  • sed
  • Python
  • PHP
  • Common Lisp
  • Scheme

This, obviously, is more than one or two. I suppose an important thing to remember is that several of these for forced on me by circumstance, and several of them were simply inevitable (seriously…what programmers out there with more than a year or two of experience, including school, can’t write a little bit of C?), and the rest were personal choice.

Spend most of your time focusing on concepts that generalize to all programming.

And

Knowing about design patterns is useful in any language. The intricacies of C++ template programming are not. If I say “That’s a singleton”, people will know what I’m talking about whether the code is written in Ruby, C++, Java, or Cobol.

This is certainly good advice. I think design patters can be a double-edged sword; they provide a neat little box to think in, but they can also convey the useful experiences and proven idioms of legions of programmers. It’s also simply smart to be able to take what you know and apply it in a broad domain spectrum.

However, I think it’s very, very important to be really proficient in at least one language. Don’t let yourself be such a generalist that you can’t answer a few questions about at least one of your languages:

  • What are its strengths?
  • What are its weaknesses?
  • Does is support tail recursion?
  • What 5 things would you change in your favorite language?
  • If I were to create a new language that could only implement 5 features from your language, which would they be?
  • Which is the best compiler?
  • What can your language be practically used for?

Once or twice a year, spend some time learning about a language you don’t know. Try to understand how it’s different than the language you normally use, and more importantly why. Look at example code and code from open source projects and try to emulate their code with your code. For example, Ruby will let you open a file, read and process each line in a while loop, then close the file. But the “ruby way” of doing it is to pass a code block to the file’s “each_line” method. After you understand the syntax and the strengths of the new language, and the idioms used by the language, decide what you like, and what you don’t. Then figure out how you can apply the new things in the language you regularly use.

I like this very much, and I think it dovetails very nicely with my previous comments; doing a detailed compare-and-contrast between your most frequently-used language and a new one will help you answer the questions above, but it will also help you keep your toolbox stocked with the most useful tools for you.

More generally, languages should be treated just like essential tools are in any other profession (or craft, if you prefer). Mechanics have buildings filled with tools, each with their purpose. They have one pegboard or cabinet that contains a small set of tools that are used very frequently and those are the kind of tools that become like extensions of the mechanics’ own limbs. That’s how programming tools should be, including languages. Go ahead and get attached to one. It gives you a little personality, but don’t sell yourself short by thinking of languages as anything other than tools.

Tags: