With The Grain

A language more naturally supports some programming styles than others. You could write the equivalent of

   for (i = 0; i < a.size; i++) a[i] = b[i] + c[i];

in APL but that would be a waste when APL is engineered to just this kind of thing without explicit iteration.


I'm confused - is WithTheGrain meant to be a good thing? In woodworking, cutting across the grain is much easier than cutting with the grain.

Yes, but non-woodworkers don't know that, so the phrase "with the grain" usually means "done the easy, natural way".

I've cut many tons of wood, and it is a lot easier going with the grain than against it. Perhaps the previous chippy has a different definition of easier ;).

I assume it's referring to sanding/polishing, not cutting (and even for cutting it depends on the saw - a tenon saw tends to get jammed cutting with the grain)

The idiom used where I come from is to 'cut against the grain', thus my take on it. Here's a nice little page: http://www.taunton.com/fw/features/techniques/43grain.htm

More accurately, against the grain usually means Contrary to custom, one's inclination, or good sense, which may or may not be the easy/natural way.

Tangentially, you may take this advice with the grain of salt so often required ;-)


Also: Not allergic to grains as opposed to Wheat Allergies and Celiac Disease (see http://www.celiac.org for more information) where the affected individual can not eat Wheat Rye Oat or Barley products.


Another example of working with the grain might be doing certain things to enable the things you write to be combined with the standard library. Examples are implementing things like Iterable, Collection or Enum in Java if your class represents an aggregate of things, which then allows you to use the for each construct, or similarly making a type an instance of the Functor type class in Haskell. Generally, you'll know you're working with the grain because you'll find that things you thought you had to write will turn up as built-in parts of the language or standard library.


EditText of this page (last edited March 29, 2008) or FindPage with title or text search