<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" version="2.0">
  <channel>
    <title>Interoperability Happens - Scala</title>
    <link>http://blogs.tedneward.com/</link>
    <description>Ted's takes on the enterprise Java, .NET and Web services communities and technologies</description>
    <copyright>Ted Neward</copyright>
    <lastBuildDate>Wed, 01 May 2013 09:54:21 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 1.9.7067.0</generator>
    <managingEditor>tneward@tedneward.com</managingEditor>
    <webMaster>tneward@tedneward.com</webMaster>
    <item>
      <trackback:ping>http://blogs.tedneward.com/Trackback.aspx?guid=beb66c9a-aa45-42b2-8305-636ce104f8c3</trackback:ping>
      <pingback:server>http://blogs.tedneward.com/pingback.aspx</pingback:server>
      <pingback:target>http://blogs.tedneward.com/PermaLink,guid,beb66c9a-aa45-42b2-8305-636ce104f8c3.aspx</pingback:target>
      <dc:creator>Ted Neward</dc:creator>
      <wfw:comment>http://blogs.tedneward.com/CommentView,guid,beb66c9a-aa45-42b2-8305-636ce104f8c3.aspx</wfw:comment>
      <wfw:commentRss>http://blogs.tedneward.com/SyndicationService.asmx/GetEntryCommentsRss?guid=beb66c9a-aa45-42b2-8305-636ce104f8c3</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
With my most recent blog post, some of you were a little less than impressed with
the idea of using types, One reader, in particular, suggested that:
</p>
        <blockquote>
          <p>
Your encapsulating type aliases don't... encapsulate :|
</p>
        </blockquote>
        <p>
Actually, it kinda does. But not in the way you described.
</p>
        <blockquote>
          <p>
using X = qualified.type;
</p>
          <p>
merely introduces an alias, and will consequently (a) not prevent assignment of 
<br />
a FirstName to a LastName (b) not even be detectible as such from CLI metadata 
<br />
(i.e. using reflection).
</p>
        </blockquote>
        <p>
This is true—the using statement only introduces an alias, in much the same way that
C++’s “typedef” does. It’s not perfect, by any real means.
</p>
        <blockquote>
          <p>
Also, the alias is lexically scoped, and doesn't actually _declare a public name_
(so, it would need to be redeclared in all 'client' compilation units.
</p>
          <p>
(This won't be done, of course, because the clients would have no clue about 
<br />
this and happily be passing `System.String` as ever).
</p>
          <p>
The same goes for C++ typedefs, or, indeed C++11 template aliases:
</p>
          <p>
using FirstName = std::string; 
<br />
using LastName = std::string;
</p>
          <p>
You'd be better off using BOOST_STRONG_TYPEDEF (or a roll-your-own version of this
thing that is basically a CRTP pattern with some inherited constructors. When your
compiler has the latter feature, you could probably do without an evil MACRO).
</p>
        </blockquote>
        <p>
All of which is also true. Frankly, the “using” statement is a temporary stopgap,
simply a placeholder designed to say, “In time, this will be replaced with a full-fledged
type.”
</p>
        <p>
And even more to the point, he fails to point out that my “Age” class from my example
doesn’t really encapsulate the fact that Age is, fundamentally, an “int” under the
covers—because Age possesses type conversion operators to convert it into an int on
demand (hence the “implicit” in that operator declaration), it’s pretty easy to get
it back to straight “int”-land. Were I not so concerned with brevity, I’d have created
a type that allowed for addition on it, though frankly I probably would forbid subtraction,
and most certainly multiplication and division. (What does multiplying an Age mean,
really?)
</p>
        <p>
See, in truth, I cheated, because I know that the first reaction most O-O developers
will have is, “Are you crazy? That’s tons more work—just use the int!” Which, is both
fair, and an old argument—the C guys said the same thing about these “object” things,
and how much work it was compared to just declaring a data structure and writing a
few procedures to manipulate them. Creating a full-fledged type for each domain—or
each fraction of a domain—seems… heavy.
</p>
        <p>
Truthfully, this is <strong>much</strong> easier to do in F#. And in Scala. And in
a number of different languages. Unfortunately, in C#, Java, and even C++ (and frankly,
I don’t think the use of an “evil MACRO” is unwarranted, if it doesn’t promote bad
things). The fact that “doing it right” in those languages means “doing a ton of work
to get it right” is exactly why nobody does it—and suffers the commensurate loss of
encapsulation and integrity in their domain model.
</p>
        <p>
Another poster pointed out that there is a <em>much</em> better series on this at <a href="http://www.fsharpforfunandprofit.com">http://www.fsharpforfunandprofit.com</a>.
In particular, check out the series on <a href="http://fsharpforfunandprofit.com/series/designing-with-types.html">"Designing
with Types"</a>—it expresses everything I wanted to say, albeit in F# (where
I was trying, somewhat unsuccessfully, to example-code it in C#). By the way, I suspect
that almost every linguistic feature he uses would translate pretty easily/smoothly
over to Scala (or possibly Clojure) as well.
</p>
        <p>
Another poster pointed out that doing this type-driven design (TDD, anyone?) would
create some serious havoc with your persistence. Cry me a river, and then go use a
persistence model that fits an object-oriented and type-oriented paradigm. Like, I
dunno, an <a href="http://www.db4o.com">object database</a>. Particularly considering
that you shouldn’t want to expose your database schema to anyone outside the project
anyway, if you’re concerned about code being tightly coupled. (As in, any other code
outside this project—like a reporting engine or an ETL process—that accesses your
database directly now is tied to that schema, and is therefore a tight-coupling restriction
on evolving your schema.)
</p>
        <p>
Achieving good encapsulation isn’t a matter of trying to hide the methods being used—it’s
(partly) a matter of allowing the type system to carry a significant percentage of
the cognitive load, so that you don’t have to. Which, when you think on it, is kinda
what objects and strongly-typed type systems are supposed to do, isn’t it?
</p>
        <img width="0" height="0" src="http://blogs.tedneward.com/aggbug.ashx?id=beb66c9a-aa45-42b2-8305-636ce104f8c3" />
        <br />
        <hr />
Enterprise consulting, mentoring or instruction. Java, C++, .NET or XML services.
1-day or multi-day workshops available. <a href="mailto:ted@tedneward.com">Contact
me for details</a>.</body>
      <title>More on Types</title>
      <guid isPermaLink="false">http://blogs.tedneward.com/PermaLink,guid,beb66c9a-aa45-42b2-8305-636ce104f8c3.aspx</guid>
      <link>http://blogs.tedneward.com/2013/05/01/More+On+Types.aspx</link>
      <pubDate>Wed, 01 May 2013 09:54:21 GMT</pubDate>
      <description>&lt;p&gt;
With my most recent blog post, some of you were a little less than impressed with
the idea of using types, One reader, in particular, suggested that:
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
Your encapsulating type aliases don't... encapsulate :|
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
Actually, it kinda does. But not in the way you described.
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
using X = qualified.type;
&lt;/p&gt;
&lt;p&gt;
merely introduces an alias, and will consequently (a) not prevent assignment of 
&lt;br /&gt;
a FirstName to a LastName (b) not even be detectible as such from CLI metadata 
&lt;br /&gt;
(i.e. using reflection).
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
This is true—the using statement only introduces an alias, in much the same way that
C++’s “typedef” does. It’s not perfect, by any real means.
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
Also, the alias is lexically scoped, and doesn't actually _declare a public name_
(so, it would need to be redeclared in all 'client' compilation units.
&lt;/p&gt;
&lt;p&gt;
(This won't be done, of course, because the clients would have no clue about 
&lt;br /&gt;
this and happily be passing `System.String` as ever).
&lt;/p&gt;
&lt;p&gt;
The same goes for C++ typedefs, or, indeed C++11 template aliases:
&lt;/p&gt;
&lt;p&gt;
using FirstName = std::string; 
&lt;br /&gt;
using LastName = std::string;
&lt;/p&gt;
&lt;p&gt;
You'd be better off using BOOST_STRONG_TYPEDEF (or a roll-your-own version of this
thing that is basically a CRTP pattern with some inherited constructors. When your
compiler has the latter feature, you could probably do without an evil MACRO).
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
All of which is also true. Frankly, the “using” statement is a temporary stopgap,
simply a placeholder designed to say, “In time, this will be replaced with a full-fledged
type.”
&lt;/p&gt;
&lt;p&gt;
And even more to the point, he fails to point out that my “Age” class from my example
doesn’t really encapsulate the fact that Age is, fundamentally, an “int” under the
covers—because Age possesses type conversion operators to convert it into an int on
demand (hence the “implicit” in that operator declaration), it’s pretty easy to get
it back to straight “int”-land. Were I not so concerned with brevity, I’d have created
a type that allowed for addition on it, though frankly I probably would forbid subtraction,
and most certainly multiplication and division. (What does multiplying an Age mean,
really?)
&lt;/p&gt;
&lt;p&gt;
See, in truth, I cheated, because I know that the first reaction most O-O developers
will have is, “Are you crazy? That’s tons more work—just use the int!” Which, is both
fair, and an old argument—the C guys said the same thing about these “object” things,
and how much work it was compared to just declaring a data structure and writing a
few procedures to manipulate them. Creating a full-fledged type for each domain—or
each fraction of a domain—seems… heavy.
&lt;/p&gt;
&lt;p&gt;
Truthfully, this is &lt;strong&gt;much&lt;/strong&gt; easier to do in F#. And in Scala. And in
a number of different languages. Unfortunately, in C#, Java, and even C++ (and frankly,
I don’t think the use of an “evil MACRO” is unwarranted, if it doesn’t promote bad
things). The fact that “doing it right” in those languages means “doing a ton of work
to get it right” is exactly why nobody does it—and suffers the commensurate loss of
encapsulation and integrity in their domain model.
&lt;/p&gt;
&lt;p&gt;
Another poster pointed out that there is a &lt;em&gt;much&lt;/em&gt; better series on this at &lt;a href="http://www.fsharpforfunandprofit.com"&gt;http://www.fsharpforfunandprofit.com&lt;/a&gt;.
In particular, check out the series on &lt;a href="http://fsharpforfunandprofit.com/series/designing-with-types.html"&gt;&amp;quot;Designing
with Types&amp;quot;&lt;/a&gt;—it expresses everything I wanted to say, albeit in F# (where
I was trying, somewhat unsuccessfully, to example-code it in C#). By the way, I suspect
that almost every linguistic feature he uses would translate pretty easily/smoothly
over to Scala (or possibly Clojure) as well.
&lt;/p&gt;
&lt;p&gt;
Another poster pointed out that doing this type-driven design (TDD, anyone?) would
create some serious havoc with your persistence. Cry me a river, and then go use a
persistence model that fits an object-oriented and type-oriented paradigm. Like, I
dunno, an &lt;a href="http://www.db4o.com"&gt;object database&lt;/a&gt;. Particularly considering
that you shouldn’t want to expose your database schema to anyone outside the project
anyway, if you’re concerned about code being tightly coupled. (As in, any other code
outside this project—like a reporting engine or an ETL process—that accesses your
database directly now is tied to that schema, and is therefore a tight-coupling restriction
on evolving your schema.)
&lt;/p&gt;
&lt;p&gt;
Achieving good encapsulation isn’t a matter of trying to hide the methods being used—it’s
(partly) a matter of allowing the type system to carry a significant percentage of
the cognitive load, so that you don’t have to. Which, when you think on it, is kinda
what objects and strongly-typed type systems are supposed to do, isn’t it?
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blogs.tedneward.com/aggbug.ashx?id=beb66c9a-aa45-42b2-8305-636ce104f8c3" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
Enterprise consulting, mentoring or instruction. Java, C++, .NET or XML services.
1-day or multi-day workshops available. &lt;a href="mailto:ted@tedneward.com"&gt;Contact
me for details&lt;/a&gt;.</description>
      <comments>http://blogs.tedneward.com/CommentView,guid,beb66c9a-aa45-42b2-8305-636ce104f8c3.aspx</comments>
      <category>.NET</category>
      <category>Android</category>
      <category>C#</category>
      <category>C++</category>
      <category>F#</category>
      <category>Industry</category>
      <category>Java/J2EE</category>
      <category>Languages</category>
      <category>LLVM</category>
      <category>Objective-C</category>
      <category>Parrot</category>
      <category>Ruby</category>
      <category>Scala</category>
      <category>Visual Basic</category>
    </item>
    <item>
      <trackback:ping>http://blogs.tedneward.com/Trackback.aspx?guid=1a5622b2-d891-43ad-af4b-785ba018e862</trackback:ping>
      <pingback:server>http://blogs.tedneward.com/pingback.aspx</pingback:server>
      <pingback:target>http://blogs.tedneward.com/PermaLink,guid,1a5622b2-d891-43ad-af4b-785ba018e862.aspx</pingback:target>
      <dc:creator>Ted Neward</dc:creator>
      <wfw:comment>http://blogs.tedneward.com/CommentView,guid,1a5622b2-d891-43ad-af4b-785ba018e862.aspx</wfw:comment>
      <wfw:commentRss>http://blogs.tedneward.com/SyndicationService.asmx/GetEntryCommentsRss?guid=1a5622b2-d891-43ad-af4b-785ba018e862</wfw:commentRss>
      <slash:comments>4</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Recently, having been teaching C# for a bit at Bellevue College, I’ve been thinking
more and more about the way in which we approach building object-oriented programs,
and particularly the debates around types and type systems. I think, not surprisingly,
that the way in which the vast majority of the O-O developers in the world approach
types and when/how they use them is flat wrong—both in terms of the times when they
create classes when they shouldn’t (or shouldn’t have to, anyway, though obviously
this is partly a measure of their language), and the times when they should create
classes and don’t.
</p>
        <p>
The latter point is the one I feel like exploring here; the former one is certainly
interesting on its own, but I’ll save that for a later date. For now, I want to think
about (and write about) how we often don’t create types in an O-O program, and should,
because doing so can often create clearer, more expressive programs.
</p>
        <h3>A Person
</h3>
        <p>
Common object-oriented parlance suggests that when we have a taxonomical entity that
we want to represent in code (i.e., a concept of some form), we use a class to do
so; for example, if we want to model a “person” in the world by capturing some of
their critical attributes, we do so using a class (in this case, C#):
</p>
        <p>
          <font face="Consolas">class Person 
<br />
{ 
<br />
    public string FirstName { get; set; } 
<br />
    public string LastName { get; set; } 
<br />
    public int Age { get; set; } 
<br />
    public bool Gender { get; set; } 
<br />
}</font>
        </p>
        <p>
Granted, this is a pretty simplified case; O-O enthusiasts will find lots of things
wrong with this code, most of which have to do with dealing with the complexities
that can arise.
</p>
        <p>
From here, there’s a lot of ways in which this conversation can get a lot more complicated—how,
where and when should inheritance factor into the discussion, for example, and how
exactly do we represent the relationship between parents and children (after all,
some children will be adopted, some will be natural birth, some will be disowned)
and the relationship between various members who wish to engage in some form of marital
status (putting aside the political hot-button of same-sex marriage, we find that
some states respect “civil unions” even where no formal ceremony has taken place,
many cultures still recognize polygamy—one man, many wives—as Utah did up until the
mid-1800s, and a growing movement around polyamory—one or more men, one or more women—looks
like it may be the next political hot-button around marriage) definitely depends on
the business issues in question…
</p>
        <p>
… but that’s the whole point of encapsulation, right? That if the business needs change,
we can adapt as necessary to the changed requirements without having to go back and
rewrite everything.
</p>
        <h4>Genders
</h4>
        <p>
Consider, for example, the rather horrible decision to represent “gender” as a boolean:
while, yes, at birth, there are essentially two genders at the biological level, there
are some interesting birth defects/disorders/conditions in which a person’s gender
is, for lack of a better term, screwed up—men born with female plumbing and vice versa.
The system might need to track that. Or, there are those who consider themselves to
have been born into the wrong gender, and choose to live a lifestyle that is markedly
different from what societal norms suggest (the transgender crowd). Or, in some cases,
the gender may not have even been determined yet: fetuses don’t develop gender until
about halfway through the pregnancy.
</p>
        <p>
Which suggests, offhand, that the use of a boolean here is clearly a Bad Idea. But
what suggests as its replacement? Certainly we could maintain an internal state string
or something similar, using the get/set properties to verify that the strings being
set are correct and valid, but the .NET type system has a better answer: Given that
there is a finite number of choices to gender—whether that’s two or four or a dozen—it
seems that an enumeration is a good replacement:
</p>
        <p>
          <font face="Consolas">enum Gender 
<br />
{ 
<br />
    Male, Female, 
<br />
    Indeterminate, 
<br />
    Transgender 
<br />
}</font>
        </p>
        <p>
          <font face="Consolas">class Person 
<br />
{ 
<br />
    public string FirstName { get; set; } 
<br />
    public string LastName { get; set; } 
<br />
    public int Age { get; set; } 
<br />
    public Gender Gender { get; set; } 
<br />
}</font>
        </p>
        <p>
Don’t let the fact that the property and the type have the same name be too confusing—not
only does it compile cleanly, but it actually provides some clear description of what’s
being stored. (Although, I’ll admit, it’s confusing the first time you look at it.)
More importantly, there’s no additional code that needs to be written to enforce only
the four acceptable values—or, extend it as necessary when that becomes necessary.
</p>
        <h3>
        </h3>
        <h4>Ages
</h4>
        <p>
Similarly, the age of a person is not an integer value—people cannot be negative age,
nor do they usually age beyond a hundred or so. Again, we could put code around the
get/set blocks of the Age property to ensure the proper values, but it would again
be easier to let the type system do all the work:
</p>
        <p>
          <font face="Consolas">struct Age 
<br />
{ 
<br />
    int data; 
<br />
    public Age(int d) 
<br />
    { 
<br />
        Validate(d); 
<br />
        data = d; 
<br />
    }</font>
        </p>
        <p>
          <font face="Consolas">    public static void Validate(int d) 
<br />
    { 
<br />
        if (d &lt; 0) 
<br />
            throw new ArgumentException("Age
cannot be negative"); 
<br />
        if (d &gt; 120) 
<br />
            throw new ArgumentException("Age
cannot be over 120"); 
<br />
    }</font>
        </p>
        <p>
          <font face="Consolas">    // explicit int to Age conversion operator 
<br />
    public static implicit operator Age(int a) 
<br />
    { return new Age(a); }</font>
        </p>
        <p>
          <font face="Consolas">    // explicit Age to int conversion operator 
<br />
    public static implicit operator int(Age a) 
<br />
    { return a.data; } 
<br />
}</font>
        </p>
        <p>
          <font face="Consolas">class Person 
<br />
{ 
<br />
    public string FirstName { get; set; } 
<br />
    public string LastName { get; set; } 
<br />
    public Age Age { get; set; } 
<br />
    public Gender Gender { get; set; } 
<br />
}</font>
        </p>
        <p>
Notice that we’re still having to write the same code, but now the code is embodied
in a type, which is itself intrinsically reusable—we can reuse the Age type in other
classes, which is more than we can say if that code lives in the Person.Age property
getter/setter. Again, too, now the Person class really has nothing to do in terms
of ensuring that age is maintained properly (and by that, I mean greater than zero
and less than 120). (The “implicit” in the conversion operators means that the code
doesn’t need to explicitly cast the int to an Age or vice versa.)
</p>
        <p>
Technically, what I’ve done with Age is create a restriction around the integer (System.Int32
in .NET terms) type; were this XSD Schema types, I could do a derivation-by-restriction
to restrict an xsd:int to the values I care about (0 – 120, inclusive). Unfortunately,
no O-O language I know of permits derivation-by-restriction, so it requires work to
create a type that “wraps” another, in this case, an Int32.
</p>
        <h4>
        </h4>
        <h4>
        </h4>
        <h4>Names
</h4>
        <p>
Names are another point of problem, in that there’s all kinds of crazy cases that
(as much as we’d like to pretend otherwise) turn out to be far more common than we’d
like—not only do most people have middle names, but sometimes women will take their
husband’s last name and hyphenate it with their own, making it sort of a middle name
but not really, or sometimes people will give their children to multiple middle names,
Japanese names put family names first, sometimes people choose to take a single name,
and so on. This is again a case where we can either choose to bake that logic into
property getters/setters, or bake it into a single type (a “Name” type) that has the
necessary code and properties to provide all the functionality that a person’s name
represents.
</p>
        <p>
So, without getting into the actual implementation, then, if we want to represent
names in the system, then we should have a full-fledged “Name” class that captures
the various permutations that arise:
</p>
        <p>
          <font face="Consolas">class Name 
<br />
{   
<br />
    public Title Honorific { get { ... } } 
<br />
    public string Individual { get { ... } } 
<br />
    public string Nickname { get { ... } } 
<br />
    public string Family { get { ... } } 
<br />
    public string Full { get { ... } } 
<br />
    public static Name Parse(string incoming) { ... }  
<br />
}</font>
        </p>
        <p>
          <font face="Consolas">
          </font>
        </p>
        <p>
See, ultimately, everything will have to boil back to the core primitives within the
language, but we need to build stronger primitives for the system—Name, Title, Age,
and don’t even get me started on relationships.
</p>
        <h4>
        </h4>
        <h4>
        </h4>
        <h4>Relationships
</h4>
        <p>
Parent-child relationships are also a case where things are vastly more complicated
than just the one-to-many or one-to-one (or two-to-one) that direct object references
encourage; in the case of families, given how complex the modern American family can
get (and frankly, it’s not any easier if we go back and look at medieval families,
either—go have a look at any royal European genealogical line and think about how
you’d model that, particularly Henry VIII), it becomes pretty quickly apparent that
modeling the relationships themselves often presents itself as the only reasonable
solution.
</p>
        <p>
I won’t even begin to get into that example, by the way, simply because this blog
post is too long as it is. I might try it for a later blog post to explore the idea
further, but I think the point is made at this point.
</p>
        <h3>
        </h3>
        <h3>Summary
</h3>
        <p>
The object-oriented paradigm often finds itself wading in tens of thousands of types,
so it seems counterintuitive to suggest that we need more of them to make programs
more clear. I agree, many O-O programs are too type-heavy, but part of the problem
there is that we’re spending too much time creating classes that we shouldn’t need
to create (DTOs and the like) and not enough time thinking about the actual entities
in the system.
</p>
        <p>
I’ll be the first to admit, too, that not all systems will need to treat names the
way that I’ve done—sometimes an age is just an integer, and we’re OK with that. Truthfully,
though, it seems more often than not that we’re later adding the necessary code to
ensure that ages can never be negative, have to fall within a certain range, and so
on.
</p>
        <p>
As a suggestion, then, I throw out this idea: <strong><em>Ensure that all of your
domain classes never expose primitive types to the user of the system.</em></strong> In
other words, Name never exposes an “int” for Age, but only an “Age” type. C# makes
this easy via “using” declarations, like so:
</p>
        <p>
          <font face="Consolas">using FirstName = System.String; 
<br />
using LastName = System.String;</font>
        </p>
        <p>
which can then, if you’re thorough and disciplined about using the FirstName and LastName
types instead of “string”, evolve into fully-formed types later in their own right
if they need to. C++ provides “typedef” for this purpose—unfortunately, Java lacks
any such facility, making this a much harder prospect. (This is something I’d stick
at the top of my TODO list were I nominated to take Brian Goetz’s place at the head
of Java9 development.)
</p>
        <p>
In essence, encapsulate the primitive types away so that when they don’t need to be
primitives, or when they need to be more complex than just simple holders of data,
they don’t have to be, and clients will never know the difference. That, folks, is
what encapsulation is trying to be about.
</p>
        <img width="0" height="0" src="http://blogs.tedneward.com/aggbug.ashx?id=1a5622b2-d891-43ad-af4b-785ba018e862" />
        <br />
        <hr />
Enterprise consulting, mentoring or instruction. Java, C++, .NET or XML services.
1-day or multi-day workshops available. <a href="mailto:ted@tedneward.com">Contact
me for details</a>.</body>
      <title>On Types</title>
      <guid isPermaLink="false">http://blogs.tedneward.com/PermaLink,guid,1a5622b2-d891-43ad-af4b-785ba018e862.aspx</guid>
      <link>http://blogs.tedneward.com/2013/04/27/On+Types.aspx</link>
      <pubDate>Sat, 27 Apr 2013 00:59:12 GMT</pubDate>
      <description>&lt;p&gt;
Recently, having been teaching C# for a bit at Bellevue College, I’ve been thinking
more and more about the way in which we approach building object-oriented programs,
and particularly the debates around types and type systems. I think, not surprisingly,
that the way in which the vast majority of the O-O developers in the world approach
types and when/how they use them is flat wrong—both in terms of the times when they
create classes when they shouldn’t (or shouldn’t have to, anyway, though obviously
this is partly a measure of their language), and the times when they should create
classes and don’t.
&lt;/p&gt;
&lt;p&gt;
The latter point is the one I feel like exploring here; the former one is certainly
interesting on its own, but I’ll save that for a later date. For now, I want to think
about (and write about) how we often don’t create types in an O-O program, and should,
because doing so can often create clearer, more expressive programs.
&lt;/p&gt;
&lt;h3&gt;A Person
&lt;/h3&gt;
&lt;p&gt;
Common object-oriented parlance suggests that when we have a taxonomical entity that
we want to represent in code (i.e., a concept of some form), we use a class to do
so; for example, if we want to model a “person” in the world by capturing some of
their critical attributes, we do so using a class (in this case, C#):
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Consolas"&gt;class Person 
&lt;br /&gt;
{ 
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160; public string FirstName { get; set; } 
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160; public string LastName { get; set; } 
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160; public int Age { get; set; } 
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160; public bool Gender { get; set; } 
&lt;br /&gt;
}&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
Granted, this is a pretty simplified case; O-O enthusiasts will find lots of things
wrong with this code, most of which have to do with dealing with the complexities
that can arise.
&lt;/p&gt;
&lt;p&gt;
From here, there’s a lot of ways in which this conversation can get a lot more complicated—how,
where and when should inheritance factor into the discussion, for example, and how
exactly do we represent the relationship between parents and children (after all,
some children will be adopted, some will be natural birth, some will be disowned)
and the relationship between various members who wish to engage in some form of marital
status (putting aside the political hot-button of same-sex marriage, we find that
some states respect “civil unions” even where no formal ceremony has taken place,
many cultures still recognize polygamy—one man, many wives—as Utah did up until the
mid-1800s, and a growing movement around polyamory—one or more men, one or more women—looks
like it may be the next political hot-button around marriage) definitely depends on
the business issues in question…
&lt;/p&gt;
&lt;p&gt;
… but that’s the whole point of encapsulation, right? That if the business needs change,
we can adapt as necessary to the changed requirements without having to go back and
rewrite everything.
&lt;/p&gt;
&lt;h4&gt;Genders
&lt;/h4&gt;
&lt;p&gt;
Consider, for example, the rather horrible decision to represent “gender” as a boolean:
while, yes, at birth, there are essentially two genders at the biological level, there
are some interesting birth defects/disorders/conditions in which a person’s gender
is, for lack of a better term, screwed up—men born with female plumbing and vice versa.
The system might need to track that. Or, there are those who consider themselves to
have been born into the wrong gender, and choose to live a lifestyle that is markedly
different from what societal norms suggest (the transgender crowd). Or, in some cases,
the gender may not have even been determined yet: fetuses don’t develop gender until
about halfway through the pregnancy.
&lt;/p&gt;
&lt;p&gt;
Which suggests, offhand, that the use of a boolean here is clearly a Bad Idea. But
what suggests as its replacement? Certainly we could maintain an internal state string
or something similar, using the get/set properties to verify that the strings being
set are correct and valid, but the .NET type system has a better answer: Given that
there is a finite number of choices to gender—whether that’s two or four or a dozen—it
seems that an enumeration is a good replacement:
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Consolas"&gt;enum Gender 
&lt;br /&gt;
{ 
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160; Male, Female, 
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160; Indeterminate, 
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160; Transgender 
&lt;br /&gt;
}&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Consolas"&gt;class Person 
&lt;br /&gt;
{ 
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160; public string FirstName { get; set; } 
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160; public string LastName { get; set; } 
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160; public int Age { get; set; } 
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160; public Gender Gender { get; set; } 
&lt;br /&gt;
}&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
Don’t let the fact that the property and the type have the same name be too confusing—not
only does it compile cleanly, but it actually provides some clear description of what’s
being stored. (Although, I’ll admit, it’s confusing the first time you look at it.)
More importantly, there’s no additional code that needs to be written to enforce only
the four acceptable values—or, extend it as necessary when that becomes necessary.
&lt;/p&gt;
&lt;h3&gt;
&lt;/h3&gt;
&lt;h4&gt;Ages
&lt;/h4&gt;
&lt;p&gt;
Similarly, the age of a person is not an integer value—people cannot be negative age,
nor do they usually age beyond a hundred or so. Again, we could put code around the
get/set blocks of the Age property to ensure the proper values, but it would again
be easier to let the type system do all the work:
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Consolas"&gt;struct Age 
&lt;br /&gt;
{ 
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160; int data; 
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160; public Age(int d) 
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160; { 
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Validate(d); 
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; data = d; 
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160; }&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Consolas"&gt;&amp;#160;&amp;#160;&amp;#160; public static void Validate(int d) 
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160; { 
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; if (d &amp;lt; 0) 
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; throw new ArgumentException(&amp;quot;Age
cannot be negative&amp;quot;); 
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; if (d &amp;gt; 120) 
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; throw new ArgumentException(&amp;quot;Age
cannot be over 120&amp;quot;); 
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160; }&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Consolas"&gt;&amp;#160;&amp;#160;&amp;#160; // explicit int to Age conversion operator 
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160; public static implicit operator Age(int a) 
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160; { return new Age(a); }&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Consolas"&gt;&amp;#160;&amp;#160;&amp;#160; // explicit Age to int conversion operator 
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160; public static implicit operator int(Age a) 
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160; { return a.data; } 
&lt;br /&gt;
}&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Consolas"&gt;class Person 
&lt;br /&gt;
{ 
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160; public string FirstName { get; set; } 
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160; public string LastName { get; set; } 
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160; public Age Age { get; set; } 
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160; public Gender Gender { get; set; } 
&lt;br /&gt;
}&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
Notice that we’re still having to write the same code, but now the code is embodied
in a type, which is itself intrinsically reusable—we can reuse the Age type in other
classes, which is more than we can say if that code lives in the Person.Age property
getter/setter. Again, too, now the Person class really has nothing to do in terms
of ensuring that age is maintained properly (and by that, I mean greater than zero
and less than 120). (The “implicit” in the conversion operators means that the code
doesn’t need to explicitly cast the int to an Age or vice versa.)
&lt;/p&gt;
&lt;p&gt;
Technically, what I’ve done with Age is create a restriction around the integer (System.Int32
in .NET terms) type; were this XSD Schema types, I could do a derivation-by-restriction
to restrict an xsd:int to the values I care about (0 – 120, inclusive). Unfortunately,
no O-O language I know of permits derivation-by-restriction, so it requires work to
create a type that “wraps” another, in this case, an Int32.
&lt;/p&gt;
&lt;h4&gt;
&lt;/h4&gt;
&lt;h4&gt;
&lt;/h4&gt;
&lt;h4&gt;Names
&lt;/h4&gt;
&lt;p&gt;
Names are another point of problem, in that there’s all kinds of crazy cases that
(as much as we’d like to pretend otherwise) turn out to be far more common than we’d
like—not only do most people have middle names, but sometimes women will take their
husband’s last name and hyphenate it with their own, making it sort of a middle name
but not really, or sometimes people will give their children to multiple middle names,
Japanese names put family names first, sometimes people choose to take a single name,
and so on. This is again a case where we can either choose to bake that logic into
property getters/setters, or bake it into a single type (a “Name” type) that has the
necessary code and properties to provide all the functionality that a person’s name
represents.
&lt;/p&gt;
&lt;p&gt;
So, without getting into the actual implementation, then, if we want to represent
names in the system, then we should have a full-fledged “Name” class that captures
the various permutations that arise:
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Consolas"&gt;class Name 
&lt;br /&gt;
{&amp;#160;&amp;#160; 
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160; public Title Honorific { get { ... } } 
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160; public string Individual { get { ... } } 
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160; public string Nickname { get { ... } } 
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160; public string Family { get { ... } } 
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160; public string Full { get { ... } } 
&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160; public static Name Parse(string incoming) { ... }&amp;#160; 
&lt;br /&gt;
}&lt;/font&gt;&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Consolas"&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
See, ultimately, everything will have to boil back to the core primitives within the
language, but we need to build stronger primitives for the system—Name, Title, Age,
and don’t even get me started on relationships.
&lt;/p&gt;
&lt;h4&gt;
&lt;/h4&gt;
&lt;h4&gt;
&lt;/h4&gt;
&lt;h4&gt;Relationships
&lt;/h4&gt;
&lt;p&gt;
Parent-child relationships are also a case where things are vastly more complicated
than just the one-to-many or one-to-one (or two-to-one) that direct object references
encourage; in the case of families, given how complex the modern American family can
get (and frankly, it’s not any easier if we go back and look at medieval families,
either—go have a look at any royal European genealogical line and think about how
you’d model that, particularly Henry VIII), it becomes pretty quickly apparent that
modeling the relationships themselves often presents itself as the only reasonable
solution.
&lt;/p&gt;
&lt;p&gt;
I won’t even begin to get into that example, by the way, simply because this blog
post is too long as it is. I might try it for a later blog post to explore the idea
further, but I think the point is made at this point.
&lt;/p&gt;
&lt;h3&gt;
&lt;/h3&gt;
&lt;h3&gt;Summary
&lt;/h3&gt;
&lt;p&gt;
The object-oriented paradigm often finds itself wading in tens of thousands of types,
so it seems counterintuitive to suggest that we need more of them to make programs
more clear. I agree, many O-O programs are too type-heavy, but part of the problem
there is that we’re spending too much time creating classes that we shouldn’t need
to create (DTOs and the like) and not enough time thinking about the actual entities
in the system.
&lt;/p&gt;
&lt;p&gt;
I’ll be the first to admit, too, that not all systems will need to treat names the
way that I’ve done—sometimes an age is just an integer, and we’re OK with that. Truthfully,
though, it seems more often than not that we’re later adding the necessary code to
ensure that ages can never be negative, have to fall within a certain range, and so
on.
&lt;/p&gt;
&lt;p&gt;
As a suggestion, then, I throw out this idea: &lt;strong&gt;&lt;em&gt;Ensure that all of your
domain classes never expose primitive types to the user of the system.&lt;/em&gt;&lt;/strong&gt; In
other words, Name never exposes an “int” for Age, but only an “Age” type. C# makes
this easy via “using” declarations, like so:
&lt;/p&gt;
&lt;p&gt;
&lt;font face="Consolas"&gt;using FirstName = System.String; 
&lt;br /&gt;
using LastName = System.String;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;
which can then, if you’re thorough and disciplined about using the FirstName and LastName
types instead of “string”, evolve into fully-formed types later in their own right
if they need to. C++ provides “typedef” for this purpose—unfortunately, Java lacks
any such facility, making this a much harder prospect. (This is something I’d stick
at the top of my TODO list were I nominated to take Brian Goetz’s place at the head
of Java9 development.)
&lt;/p&gt;
&lt;p&gt;
In essence, encapsulate the primitive types away so that when they don’t need to be
primitives, or when they need to be more complex than just simple holders of data,
they don’t have to be, and clients will never know the difference. That, folks, is
what encapsulation is trying to be about.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blogs.tedneward.com/aggbug.ashx?id=1a5622b2-d891-43ad-af4b-785ba018e862" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
Enterprise consulting, mentoring or instruction. Java, C++, .NET or XML services.
1-day or multi-day workshops available. &lt;a href="mailto:ted@tedneward.com"&gt;Contact
me for details&lt;/a&gt;.</description>
      <comments>http://blogs.tedneward.com/CommentView,guid,1a5622b2-d891-43ad-af4b-785ba018e862.aspx</comments>
      <category>.NET</category>
      <category>Android</category>
      <category>C#</category>
      <category>C++</category>
      <category>F#</category>
      <category>Industry</category>
      <category>Java/J2EE</category>
      <category>Languages</category>
      <category>LLVM</category>
      <category>Objective-C</category>
      <category>Parrot</category>
      <category>Python</category>
      <category>Ruby</category>
      <category>Scala</category>
      <category>Visual Basic</category>
      <category>XML Services</category>
    </item>
    <item>
      <trackback:ping>http://blogs.tedneward.com/Trackback.aspx?guid=5fe4fd54-563d-4ac8-87cf-0aeaecaa2435</trackback:ping>
      <pingback:server>http://blogs.tedneward.com/pingback.aspx</pingback:server>
      <pingback:target>http://blogs.tedneward.com/PermaLink,guid,5fe4fd54-563d-4ac8-87cf-0aeaecaa2435.aspx</pingback:target>
      <dc:creator>Ted Neward</dc:creator>
      <wfw:comment>http://blogs.tedneward.com/CommentView,guid,5fe4fd54-563d-4ac8-87cf-0aeaecaa2435.aspx</wfw:comment>
      <wfw:commentRss>http://blogs.tedneward.com/SyndicationService.asmx/GetEntryCommentsRss?guid=5fe4fd54-563d-4ac8-87cf-0aeaecaa2435</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
In incarnations past, I have had debates, public and otherwise, with friends and colleagues
who have asserted that HTML5 (by which we really mean HTML5/JavaScript/CSS3) will
essentially become the platform of choice for all applications going forward—that
essentially, <em>this</em> time, standards will win out, and companies that try to
subvert the open nature of the web by creating their own implementations with their
own extensions and proprietary features that aren’t part of the standards, lose.
</p>
        <p>
Then, I read the Wired news post about <a href="http://www.wired.com/wiredenterprise/2013/04/blink/" target="_blank">Google’s
departure from WebKit</a>, and I’m a little surprised that the Internet (and by “the
Internet”, I mean “the very people who get up in arms about standards and subverting
them and blah blah blah”) hasn’t taken more issues with some of the things cited therein:
</p>
        <blockquote>
          <p>
Google’s decision is in tune with its overall efforts to improve the infrastructure
of the internet. When it comes to browser software and other web technologies that
directly effect the how quickly and effectively your machine grabs and displays webpages,
the company likes to use open source technologies. That way, it can feed their adoption
outside the company — and ultimately improve the delivery of its many online services
(including all important advertisements). But if it believes the rest of the web is
moving too slowly, it has no problem starting up its own project.
</p>
        </blockquote>
        <p>
Just to be clear, Google is happy to use open-source technologies, so it can feed
adoption of those technologies, but if it’s something that Google thinks is being
adopted too slowly—like, say, Google’s extensions to the various standards that aren’t
being picked up by its competitors—then Google feels the need to kick off its own
thing. Interesting.
</p>
        <blockquote>
          <p>
… [T]he trouble with WebKit is that is used different “multi-process architecture”
than its Chrome browser, which basically means it didn’t handle concurrent tasks in
the same way. When Chrome was first released in 2008 WebKit didn’t have a multi-process
architecture, so Google had to build its own. WebKit2, released in 2010, adds multi-process
features, but is quite different from what Google had already built. Apple and Google
don’t see eye to eye on the project, and it became too difficult and too time-consuming
for the company juggle the two architectures. “Supporting multiple architectures over
the years has led to increasing complexity for both [projects],” the post says. “This
has slowed down the collective pace of innovation.”
</p>
        </blockquote>
        <p>
So… Google tried to use some open-source software, but discovered that the project
didn’t work the way they built the rest of their application to work. (I’m certain
that’s the first time that has happened, ever.) When the custodians of the project
did add the feature Google wanted, the feature was implemented in a manner that still
wasn’t in lockstep with the way Google wanted things to work in their application.
This meant that “innovation” is “slowed down”.
</p>
        <p>
(As an aside, I find it fascinating that whenever a company adopts open-source, it’s
to “foster interoperability and open standards”, but when they abandon open-source,
it’s to “foster innovation and faster evolution”. And I’m sure it’s entirely accidental
that most of the time, adopting “open standards” is usually when the company is way
behind on the technology curve for a given thing, and adopting “faster innovation”
is usually when that same company thinks they’ve caught up the distance or surged
ahead of their competitors in that space.)
</p>
        <p>
Of course, a new implementation has its risks of bugs and incompatibilities, but Google
has a plan for that:
</p>
        <blockquote>
          <p>
“Throughout this transition, we’ll collaborate closely with other browser vendors
to move the web forward and preserve the compatibility that made it a successful ecosystem,”
the announcement reads.
</p>
        </blockquote>
        <p>
Ah, there. See? By collaborating closely with their competitors, they will preserve
compatibility. Because when Microsoft did that, everybody was totally OK with that….
uh, and… yeah… it worked pretty well, too, and….
</p>
        <p>
Look, it seems pretty reasonable to assume that even if the tags and the DOM and the
APIs are all 100% unchanged from Chrome v.Past to v.Next, there’s still going to be
places where they optimize differently than WebKit does, which means now that developers
will need to learn (and implement) optimizations in their Web-based applications differently.
And frankly, the assumption that Chrome’s Blink and WebKit will somehow be bug-for-bug
compatible/identical with each other is a pretty steep bar to accept blindly, considering
the history.
</p>
        <p>
Once again, we see the cycle coming around: in the beginning, when a technology is
fleshing out, companies yearn for standards in order to create adoption. After a certain
tipping point of adoption, however, the major players start to seek ways to avoid
becoming a commodity, and start introducing “extensions” and “innovations” that for
some odd reason their competitors in the standards meetings don’t seem all that inclined
to adopt. That’s when they start forking and shying away from staying true to the
standard, and eventually, the standard becomes either a least-common-denominator…
or a joke.
</p>
        <p>
Anybody want to bet on which outcome emerges for HTML5?
</p>
        <p>
(Before you reach for the “Comment” link to flame me all to Hell, yes, even an HTML
5 standard that is 80% consistent across all the browsers is still pretty damn useful—just
as a SQL standard that is 80% consistent across all the databases is useful. But this
is a far cry from the utopia of interconnectedness and interoperability that was promised
to us by the HTMLophiles, and it simply demonstrates that the Circle of TechnoLife
continues, unabated, as it has ever since PC manufacturers—and the rest of us watching
them--discovered what happens to them when they become a commodity.)
</p>
        <img width="0" height="0" src="http://blogs.tedneward.com/aggbug.ashx?id=5fe4fd54-563d-4ac8-87cf-0aeaecaa2435" />
        <br />
        <hr />
Enterprise consulting, mentoring or instruction. Java, C++, .NET or XML services.
1-day or multi-day workshops available. <a href="mailto:ted@tedneward.com">Contact
me for details</a>.</body>
      <title>Say that part about HTML standards, again?</title>
      <guid isPermaLink="false">http://blogs.tedneward.com/PermaLink,guid,5fe4fd54-563d-4ac8-87cf-0aeaecaa2435.aspx</guid>
      <link>http://blogs.tedneward.com/2013/04/13/Say+That+Part+About+HTML+Standards+Again.aspx</link>
      <pubDate>Sat, 13 Apr 2013 08:30:45 GMT</pubDate>
      <description>&lt;p&gt;
In incarnations past, I have had debates, public and otherwise, with friends and colleagues
who have asserted that HTML5 (by which we really mean HTML5/JavaScript/CSS3) will
essentially become the platform of choice for all applications going forward—that
essentially, &lt;em&gt;this&lt;/em&gt; time, standards will win out, and companies that try to
subvert the open nature of the web by creating their own implementations with their
own extensions and proprietary features that aren’t part of the standards, lose.
&lt;/p&gt;
&lt;p&gt;
Then, I read the Wired news post about &lt;a href="http://www.wired.com/wiredenterprise/2013/04/blink/" target="_blank"&gt;Google’s
departure from WebKit&lt;/a&gt;, and I’m a little surprised that the Internet (and by “the
Internet”, I mean “the very people who get up in arms about standards and subverting
them and blah blah blah”) hasn’t taken more issues with some of the things cited therein:
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
Google’s decision is in tune with its overall efforts to improve the infrastructure
of the internet. When it comes to browser software and other web technologies that
directly effect the how quickly and effectively your machine grabs and displays webpages,
the company likes to use open source technologies. That way, it can feed their adoption
outside the company — and ultimately improve the delivery of its many online services
(including all important advertisements). But if it believes the rest of the web is
moving too slowly, it has no problem starting up its own project.
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
Just to be clear, Google is happy to use open-source technologies, so it can feed
adoption of those technologies, but if it’s something that Google thinks is being
adopted too slowly—like, say, Google’s extensions to the various standards that aren’t
being picked up by its competitors—then Google feels the need to kick off its own
thing. Interesting.
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
… [T]he trouble with WebKit is that is used different “multi-process architecture”
than its Chrome browser, which basically means it didn’t handle concurrent tasks in
the same way. When Chrome was first released in 2008 WebKit didn’t have a multi-process
architecture, so Google had to build its own. WebKit2, released in 2010, adds multi-process
features, but is quite different from what Google had already built. Apple and Google
don’t see eye to eye on the project, and it became too difficult and too time-consuming
for the company juggle the two architectures. “Supporting multiple architectures over
the years has led to increasing complexity for both [projects],” the post says. “This
has slowed down the collective pace of innovation.”
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
So… Google tried to use some open-source software, but discovered that the project
didn’t work the way they built the rest of their application to work. (I’m certain
that’s the first time that has happened, ever.) When the custodians of the project
did add the feature Google wanted, the feature was implemented in a manner that still
wasn’t in lockstep with the way Google wanted things to work in their application.
This meant that “innovation” is “slowed down”.
&lt;/p&gt;
&lt;p&gt;
(As an aside, I find it fascinating that whenever a company adopts open-source, it’s
to “foster interoperability and open standards”, but when they abandon open-source,
it’s to “foster innovation and faster evolution”. And I’m sure it’s entirely accidental
that most of the time, adopting “open standards” is usually when the company is way
behind on the technology curve for a given thing, and adopting “faster innovation”
is usually when that same company thinks they’ve caught up the distance or surged
ahead of their competitors in that space.)
&lt;/p&gt;
&lt;p&gt;
Of course, a new implementation has its risks of bugs and incompatibilities, but Google
has a plan for that:
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
“Throughout this transition, we’ll collaborate closely with other browser vendors
to move the web forward and preserve the compatibility that made it a successful ecosystem,”
the announcement reads.
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
Ah, there. See? By collaborating closely with their competitors, they will preserve
compatibility. Because when Microsoft did that, everybody was totally OK with that….
uh, and… yeah… it worked pretty well, too, and….
&lt;/p&gt;
&lt;p&gt;
Look, it seems pretty reasonable to assume that even if the tags and the DOM and the
APIs are all 100% unchanged from Chrome v.Past to v.Next, there’s still going to be
places where they optimize differently than WebKit does, which means now that developers
will need to learn (and implement) optimizations in their Web-based applications differently.
And frankly, the assumption that Chrome’s Blink and WebKit will somehow be bug-for-bug
compatible/identical with each other is a pretty steep bar to accept blindly, considering
the history.
&lt;/p&gt;
&lt;p&gt;
Once again, we see the cycle coming around: in the beginning, when a technology is
fleshing out, companies yearn for standards in order to create adoption. After a certain
tipping point of adoption, however, the major players start to seek ways to avoid
becoming a commodity, and start introducing “extensions” and “innovations” that for
some odd reason their competitors in the standards meetings don’t seem all that inclined
to adopt. That’s when they start forking and shying away from staying true to the
standard, and eventually, the standard becomes either a least-common-denominator…
or a joke.
&lt;/p&gt;
&lt;p&gt;
Anybody want to bet on which outcome emerges for HTML5?
&lt;/p&gt;
&lt;p&gt;
(Before you reach for the “Comment” link to flame me all to Hell, yes, even an HTML
5 standard that is 80% consistent across all the browsers is still pretty damn useful—just
as a SQL standard that is 80% consistent across all the databases is useful. But this
is a far cry from the utopia of interconnectedness and interoperability that was promised
to us by the HTMLophiles, and it simply demonstrates that the Circle of TechnoLife
continues, unabated, as it has ever since PC manufacturers—and the rest of us watching
them--discovered what happens to them when they become a commodity.)
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blogs.tedneward.com/aggbug.ashx?id=5fe4fd54-563d-4ac8-87cf-0aeaecaa2435" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
Enterprise consulting, mentoring or instruction. Java, C++, .NET or XML services.
1-day or multi-day workshops available. &lt;a href="mailto:ted@tedneward.com"&gt;Contact
me for details&lt;/a&gt;.</description>
      <comments>http://blogs.tedneward.com/CommentView,guid,5fe4fd54-563d-4ac8-87cf-0aeaecaa2435.aspx</comments>
      <category>.NET</category>
      <category>Android</category>
      <category>Azure</category>
      <category>C#</category>
      <category>C++</category>
      <category>F#</category>
      <category>Industry</category>
      <category>iPhone</category>
      <category>Java/J2EE</category>
      <category>Mac OS</category>
      <category>Objective-C</category>
      <category>Reading</category>
      <category>Ruby</category>
      <category>Scala</category>
      <category>Windows</category>
      <category>XML Services</category>
    </item>
    <item>
      <trackback:ping>http://blogs.tedneward.com/Trackback.aspx?guid=efc92ce3-60c6-4512-ac78-b6962235f435</trackback:ping>
      <pingback:server>http://blogs.tedneward.com/pingback.aspx</pingback:server>
      <pingback:target>http://blogs.tedneward.com/PermaLink,guid,efc92ce3-60c6-4512-ac78-b6962235f435.aspx</pingback:target>
      <dc:creator>Ted Neward</dc:creator>
      <wfw:comment>http://blogs.tedneward.com/CommentView,guid,efc92ce3-60c6-4512-ac78-b6962235f435.aspx</wfw:comment>
      <wfw:commentRss>http://blogs.tedneward.com/SyndicationService.asmx/GetEntryCommentsRss?guid=efc92ce3-60c6-4512-ac78-b6962235f435</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
As is pretty typical for that site, Lambda the Ultimate has <a href="http://lambda-the-ultimate.org/node/4698">a
great discussion</a> on some insights that the creators of Mozart and Oz have come
to, regarding the design of programming languages; I repeat the post here for convenience: 
</p>
        <blockquote> Now that we are close to releasing Mozart 2 (a complete redesign
of the Mozart system), I have been thinking about how best to summarize the lessons
we learned about programming paradigms in CTM. Here are five "laws" that summarize
these lessons: 
<ol><li>
A well-designed program uses the right concepts, and the paradigm follows from the
concepts that are used. [Paradigms are epiphenomena]</li><li>
A paradigm with more concepts than another is not better or worse, just different.
[Paradigm paradox]</li><li>
Each problem has a best paradigm in which to program it; a paradigm with less concepts
makes the program more complicated and a paradigm with more concepts makes reasoning
more complicated. [Best paradigm principle]</li><li>
If a program is complicated for reasons unrelated to the problem being solved, then
a new concept should be added to the paradigm. [Creative extension principle]</li><li>
A program's interface should depend only on its externally visible functionality,
not on the paradigm used to implement it. [Model independence principle]</li></ol>
Here a "paradigm" is defined as a formal system that defines how computations are
done and that leads to a set of techniques for programming and reasoning about programs.
Some commonly used paradigms are called functional programming, object-oriented programming,
and logic programming. The term "best paradigm" can have different meanings depending
on the ultimate goal of the programming project; it usually refers to a paradigm that
maximizes some combination of good properties such as clarity, provability, maintainability,
efficiency, and extensibility. I am curious to see what the LtU community thinks of
these laws and their formulation. </blockquote> This just so neatly calls out to me,
based on my own very brief and very informal investigation into multi-paradigm programming
(based on James Coplien's work from C++ from a decade-plus ago). I think they really
have something interesting here. 
<img width="0" height="0" src="http://blogs.tedneward.com/aggbug.ashx?id=efc92ce3-60c6-4512-ac78-b6962235f435" /><br /><hr />
Enterprise consulting, mentoring or instruction. Java, C++, .NET or XML services.
1-day or multi-day workshops available. <a href="mailto:ted@tedneward.com">Contact
me for details</a>.</body>
      <title>Programming language "laws"</title>
      <guid isPermaLink="false">http://blogs.tedneward.com/PermaLink,guid,efc92ce3-60c6-4512-ac78-b6962235f435.aspx</guid>
      <link>http://blogs.tedneward.com/2013/03/20/Programming+Language+Laws.aspx</link>
      <pubDate>Wed, 20 Mar 2013 01:32:43 GMT</pubDate>
      <description>&lt;p&gt;
As is pretty typical for that site, Lambda the Ultimate has &lt;a href="http://lambda-the-ultimate.org/node/4698"&gt;a
great discussion&lt;/a&gt; on some insights that the creators of Mozart and Oz have come
to, regarding the design of programming languages; I repeat the post here for convenience: &lt;blockquote&gt; Now
that we are close to releasing Mozart 2 (a complete redesign of the Mozart system),
I have been thinking about how best to summarize the lessons we learned about programming
paradigms in CTM. Here are five "laws" that summarize these lessons: 
&lt;ol&gt;
&lt;li&gt;
A well-designed program uses the right concepts, and the paradigm follows from the
concepts that are used. [Paradigms are epiphenomena]&lt;/li&gt;
&lt;li&gt;
A paradigm with more concepts than another is not better or worse, just different.
[Paradigm paradox]&lt;/li&gt;
&lt;li&gt;
Each problem has a best paradigm in which to program it; a paradigm with less concepts
makes the program more complicated and a paradigm with more concepts makes reasoning
more complicated. [Best paradigm principle]&lt;/li&gt;
&lt;li&gt;
If a program is complicated for reasons unrelated to the problem being solved, then
a new concept should be added to the paradigm. [Creative extension principle]&lt;/li&gt;
&lt;li&gt;
A program's interface should depend only on its externally visible functionality,
not on the paradigm used to implement it. [Model independence principle]&lt;/li&gt;
&lt;/ol&gt;
Here a "paradigm" is defined as a formal system that defines how computations are
done and that leads to a set of techniques for programming and reasoning about programs.
Some commonly used paradigms are called functional programming, object-oriented programming,
and logic programming. The term "best paradigm" can have different meanings depending
on the ultimate goal of the programming project; it usually refers to a paradigm that
maximizes some combination of good properties such as clarity, provability, maintainability,
efficiency, and extensibility. I am curious to see what the LtU community thinks of
these laws and their formulation. &lt;/blockquote&gt; This just so neatly calls out to me,
based on my own very brief and very informal investigation into multi-paradigm programming
(based on James Coplien's work from C++ from a decade-plus ago). I think they really
have something interesting here. &gt;
&lt;img width="0" height="0" src="http://blogs.tedneward.com/aggbug.ashx?id=efc92ce3-60c6-4512-ac78-b6962235f435" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
Enterprise consulting, mentoring or instruction. Java, C++, .NET or XML services.
1-day or multi-day workshops available. &lt;a href="mailto:ted@tedneward.com"&gt;Contact
me for details&lt;/a&gt;.</description>
      <comments>http://blogs.tedneward.com/CommentView,guid,efc92ce3-60c6-4512-ac78-b6962235f435.aspx</comments>
      <category>.NET</category>
      <category>Android</category>
      <category>C#</category>
      <category>C++</category>
      <category>Conferences</category>
      <category>Development Processes</category>
      <category>F#</category>
      <category>Industry</category>
      <category>Java/J2EE</category>
      <category>Languages</category>
      <category>LLVM</category>
      <category>Objective-C</category>
      <category>Parrot</category>
      <category>Personal</category>
      <category>Python</category>
      <category>Ruby</category>
      <category>Scala</category>
      <category>Visual Basic</category>
      <category>WCF</category>
      <category>Windows</category>
    </item>
    <item>
      <trackback:ping>http://blogs.tedneward.com/Trackback.aspx?guid=e02917fc-91bb-462e-9c3b-44bf2929cae3</trackback:ping>
      <pingback:server>http://blogs.tedneward.com/pingback.aspx</pingback:server>
      <pingback:target>http://blogs.tedneward.com/PermaLink,guid,e02917fc-91bb-462e-9c3b-44bf2929cae3.aspx</pingback:target>
      <dc:creator>Ted Neward</dc:creator>
      <wfw:comment>http://blogs.tedneward.com/CommentView,guid,e02917fc-91bb-462e-9c3b-44bf2929cae3.aspx</wfw:comment>
      <wfw:commentRss>http://blogs.tedneward.com/SyndicationService.asmx/GetEntryCommentsRss?guid=e02917fc-91bb-462e-9c3b-44bf2929cae3</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Every once in a while, there is a moment in your life when inspiration just BAM! strikes
out of nowhere, telling you what your next blog post is.
</p>
        <p>
Then, there’s this one.
</p>
        <p>
This blog post wasn’t inspired by any sort of bolt from the blue, or even a conversation
with a buddy that led me to think, “Yeah, this is something that I should share with
the world”. No, this one comes directly to you, from you. You see, I was cruising
through my blog logs, and in particular looking at the Google Search queries that
led to the blog site, and yesterday apparently two different Google Searches, both
titled “Ted Neward on Java 8 adoption”, came in twice each.
</p>
        <p>
I take that as a sign that y’all are kinda curious what my thoughts on Java 8 adoption
are. Consider the message received: from your fingers to my eyes, as the old saying
(slightly rephrased) goes.
</p>
        <h2>Java 8: Overview
</h2>
        <p>
For those of you who’ve been too busy to track what’s going on with the Java language
recently, the upcoming release of the JDK, the JavaSE 8 release, marks a fairly significant
moment in Java’s history, one that ranks right up there with Java 5, in that the language
is going to get a significant “bump” in functionality. Historically, Sun tried very
hard to avoid such changes: Java 1.1 introduced inner classes, Java 1.4 introduced
“assert”, and beyond that the language was the same language we’d been using since
1996 or so. The JVM saw some huge growth, by leaps and bounds, and the Java libraries
grew exponentially, it seemed, but the language itself remained pretty static until
Java 5. With Java 5 we got generics, enumerations, annotations, enhanced for loops,
variable argument declarations, and a few other things besides; with Java 7 (the last
release) we got a couple of trivial changes that really didn’t ruffle anybody’s hair,
much less blow anybody’s socks off.
</p>
        <p>
Java 8 represents another Java 5-like “sea change” kind of release. Not because there’s
a ton of new features, like Java 5 had, but because the introduction of lambdas—anonymous
function literals—will change a lot of the ways we can express concepts in Java, and
that’s going to ripple throughout the language and the ecosystem. (Well, over time,
it will—it’s hard to say exactly how much things will change in the days and months
immediately following 8’s release.)
</p>
        <p>
I won’t go into the details of Java 8’s new syntax—that’s not only still being finalized,
but it’s also been pretty well-documented and discussed elsewhere (including a forthcoming
Java Magazine issue from Oracle TechNet on the subject that’s been written by yours
truly), and I only have a few minutes to write this in between flights home from a
conference, to boot. For those who are familiar with lambdas, suffice to say that
Java lambdas will look astonishingly like Scala or C# lambdas, partly because there’s
really only a few ways you can make lambdas look in a C-style language, and partly
because the folks writing the new features want the syntax to look familiar to programmers,
and borrowing somebody else’s syntax (or at least big chunks of it) is a good way
to do that.
</p>
        <h2>Java 8: Adoption
</h2>
        <p>
When we talk about “adoption” of a given Java release, there’s a couple of different
concepts we should tease out and examine individually: those customers who will deploy
their non-Java8-written code on top of the Java8 JVM; those customers who will start
using libraries written using Java8 features; and those customers who will start writing
their own designs and implementations in the Java8 syntax and style.
</p>
        <p>
          <strong>Customers deploying Java8 for the JVM.</strong> Frankly, I expect this to
happen relatively quickly, in line with the Java releases before this one. The JVM
gets better and better with each release, and there’s no reason to assume that this
release will be any different, and once Oracle and the JVM itself have demonstrated
that there’s little to no risk to dropping the new JVM into the production data center
and firing up your current version of JBoss or Tomcat or whatever on top of it, customers
will begin to take a hard look at the risks involved in doing so (if any) and make
that transition. It’s really a high-win-low-cost thing to do, again, once the Java8
JVM has some actual production miles under its belt, so to speak. (This isn’t a new
rewrite of the JVM, by the way—customers just don’t want to be the first one to discover
stupid bugs. My Dad once summarized this attitude this way: “Pilots never want to
the fly the ‘A’ model of any aircraft.”) I give it about a year, maybe as early as
six months, after the Java8 release before customers start putting Java8 into production.
</p>
        <p>
          <strong>Customers using libraries written using Java8 features.</strong> And let’s
be clear, by “Java8 features” we’re talking about lambdas and virtual extension methods
(a.k.a. “defender methods” from earlier draft specs), and by “libraries”, we’re talking
about major open-source favorites like Spring, Hibernate, Commons Collections and
so on. Essentially, the reason this is important as a category centers around the
idea that Java developers, like a lot of developers, aren’t going to adopt the language
features of the new Java until they see them in action—passing lambdas in to Spring
for executing inside a database transaction, for example, or passing a lambda in to
a collection for execution across a collection. The timeline here will be somewhat
dependent on the library, and on the commitment of the developers around those libraries,
but I’m a little less optimistic here—many of the open-source committers have historically
been the loudest to cry foul over some of the changes Sun made to the language, and
I’m not convinced yet that they have come around to embrace Oracle’s intentions regarding
the language’s evolution. (In many ways, the image that strikes me is that of a large
number of grumpy old men sitting around the office, gruffly tossing off one-liners
like “Didn’t work like that in MY day” and “Don’t these kids realize that sometimes
the old ways are the best ways?”.) I’m guessing that this transition will take longer,
like two years at the minimum, and some libraries will never actually make the transition
at all, choosing instead to remain “pre-Java8 compatible”, in the same way that some
libraries chose to remain “pre-Java5 compatible” (and, IMHO, essentially put themselves
out to pasture as a result).
</p>
        <p>
          <strong>Customers writing their own designs and implementations in Java8.</strong> And
really, what I mean here is “how long before they start creating classes that utilize
lambdas in the domain object design”? Interestingly enough, I think this is tangentially
related to how quickly the open-source community adopts Java8 (the previous point),
because then customers will begin to see some design patterns and idioms that they
can copy/follow/embrace/extend, but even if the open-source community roundly rejects
Java8, I still see customers starting to design and build code using lambdas by 2015
or ‘16. Some will jump on it early, or be able to transition their existing anonymous-inner-class-based
(that is, “poor man’s lambda”) code over to lambdas within months of Java8’s release,
but it will take longer to percolate through the rest of the industry—there are more
than a few companies out there still running Java6, for example, and those folks aren’t
going to accelerate their use of Java8 just to get lambdas.
</p>
        <h2>Java 8: Perception
</h2>
        <p>
Having said all that, though, I think the overall perception of Java8’s adoption will
be entirely dependent on how well Oracle addresses some of the recent “security flaws”
that have been coming out of Java in the press. Even though the security flaws all
seem to be applet- or client-side Java related, the perception that Java is somehow
insecure likely has Microsoft chuckling internally—it certainly has Microsoft’s community
(of which I and a number of my friends are a part) giggling and roaring and engaging
in a few “Neener-neener-neener” moments; after all the crap that Java guys gave the
Microsoft community back in the days of Bill Gates’ famous Security Memo, I can’t
say that it’s unwarranted.
</p>
        <p>
Aside from that, though, I think there’s no real reason not to expect adoption of
Java8 to follow the same broad strokes path that previous Java releases have enjoyed,
and thus within three years I fully expect that widescale adoption will be well under
way.
</p>
        <img width="0" height="0" src="http://blogs.tedneward.com/aggbug.ashx?id=e02917fc-91bb-462e-9c3b-44bf2929cae3" />
        <br />
        <hr />
Enterprise consulting, mentoring or instruction. Java, C++, .NET or XML services.
1-day or multi-day workshops available. <a href="mailto:ted@tedneward.com">Contact
me for details</a>.</body>
      <title>Ted Neward on Java 8 adoption</title>
      <guid isPermaLink="false">http://blogs.tedneward.com/PermaLink,guid,e02917fc-91bb-462e-9c3b-44bf2929cae3.aspx</guid>
      <link>http://blogs.tedneward.com/2013/03/19/Ted+Neward+On+Java+8+Adoption.aspx</link>
      <pubDate>Tue, 19 Mar 2013 01:46:36 GMT</pubDate>
      <description>&lt;p&gt;
Every once in a while, there is a moment in your life when inspiration just BAM! strikes
out of nowhere, telling you what your next blog post is.
&lt;/p&gt;
&lt;p&gt;
Then, there’s this one.
&lt;/p&gt;
&lt;p&gt;
This blog post wasn’t inspired by any sort of bolt from the blue, or even a conversation
with a buddy that led me to think, “Yeah, this is something that I should share with
the world”. No, this one comes directly to you, from you. You see, I was cruising
through my blog logs, and in particular looking at the Google Search queries that
led to the blog site, and yesterday apparently two different Google Searches, both
titled “Ted Neward on Java 8 adoption”, came in twice each.
&lt;/p&gt;
&lt;p&gt;
I take that as a sign that y’all are kinda curious what my thoughts on Java 8 adoption
are. Consider the message received: from your fingers to my eyes, as the old saying
(slightly rephrased) goes.
&lt;/p&gt;
&lt;h2&gt;Java 8: Overview
&lt;/h2&gt;
&lt;p&gt;
For those of you who’ve been too busy to track what’s going on with the Java language
recently, the upcoming release of the JDK, the JavaSE 8 release, marks a fairly significant
moment in Java’s history, one that ranks right up there with Java 5, in that the language
is going to get a significant “bump” in functionality. Historically, Sun tried very
hard to avoid such changes: Java 1.1 introduced inner classes, Java 1.4 introduced
“assert”, and beyond that the language was the same language we’d been using since
1996 or so. The JVM saw some huge growth, by leaps and bounds, and the Java libraries
grew exponentially, it seemed, but the language itself remained pretty static until
Java 5. With Java 5 we got generics, enumerations, annotations, enhanced for loops,
variable argument declarations, and a few other things besides; with Java 7 (the last
release) we got a couple of trivial changes that really didn’t ruffle anybody’s hair,
much less blow anybody’s socks off.
&lt;/p&gt;
&lt;p&gt;
Java 8 represents another Java 5-like “sea change” kind of release. Not because there’s
a ton of new features, like Java 5 had, but because the introduction of lambdas—anonymous
function literals—will change a lot of the ways we can express concepts in Java, and
that’s going to ripple throughout the language and the ecosystem. (Well, over time,
it will—it’s hard to say exactly how much things will change in the days and months
immediately following 8’s release.)
&lt;/p&gt;
&lt;p&gt;
I won’t go into the details of Java 8’s new syntax—that’s not only still being finalized,
but it’s also been pretty well-documented and discussed elsewhere (including a forthcoming
Java Magazine issue from Oracle TechNet on the subject that’s been written by yours
truly), and I only have a few minutes to write this in between flights home from a
conference, to boot. For those who are familiar with lambdas, suffice to say that
Java lambdas will look astonishingly like Scala or C# lambdas, partly because there’s
really only a few ways you can make lambdas look in a C-style language, and partly
because the folks writing the new features want the syntax to look familiar to programmers,
and borrowing somebody else’s syntax (or at least big chunks of it) is a good way
to do that.
&lt;/p&gt;
&lt;h2&gt;Java 8: Adoption
&lt;/h2&gt;
&lt;p&gt;
When we talk about “adoption” of a given Java release, there’s a couple of different
concepts we should tease out and examine individually: those customers who will deploy
their non-Java8-written code on top of the Java8 JVM; those customers who will start
using libraries written using Java8 features; and those customers who will start writing
their own designs and implementations in the Java8 syntax and style.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Customers deploying Java8 for the JVM.&lt;/strong&gt; Frankly, I expect this to
happen relatively quickly, in line with the Java releases before this one. The JVM
gets better and better with each release, and there’s no reason to assume that this
release will be any different, and once Oracle and the JVM itself have demonstrated
that there’s little to no risk to dropping the new JVM into the production data center
and firing up your current version of JBoss or Tomcat or whatever on top of it, customers
will begin to take a hard look at the risks involved in doing so (if any) and make
that transition. It’s really a high-win-low-cost thing to do, again, once the Java8
JVM has some actual production miles under its belt, so to speak. (This isn’t a new
rewrite of the JVM, by the way—customers just don’t want to be the first one to discover
stupid bugs. My Dad once summarized this attitude this way: “Pilots never want to
the fly the ‘A’ model of any aircraft.”) I give it about a year, maybe as early as
six months, after the Java8 release before customers start putting Java8 into production.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Customers using libraries written using Java8 features.&lt;/strong&gt; And let’s
be clear, by “Java8 features” we’re talking about lambdas and virtual extension methods
(a.k.a. “defender methods” from earlier draft specs), and by “libraries”, we’re talking
about major open-source favorites like Spring, Hibernate, Commons Collections and
so on. Essentially, the reason this is important as a category centers around the
idea that Java developers, like a lot of developers, aren’t going to adopt the language
features of the new Java until they see them in action—passing lambdas in to Spring
for executing inside a database transaction, for example, or passing a lambda in to
a collection for execution across a collection. The timeline here will be somewhat
dependent on the library, and on the commitment of the developers around those libraries,
but I’m a little less optimistic here—many of the open-source committers have historically
been the loudest to cry foul over some of the changes Sun made to the language, and
I’m not convinced yet that they have come around to embrace Oracle’s intentions regarding
the language’s evolution. (In many ways, the image that strikes me is that of a large
number of grumpy old men sitting around the office, gruffly tossing off one-liners
like “Didn’t work like that in MY day” and “Don’t these kids realize that sometimes
the old ways are the best ways?”.) I’m guessing that this transition will take longer,
like two years at the minimum, and some libraries will never actually make the transition
at all, choosing instead to remain “pre-Java8 compatible”, in the same way that some
libraries chose to remain “pre-Java5 compatible” (and, IMHO, essentially put themselves
out to pasture as a result).
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Customers writing their own designs and implementations in Java8.&lt;/strong&gt; And
really, what I mean here is “how long before they start creating classes that utilize
lambdas in the domain object design”? Interestingly enough, I think this is tangentially
related to how quickly the open-source community adopts Java8 (the previous point),
because then customers will begin to see some design patterns and idioms that they
can copy/follow/embrace/extend, but even if the open-source community roundly rejects
Java8, I still see customers starting to design and build code using lambdas by 2015
or ‘16. Some will jump on it early, or be able to transition their existing anonymous-inner-class-based
(that is, “poor man’s lambda”) code over to lambdas within months of Java8’s release,
but it will take longer to percolate through the rest of the industry—there are more
than a few companies out there still running Java6, for example, and those folks aren’t
going to accelerate their use of Java8 just to get lambdas.
&lt;/p&gt;
&lt;h2&gt;Java 8: Perception
&lt;/h2&gt;
&lt;p&gt;
Having said all that, though, I think the overall perception of Java8’s adoption will
be entirely dependent on how well Oracle addresses some of the recent “security flaws”
that have been coming out of Java in the press. Even though the security flaws all
seem to be applet- or client-side Java related, the perception that Java is somehow
insecure likely has Microsoft chuckling internally—it certainly has Microsoft’s community
(of which I and a number of my friends are a part) giggling and roaring and engaging
in a few “Neener-neener-neener” moments; after all the crap that Java guys gave the
Microsoft community back in the days of Bill Gates’ famous Security Memo, I can’t
say that it’s unwarranted.
&lt;/p&gt;
&lt;p&gt;
Aside from that, though, I think there’s no real reason not to expect adoption of
Java8 to follow the same broad strokes path that previous Java releases have enjoyed,
and thus within three years I fully expect that widescale adoption will be well under
way.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blogs.tedneward.com/aggbug.ashx?id=e02917fc-91bb-462e-9c3b-44bf2929cae3" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
Enterprise consulting, mentoring or instruction. Java, C++, .NET or XML services.
1-day or multi-day workshops available. &lt;a href="mailto:ted@tedneward.com"&gt;Contact
me for details&lt;/a&gt;.</description>
      <comments>http://blogs.tedneward.com/CommentView,guid,e02917fc-91bb-462e-9c3b-44bf2929cae3.aspx</comments>
      <category>.NET</category>
      <category>Android</category>
      <category>C#</category>
      <category>F#</category>
      <category>Industry</category>
      <category>Java/J2EE</category>
      <category>Languages</category>
      <category>Ruby</category>
      <category>Scala</category>
    </item>
    <item>
      <trackback:ping>http://blogs.tedneward.com/Trackback.aspx?guid=d45aa93c-e207-4523-aca2-1f4331fc068b</trackback:ping>
      <pingback:server>http://blogs.tedneward.com/pingback.aspx</pingback:server>
      <pingback:target>http://blogs.tedneward.com/PermaLink,guid,d45aa93c-e207-4523-aca2-1f4331fc068b.aspx</pingback:target>
      <dc:creator>Ted Neward</dc:creator>
      <wfw:comment>http://blogs.tedneward.com/CommentView,guid,d45aa93c-e207-4523-aca2-1f4331fc068b.aspx</wfw:comment>
      <wfw:commentRss>http://blogs.tedneward.com/SyndicationService.asmx/GetEntryCommentsRss?guid=d45aa93c-e207-4523-aca2-1f4331fc068b</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
There are times when the industry in which I find myself does things that I just don't
understand.
</p>
        <p>
Consider, for a moment, <a href="http://jeffhandley.com/archive/2013/02/25/The-We-accept-pull-requests-Addiction.aspx">this
blog</a> by Jeff Handley, in which he essentially says that the phrase "We accept
pull requests" is "cringe-inducing": 
</p>
        <blockquote> Why do the words “we accept pull requests” have such a stigma? Why
were they cringe-inducing when I spoke them? Because too many OSS projects use these
words as an easy way to shut people up. We (the collective of OSS project owners)
can too easily jump to this phrase when we don’t want to do something ourselves. If
we don’t see the value in a feature, but the requester persists, we can simply utter,
“We accept pull requests,” and drop it until the end of days or when a pull request
is submitted, whichever comes first. The phrase now basically means, “Buzz off!” </blockquote> OK,
I admit that I'm somewhat removed from the OSS community--I don't have any particular
dogs in that race, as the old saying goes--and the idea that "We accept pull requests"
is a "Buzz off!" phrase is news to me. But I understand what Jeff is saying: a phrase
has taken on a meaning of its own, and as is often the case, it's a meaning that's
contrary to its stated one: <blockquote> At Microsoft, having open source projects
that actually accept pull requests is a fairly new concept. I work on NuGet, which
is an Outercurve project that accepts contributions from Microsoft and many others.
I was the dev lead for Razor and Web Pages at the time it went open source through
Microsoft Open Tech. I collaborate with teams that work on EntityFramework, SignalR,
MVC, and several other open source projects. I spend virtually all my time thinking
about projects that are open source. Just a few years ago, this was unimaginable at
Microsoft. Sometimes I feel like it still hasn’t sunk in how awesome it is that we
have gotten to where we are, and I think I’ve been trigger happy and I’ve said “We
accept pull requests” too often I typically use the phrase in jest, but I admit that
I have said it when I was really thinking “Buzz off!” </blockquote> Honestly, I've
heard the same kind of thing from the mouths of Microsoft developers during Software
Development Reviews (SDRs), in the form of the phrase "Thank you for your feedback"--it's
usually at the end of a fervent discussion when one of the reviewers is commenting
on a feature being done (or not being done) and the team is in some kind of disagreement
about the feature's relative importance or the implementation used. It's usually uttered
in a manner that gives the crowd a very clear intent: "You can stop talking now, because
I've stopped listening." <blockquote> The weekend after the MVP summit, I was still
regretting having said what I said. I wished all week I could take the words back.
And then I saw someone else fall victim. On a highly controversial NuGet issue, the
infamous Phil Haack used a similar phrase as part of a response stating that the core
team probably wouldn’t be taking action on the proposed changes, but that there was
nothing stopping those affected from issuing a pull request. With my mistake still
fresh in my mind, I read Phil’s words just as I’m sure everyone in the room at the
MVP summit heard my own. It sounded flippant and it had the opposite effect from what
Phil intended or what I would want people thinking of the NuGet core team. From there,
the thread started turning nasty. We were stuck arguing opinions and we were no longer
discussing the actual issue and how it could be solved. </blockquote> As Jeff goes
on to mention, I got involved in that Twitter conversation, along with a number of
others, and as he says, the conversation moved on to JabbR, but without me--I bailed
on it for a couple of reasons. Phil proposed a resolution to the problem, though,
that seemed to satisfy at least a few folks: <blockquote> With that many mentions
on the tweets, we ran out of characters and eventually moved into JabbR. By the end
of the conversation, we all agreed that the words “we accept pull requests” should
never be used again. Phil proposed a great phrase to use instead: “Want to take a
crack at it? We’ll help.” </blockquote> But frankly, I don't care for this phraseology.
Yes, I understand the intent--the owners of open-source projects shouldn't brush off
people's suggestions about things to do with the project in the future and shouldn't
reach for a handy phrase that will essentially serve the purpose of saying "Buzz off".
And keeping an open ear to your community is a good thing, yes.
<p>
What I don't like about the new phrase is twofold. First, if people use the phrase
casually enough, eventually it too will be overused and interpreted to mean "Buzz
off!", just as "Thank you for your feedback" became. But secondly, where in the world
did it somehow become a law that open source projects MUST implement every feature
that their users suggest? This is part of the strange economics of open source--in
a commercial product, if the developers stray too far away from what customers need
or want, declining sales will serve as a corrective force to bring them back around
(or, if they don't, bankruptcy of either the product or the company will eventually
follow). But in an open-source project, there's no real visible marker to serve as
that accountability and feedback--and so the project owners, those who want to try
and stay in tune with their users anyway, feel a deeper responsibility to respond
to user requests. And on its own, that's a good thing.
</p><p>
The part that bothers me, though, is that this new phraseology essentially implies
that any open-source project has a responsibility to implement the features that its
users ask for, and frankly, that's not sustainable. Open-source projects are, for
the most part, maintained by volunteers, but even those that are backed by commercial
firms (like Microsoft or GitHub) have finite resources--they simply cannot commit
resources, even just "help", to every feature request that any user makes of them.
This is why the "We accept pull requests" was always, to my mind, an acceptable response:
loosely translated, to me at least, it meant, "Look, that's an interesting idea, but
it either isn't on our immediate roadmap, or it takes the project in a different direction
than we'd intended, or we're not even entirely sure that it's feasible or doable or
easily managed or what-have-you. Why don't you take a stab at implementing it in your
own fork of the code, and if you can get it to some point of implementation that you
can show us, send us a copy of the code in the form of a pull request so we can take
a look and see if it fits with how we see the project going." This is not an unreasonable
response: if you care passionately about this feature, either because you think it
should be there or because your company needs that feature to get its work done, then
you have the time, energy and motivation to at least take a first pass at it and prove
the concept (or, sometimes, prove to yourself that it's not such an easy request as
you thought). Cultivating a sense of entitlement in your users is not a good practice--it's
a step towards a completely unsustainable model that could, if not curbed, eventually
lead to the death of the project as the maintainers essentially give up when faced
with feature request after feature request.
</p><p>
I applaud the efforts on the part of project maintainers, particularly those at large
commercial corporations involved in open source, to avoid "Buzz off" phrases. But
it's not OK for project maintainers to feel like they are under a responsibility to
implement any particular feature or idea suggested by a user. Some ideas are going
to be good ones, some are going to be just "off the radar" of the project's core committers,
and some are going to be just plain bad. You think your idea is one of those? Take
a stab at it. Write the code. And if you've got it to a point where it seems to be
working, then submit a pull request.
</p><p>
But please, let's not blow this out of proportion. Users need to cut the people who
give them software for free some slack.
</p><p>
(<b>EDIT:</b> I accidentally referred to Jeff as "Anthony" in one place and "Andrew"
in another. Not really sure how or why, but... Edited.)
</p><img width="0" height="0" src="http://blogs.tedneward.com/aggbug.ashx?id=d45aa93c-e207-4523-aca2-1f4331fc068b" /><br /><hr />
Enterprise consulting, mentoring or instruction. Java, C++, .NET or XML services.
1-day or multi-day workshops available. <a href="mailto:ted@tedneward.com">Contact
me for details</a>.</body>
      <title>"We Accept Pull Requests"</title>
      <guid isPermaLink="false">http://blogs.tedneward.com/PermaLink,guid,d45aa93c-e207-4523-aca2-1f4331fc068b.aspx</guid>
      <link>http://blogs.tedneward.com/2013/02/26/We+Accept+Pull+Requests.aspx</link>
      <pubDate>Tue, 26 Feb 2013 09:52:45 GMT</pubDate>
      <description>&lt;p&gt;
There are times when the industry in which I find myself does things that I just don't
understand.
&lt;/p&gt;
&lt;p&gt;
Consider, for a moment, &lt;a href="http://jeffhandley.com/archive/2013/02/25/The-We-accept-pull-requests-Addiction.aspx"&gt;this
blog&lt;/a&gt; by Jeff Handley, in which he essentially says that the phrase "We accept
pull requests" is "cringe-inducing": &lt;blockquote&gt; Why do the words “we accept pull
requests” have such a stigma? Why were they cringe-inducing when I spoke them? Because
too many OSS projects use these words as an easy way to shut people up. We (the collective
of OSS project owners) can too easily jump to this phrase when we don’t want to do
something ourselves. If we don’t see the value in a feature, but the requester persists,
we can simply utter, “We accept pull requests,” and drop it until the end of days
or when a pull request is submitted, whichever comes first. The phrase now basically
means, “Buzz off!” &lt;/blockquote&gt; OK, I admit that I'm somewhat removed from the OSS
community--I don't have any particular dogs in that race, as the old saying goes--and
the idea that "We accept pull requests" is a "Buzz off!" phrase is news to me. But
I understand what Jeff is saying: a phrase has taken on a meaning of its own, and
as is often the case, it's a meaning that's contrary to its stated one: &lt;blockquote&gt; At
Microsoft, having open source projects that actually accept pull requests is a fairly
new concept. I work on NuGet, which is an Outercurve project that accepts contributions
from Microsoft and many others. I was the dev lead for Razor and Web Pages at the
time it went open source through Microsoft Open Tech. I collaborate with teams that
work on EntityFramework, SignalR, MVC, and several other open source projects. I spend
virtually all my time thinking about projects that are open source. Just a few years
ago, this was unimaginable at Microsoft. Sometimes I feel like it still hasn’t sunk
in how awesome it is that we have gotten to where we are, and I think I’ve been trigger
happy and I’ve said “We accept pull requests” too often I typically use the phrase
in jest, but I admit that I have said it when I was really thinking “Buzz off!” &lt;/blockquote&gt; Honestly,
I've heard the same kind of thing from the mouths of Microsoft developers during Software
Development Reviews (SDRs), in the form of the phrase "Thank you for your feedback"--it's
usually at the end of a fervent discussion when one of the reviewers is commenting
on a feature being done (or not being done) and the team is in some kind of disagreement
about the feature's relative importance or the implementation used. It's usually uttered
in a manner that gives the crowd a very clear intent: "You can stop talking now, because
I've stopped listening." &lt;blockquote&gt; The weekend after the MVP summit, I was still
regretting having said what I said. I wished all week I could take the words back.
And then I saw someone else fall victim. On a highly controversial NuGet issue, the
infamous Phil Haack used a similar phrase as part of a response stating that the core
team probably wouldn’t be taking action on the proposed changes, but that there was
nothing stopping those affected from issuing a pull request. With my mistake still
fresh in my mind, I read Phil’s words just as I’m sure everyone in the room at the
MVP summit heard my own. It sounded flippant and it had the opposite effect from what
Phil intended or what I would want people thinking of the NuGet core team. From there,
the thread started turning nasty. We were stuck arguing opinions and we were no longer
discussing the actual issue and how it could be solved. &lt;/blockquote&gt; As Jeff goes
on to mention, I got involved in that Twitter conversation, along with a number of
others, and as he says, the conversation moved on to JabbR, but without me--I bailed
on it for a couple of reasons. Phil proposed a resolution to the problem, though,
that seemed to satisfy at least a few folks: &lt;blockquote&gt; With that many mentions
on the tweets, we ran out of characters and eventually moved into JabbR. By the end
of the conversation, we all agreed that the words “we accept pull requests” should
never be used again. Phil proposed a great phrase to use instead: “Want to take a
crack at it? We’ll help.” &lt;/blockquote&gt; But frankly, I don't care for this phraseology.
Yes, I understand the intent--the owners of open-source projects shouldn't brush off
people's suggestions about things to do with the project in the future and shouldn't
reach for a handy phrase that will essentially serve the purpose of saying "Buzz off".
And keeping an open ear to your community is a good thing, yes.&gt;
&lt;p&gt;
What I don't like about the new phrase is twofold. First, if people use the phrase
casually enough, eventually it too will be overused and interpreted to mean "Buzz
off!", just as "Thank you for your feedback" became. But secondly, where in the world
did it somehow become a law that open source projects MUST implement every feature
that their users suggest? This is part of the strange economics of open source--in
a commercial product, if the developers stray too far away from what customers need
or want, declining sales will serve as a corrective force to bring them back around
(or, if they don't, bankruptcy of either the product or the company will eventually
follow). But in an open-source project, there's no real visible marker to serve as
that accountability and feedback--and so the project owners, those who want to try
and stay in tune with their users anyway, feel a deeper responsibility to respond
to user requests. And on its own, that's a good thing.
&lt;/p&gt;
&lt;p&gt;
The part that bothers me, though, is that this new phraseology essentially implies
that any open-source project has a responsibility to implement the features that its
users ask for, and frankly, that's not sustainable. Open-source projects are, for
the most part, maintained by volunteers, but even those that are backed by commercial
firms (like Microsoft or GitHub) have finite resources--they simply cannot commit
resources, even just "help", to every feature request that any user makes of them.
This is why the "We accept pull requests" was always, to my mind, an acceptable response:
loosely translated, to me at least, it meant, "Look, that's an interesting idea, but
it either isn't on our immediate roadmap, or it takes the project in a different direction
than we'd intended, or we're not even entirely sure that it's feasible or doable or
easily managed or what-have-you. Why don't you take a stab at implementing it in your
own fork of the code, and if you can get it to some point of implementation that you
can show us, send us a copy of the code in the form of a pull request so we can take
a look and see if it fits with how we see the project going." This is not an unreasonable
response: if you care passionately about this feature, either because you think it
should be there or because your company needs that feature to get its work done, then
you have the time, energy and motivation to at least take a first pass at it and prove
the concept (or, sometimes, prove to yourself that it's not such an easy request as
you thought). Cultivating a sense of entitlement in your users is not a good practice--it's
a step towards a completely unsustainable model that could, if not curbed, eventually
lead to the death of the project as the maintainers essentially give up when faced
with feature request after feature request.
&lt;/p&gt;
&lt;p&gt;
I applaud the efforts on the part of project maintainers, particularly those at large
commercial corporations involved in open source, to avoid "Buzz off" phrases. But
it's not OK for project maintainers to feel like they are under a responsibility to
implement any particular feature or idea suggested by a user. Some ideas are going
to be good ones, some are going to be just "off the radar" of the project's core committers,
and some are going to be just plain bad. You think your idea is one of those? Take
a stab at it. Write the code. And if you've got it to a point where it seems to be
working, then submit a pull request.
&lt;/p&gt;
&lt;p&gt;
But please, let's not blow this out of proportion. Users need to cut the people who
give them software for free some slack.
&lt;/p&gt;
&lt;p&gt;
(&lt;b&gt;EDIT:&lt;/b&gt; I accidentally referred to Jeff as "Anthony" in one place and "Andrew"
in another. Not really sure how or why, but... Edited.)
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blogs.tedneward.com/aggbug.ashx?id=d45aa93c-e207-4523-aca2-1f4331fc068b" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
Enterprise consulting, mentoring or instruction. Java, C++, .NET or XML services.
1-day or multi-day workshops available. &lt;a href="mailto:ted@tedneward.com"&gt;Contact
me for details&lt;/a&gt;.</description>
      <comments>http://blogs.tedneward.com/CommentView,guid,d45aa93c-e207-4523-aca2-1f4331fc068b.aspx</comments>
      <category>.NET</category>
      <category>Android</category>
      <category>Azure</category>
      <category>C#</category>
      <category>C++</category>
      <category>Conferences</category>
      <category>Development Processes</category>
      <category>F#</category>
      <category>Industry</category>
      <category>iPhone</category>
      <category>Java/J2EE</category>
      <category>Languages</category>
      <category>LLVM</category>
      <category>Mac OS</category>
      <category>Objective-C</category>
      <category>Python</category>
      <category>Reading</category>
      <category>Ruby</category>
      <category>Scala</category>
      <category>Security</category>
      <category>Solaris</category>
      <category>Visual Basic</category>
      <category>VMWare</category>
      <category>XML Services</category>
    </item>
    <item>
      <trackback:ping>http://blogs.tedneward.com/Trackback.aspx?guid=9fc99f7c-088b-45e9-b52a-3ccd9976c28d</trackback:ping>
      <pingback:server>http://blogs.tedneward.com/pingback.aspx</pingback:server>
      <pingback:target>http://blogs.tedneward.com/PermaLink,guid,9fc99f7c-088b-45e9-b52a-3ccd9976c28d.aspx</pingback:target>
      <dc:creator>Ted Neward</dc:creator>
      <wfw:comment>http://blogs.tedneward.com/CommentView,guid,9fc99f7c-088b-45e9-b52a-3ccd9976c28d.aspx</wfw:comment>
      <wfw:commentRss>http://blogs.tedneward.com/SyndicationService.asmx/GetEntryCommentsRss?guid=9fc99f7c-088b-45e9-b52a-3ccd9976c28d</wfw:commentRss>
      <slash:comments>4</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
While cruising through the Internet a few minute ago, I wandered across <a href="http://meteor.com">Meteor</a>,
which looks like a really cool tool/system/platform/whatever for building modern web
applications. JavaScript on the front, JavaScript on the back, Mongo backing, it's
definitely something worth looking into, IMHO.
</p>
        <p>
Thus emboldened, I decide to look at how to start playing with it, and lo and behold
I discover that the instructions for installation are: 
</p>
        <pre>
curl https://install.meteor.com | sh
</pre>
Um.... Wat?
<p>
Now, I'm sure the Meteor folks are all nice people, and they're making sure (via the
use of the https URL) that whatever is piped into my shell is, in fact, coming from
their servers, but I don't know these people from Adam or Eve, and that's taking an
awfully big risk on my part, just letting them pipe whatever-the-hell-they-want into
a shell Terminal. Hell, you don't even need root access to fill my hard drive with
whatever random bits of goo you wanted.
</p><p>
I looked at the shell script, and it's all OK, mind you--the Meteor people definitely
look trustworthy, I want to reassure anyone of that. But I'm really, really hoping
that this is NOT their preferred mechanism for delivery... nor is it anyone's preferred
mechanism for delivery... because that's got a gaping security hole in it about twelve
miles wide. It's just begging for some random evil hacker to post a website saying,
"Hey, all, I've got his really cool framework y'all should try..." and bury the malware
inside the code somewhere.
</p><p>
Which leads to today's Random Thought Experiment of the Day: How long would it take
the open source community to discover malware buried inside of an open-source package,
particularly one that's in widespread use, a la Apache or Tomcat or JBoss? (Assume
all the core committers were in on it--how many people, aside from the core committers,
actually look at the source of the packages we download and install, sometimes under
root permissions?)
</p><p>
Not saying we should abandon open source; just saying we should be responsible citizens
about who we let in our front door.
</p><p><b>UPDATE</b>: Having done the install, I realize that it's a two-step download...
the shell script just figures out which OS you're on, which tool (curl or wget) to
use, and asks you for root access to download and install the actual distribution.
Which, honestly, I didn't look at. So, here's hoping the Meteor folks are as good
as I'm assuming them to be....
</p><p>
Still highlights that this is a huge security risk.
</p><img width="0" height="0" src="http://blogs.tedneward.com/aggbug.ashx?id=9fc99f7c-088b-45e9-b52a-3ccd9976c28d" /><br /><hr />
Enterprise consulting, mentoring or instruction. Java, C++, .NET or XML services.
1-day or multi-day workshops available. <a href="mailto:ted@tedneward.com">Contact
me for details</a>.</body>
      <title>Um... Security risk much?</title>
      <guid isPermaLink="false">http://blogs.tedneward.com/PermaLink,guid,9fc99f7c-088b-45e9-b52a-3ccd9976c28d.aspx</guid>
      <link>http://blogs.tedneward.com/2013/02/15/Um+Security+Risk+Much.aspx</link>
      <pubDate>Fri, 15 Feb 2013 04:25:38 GMT</pubDate>
      <description>&lt;p&gt;
While cruising through the Internet a few minute ago, I wandered across &lt;a href="http://meteor.com"&gt;Meteor&lt;/a&gt;,
which looks like a really cool tool/system/platform/whatever for building modern web
applications. JavaScript on the front, JavaScript on the back, Mongo backing, it's
definitely something worth looking into, IMHO.
&lt;/p&gt;
&lt;p&gt;
Thus emboldened, I decide to look at how to start playing with it, and lo and behold
I discover that the instructions for installation are: &lt;pre&gt;
curl https://install.meteor.com | sh
&lt;/pre&gt;
Um.... Wat?&gt;
&lt;p&gt;
Now, I'm sure the Meteor folks are all nice people, and they're making sure (via the
use of the https URL) that whatever is piped into my shell is, in fact, coming from
their servers, but I don't know these people from Adam or Eve, and that's taking an
awfully big risk on my part, just letting them pipe whatever-the-hell-they-want into
a shell Terminal. Hell, you don't even need root access to fill my hard drive with
whatever random bits of goo you wanted.
&lt;/p&gt;
&lt;p&gt;
I looked at the shell script, and it's all OK, mind you--the Meteor people definitely
look trustworthy, I want to reassure anyone of that. But I'm really, really hoping
that this is NOT their preferred mechanism for delivery... nor is it anyone's preferred
mechanism for delivery... because that's got a gaping security hole in it about twelve
miles wide. It's just begging for some random evil hacker to post a website saying,
"Hey, all, I've got his really cool framework y'all should try..." and bury the malware
inside the code somewhere.
&lt;/p&gt;
&lt;p&gt;
Which leads to today's Random Thought Experiment of the Day: How long would it take
the open source community to discover malware buried inside of an open-source package,
particularly one that's in widespread use, a la Apache or Tomcat or JBoss? (Assume
all the core committers were in on it--how many people, aside from the core committers,
actually look at the source of the packages we download and install, sometimes under
root permissions?)
&lt;/p&gt;
&lt;p&gt;
Not saying we should abandon open source; just saying we should be responsible citizens
about who we let in our front door.
&lt;/p&gt;
&lt;p&gt;
&lt;b&gt;UPDATE&lt;/b&gt;: Having done the install, I realize that it's a two-step download...
the shell script just figures out which OS you're on, which tool (curl or wget) to
use, and asks you for root access to download and install the actual distribution.
Which, honestly, I didn't look at. So, here's hoping the Meteor folks are as good
as I'm assuming them to be....
&lt;/p&gt;
&lt;p&gt;
Still highlights that this is a huge security risk.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blogs.tedneward.com/aggbug.ashx?id=9fc99f7c-088b-45e9-b52a-3ccd9976c28d" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
Enterprise consulting, mentoring or instruction. Java, C++, .NET or XML services.
1-day or multi-day workshops available. &lt;a href="mailto:ted@tedneward.com"&gt;Contact
me for details&lt;/a&gt;.</description>
      <comments>http://blogs.tedneward.com/CommentView,guid,9fc99f7c-088b-45e9-b52a-3ccd9976c28d.aspx</comments>
      <category>.NET</category>
      <category>Android</category>
      <category>Azure</category>
      <category>C#</category>
      <category>C++</category>
      <category>Development Processes</category>
      <category>F#</category>
      <category>Flash</category>
      <category>Industry</category>
      <category>iPhone</category>
      <category>Java/J2EE</category>
      <category>Languages</category>
      <category>LLVM</category>
      <category>Mac OS</category>
      <category>Objective-C</category>
      <category>Parrot</category>
      <category>Personal</category>
      <category>Python</category>
      <category>Reading</category>
      <category>Ruby</category>
      <category>Scala</category>
      <category>Security</category>
      <category>Social</category>
      <category>Solaris</category>
      <category>Visual Basic</category>
      <category>VMWare</category>
      <category>WCF</category>
      <category>Windows</category>
      <category>XML Services</category>
      <category>XNA</category>
    </item>
    <item>
      <trackback:ping>http://blogs.tedneward.com/Trackback.aspx?guid=07ef7e67-accd-4232-9bb2-99082d1e0200</trackback:ping>
      <pingback:server>http://blogs.tedneward.com/pingback.aspx</pingback:server>
      <pingback:target>http://blogs.tedneward.com/PermaLink,guid,07ef7e67-accd-4232-9bb2-99082d1e0200.aspx</pingback:target>
      <dc:creator>Ted Neward</dc:creator>
      <wfw:comment>http://blogs.tedneward.com/CommentView,guid,07ef7e67-accd-4232-9bb2-99082d1e0200.aspx</wfw:comment>
      <wfw:commentRss>http://blogs.tedneward.com/SyndicationService.asmx/GetEntryCommentsRss?guid=07ef7e67-accd-4232-9bb2-99082d1e0200</wfw:commentRss>
      <slash:comments>7</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <b>TL;DR</b>: To all those who dissented, you're right, but you're wrong. Craftsmanship
is a noble meme, when it's something that somebody holds as a personal goal, but it's
often coming across as a way to beat up and denigrate on others who don't choose to
invest significant time and energy into programming. The Zen Masters didn't walk around
the countryside, proclaiming "I am a Zen Master!"
</p>
        <p>
Wow. Apparently I touched a nerve.
</p>
        <p>
It's been 48 hours since I posted <a href="http://blogs.tedneward.com/2013/01/24/On+The+Dark+Side+Of+Craftsmanship.aspx">On
the Dark Side of 'Craftsmanship'</a>, and it's gotten a ton of interest, as well as
a few syndicated re-posts (DZone and a few others). Comments to the blog included
a response from Dave Thomas, other blog posts have been brought to my attention, and
Twitter was on FIRE with people pinging me with their thoughts, which turn out to
be across the spectrum, approving and dissenting. Not at all what I really expected
to happen, to be honest--I kinda thought it would get lost in the noise of others
commenting around the whole thing.
</p>
        <p>
But for whatever reason, it's gotten a lot of attention, so I feel a certain responsibility
to respond and explain to some of the dissenters who've responded. Not to defend,
per se, but to at least demonstrate some recognition and attempt to clarify my position
where I think it's gotten mis-heard. (To those who approved of the message, thank
you for your support, and I'm happy to have vocalized something you felt unable, unwilling,
unheard, or too busy to vocalize yourself. I hope my explanations here continue to
represent your opinions, but if not, please feel free to let me know.)
</p>
        <p>
A lot of the opinions centered around a few core ideas, it seems, so let me try and
respond to those first.
</p>
        <p>
          <b>You're confusing "craftsmanship" with a few people behaving badly.</b> That may
well be, but those who behaved badly included at least one who holds himself up as
a leader of the craftsman movement and has held his actions up as indications of how
"craftsmen" should behave. When you do this, you invite this kind of criticism and
association. So if the movement is being given a black eye because of the actions
of a single individual, well, now you know how a bunch of moderate Republicans feel
about Paul Ryan.
</p>
        <p>
          <b>Corey is a nice guy, he apologized, don't crucify him.</b> Of course he is. Corey
is a nice guy--and, speaking well to his character, he apologized almost immediately
when it all broke. I learned a long time ago that "true sorry" means you (a) apologize
for your actions, (b) seek to remedy the damage your actions have caused ("make it
right", in other words), and (c) avoid making the same mistake in the future. From
a distance, it seems like he feels contrition, and has publicly apologized for his
actions. I would hope he's reached out to Heather directly to try and make things
right with her, but that's between the two of them. Whether he avoids this kind of
activity in the future remains to be seen. I think he will, but that's because I think
he's learned a harsh lesson about being in the spotlight--it tends to be a harsh place
to be. The rest of this really isn't about Corey and Heather anymore, so as far as
I'm concerned, that thread complete.
</p>
        <p>
          <b>You misunderstand the nature of "craftsmanship".</b> Actually, no, I don't. At
its heart, the original intent of "craftsmanship" was a constant striving to be better
about what you do, and taking pride in the things that you do. It's related to the
Japanese code of the samurai (kaizen) that says, in essence, that we are constantly
striving to get better. The samurai sought to become better swordsmen, constantly
challenging each other to prove the mettle against one another, improving their skills
and, conditioning, but also their honor, by how they treated each other, their lord,
their servants, and those they sought to protect. Kanban is a wonderful code, and
one I have tried to live my entire life, even before I'd discovered it. Please don't
assume that I misunderstand the teachings of your movement just because I don't go
to the meetings.
</p>
        <p>
          <b>Why you pick on "craftsmanship", anyway? If I want to take pride in what I do,
what difference does it make?</b> This is me paraphrasing on much of the dissent,
and my response boils down to two basic thoughts: 
</p>
        <ol>
          <li>
If you think your movement is "just about yourself", why invent a label to differentiate
yourself from the rest?</li>
          <li>
If you invent a label, it becomes almost automatic to draw a line between "us" and
"them", and that in of itself almost automatically leads to "us vs them" behavior
and mentality.</li>
        </ol>
Look, I view this whole thing as kind of like religion: whatever you want to do behind
closed doors, that's your business. But when you start waving it in other peoples'
faces, then I have a problem with it. You want to spend time on the weekends improving
your skills, go for it. You want to spend time at night learning a bunch of programming
languages so you can improve your code and your ability to design systems, go for
it. You want to study psychology and philosophy so you can understand other people
better when it comes time to interact with them, go for it. And hey, you want to put
some code up somewhere so people can point to it and help you get it better, go for
it. But when you start waving all that time and dedication in my face, you're either
doing it because you want recognition, or you want to suggest that I'm somehow not
as good as you. Live the virtuous life, don't brag about it.
<p>
There were some specific blogs and comments that I think deserve discusson, too:
</p><p>
Dave Thomas was kind enough to comment on my blog: 
</p><blockquote> I remember the farmer comment :) I think I said 30%, but I stand
by what I said. And it isn't really an elitist stance. Instead, I feel that programming
is hard work. At the end of a day of coding, I'm tired. And so I believe that if you
are asking someone to do programming, then it is in both your and their interest that
they are doing something they enjoy. Because if they don't enjoy it, then they are
truly just a laborer, working hard at something that has no meaning to them. And as
you spend 8 hours a day, 5 days a week doing it, that seems like an awful waste of
an intelligent person's life. </blockquote> Sure, programming is hard. So is house
painting. They're different kinds of exhaustion, but it's exhaustion all the same.
But, frankly, if somebody has chosen to take up a job that they do just because it's
a job, that's their choice, and not ours to criticize, in my opinion. (And I remember
it as 50%, because I very clearly remember saying the "way to insult half the room"
crack after it, but maybe I misheard you. I do know others also heard it at 50%, because
an attendee or two came up to talk about it after the panel. At least, that's how
I remember it at the time. But the number itself is kinda meaningless, now that I
think about it.) <blockquote> The farming quote was a deliberate attempt at being
shocking to make a point. But I still think it is valid. I'd guess that 30% of the
developers I meet are not happy in their work. And I think those folks would be happier
and more fulfilled doing something else that gave them more satisfaction. </blockquote> Again,
you and I are both in agreement, that people should be doing what they love, but that's
a personal judgment that each person is permitted to make for themselves. There are
aspects of our lives that we don't love, but we do because they make other people
happy (Juliet and Charlotte driving the boys around to their various activities comes
to mind, for example), and it is not our position to judge how others choose for themselves,
IMHO. <blockquote> No one should have to be a laborer. </blockquote> And here, you
and I will disagree quite fundamentally: as I believe it was Martin Luther King, Jr,
who said, "If you are going to be a janitor, be the best janitor you know how to be."
It seems by that statement that you are saying that people who labor with their bodies
rather than your minds (and trust me, you may not be a laborer anymore, big publishing
magnate that you are, but I know I sure still am) are somehow less well-off than those
who have other people working for them. Some people don't want the responsibility
of being the boss, or the owner. See the story of the mexican fisherman at the end
of this blog.
<p>
Nate commented: 
</p><blockquote> You have a logical fallacy by lumping together the people that derided
Heather's code and people that are involved in software craftmanship. It's actually
a huge leap of logic to make that connection, and it really retracts from the article. </blockquote> As
I point out later, the people who derided Heather's code were some of the same folks
who hold up software craftsmanship. That wasn't me making that up. 
<p></p><blockquote> Now you realise that you are planting your flag firmly in the 'craftmanship'
camp while propelling your position upwards by drawing a line in the sand to define
another group of people as 'labourers'. Or in other words attempt to elevate yourself
by patronising others with the position you think you are paying them a compliment.
Maybe you do not realise this? </blockquote> No, I realize it, and it's a fair critique,
which is why I don't label myself as a "craftsman". I have more to say on this below. <blockquote> However,
have you considered that the craft is not how awesome and perfect you and your code
are, but what is applicable for the task at hand. I think most people who you would
put into either camp share the same mix of attributes whether good or bad. The important
thing is if the solution created does what it is designed to do, is delivered on time
for when it is needed and if the environment that the solution has been created for
warrants it, that the code is easily understandable by yourself and others (that matter)
so it can be developed further over time and maintained. </blockquote> And the very
people who call themselves "craftsmen" criticized a piece of code that, as near as
I can tell, met all of those criteria. Hence my reaction that started this whole thing. <blockquote> I
don't wish to judge you, and maybe you are a great, smart guy who does good in the
world, but like you I have not researched anything about you, I have simply read your
assessment above and come to a conclusion, that's being human I guess. </blockquote> Oh,
people judge each other all the time, and it's high time we stopped beating them up
for it. It's human to judge. And while it would be politically correct to say, "You
shouldn't judge me before you know me", fact is, of course you're going to do exactly
that, because you don't have time to get to know me. And the fact that you don't know
me except but through the blog is totally acceptable--you shouldn't have to research
me in order to have an opinion. So we're all square on that point. (As to whether
I'm a great smart guy who does good in the world, well, that's for others to judge
in my opinion, not mine.) <blockquote> The above just sounds like more of the same
'elitism' that has been ripe in this world from playground to the workplace since
the beginning. </blockquote> It does, doesn't it? And hopefully I clarify the position
more clearly later. 
<p>
In <a href="http://rtigger.com/blog/2013/01/25/its-okay-to-love-your-job/">It's OK
to love your job</a>, Chad McCallum says that 
</p><blockquote> The basic premise (or at least the one the author start out with)
is that because there’s a self-declared group of “software craftspeople”, there is
going to be an egotistical divide between those who “get it” and those who don’t. </blockquote> Like
it or not, Chad, that egotistical divide is there. You can "call bullshit" all day
long, but look at the reactions that have popped up over this--people feel that divide,
and frankly, it's one that's been there for a long, long time. This isn't just me
making this up.
<p>
Chad also says, 
</p><blockquote><p>
It’s true the feedback that Heather got was unnecessarily negative. And that it came
from people who are probably considered “software craftspeople”. That said, correlation
doesn’t equal causation. I’m guessing the negative feedback was more because those
original offenders had a bad day and needed to vent. And maybe the comments after
that one just jumped on the bandwagon because someone with lots of followers and/or
respect said it.
</p><p>
These are both things that can and have happened to anyone, regardless of the industry
they work in. It’s extremely unfair to associate “someone who’s passionate about software
development” to “person who’s waiting to jump on you for your mistakes”.
</p></blockquote> Unfortunately, Chad, the excuse that "others do it, too" is not an acceptable
excuse. If everybody jumped off a cliff, would you do it, too? I understand the rationale--it's
extremely hard being the one to go against the herd (I've got the psychological studies
I can cite at you that prove it), but that doesn't make it OK or excuse it. Saying
"it happens in other industries" is just an extension of that. In other industries,
women are still explicitly discriminated against--does that make it OK for us to do
that, too?
<p>
Chad closes his blog with "Stop calling us egotistical jerks just because we love
what we do." To which I respond, "I am happy to do so, as soon as those 'craftsmen'
who are acting like one, stop acting like one." If you're not acting like one, then
there should be no argument here. If you're trying to tell me that your label is somehow
immune to criticism, then I think we just have to agree to disagree.
</p><p>
Paul Pagel (on a site devoted to software craftsmanship, no less) responded as well
with his <a href="http://blog.8thlight.com/paul-pagel/2013/01/24/humble-pursuit-of-mastery.html">Humble
Pursuit of Mastery</a>. He opens with: 
</p><blockquote> I have been reading on blogs and tweets the sentiment that "software
craftsmanship is elitism". This perception is formed around comments of code, process,
or techniques. I understand a craftsman's earned sense of pride in their work can
sometimes be inappropriately communicated. </blockquote> I don't think I commented
on code, process or technique, so I can't be sure if this is directly refuting what
I'm saying, but I note that Paul has already touched on the meme he wants to communicate
in his last phrase: the craftsman's "earned sense of pride". I have no problem with
the work being something that you take pride in; I note, however, that "pride goeth
before a fall", and note that, again, Ozymandias was justifiably proud of his accomplishments,
too.
<p>
Paul then goes through a summation of his career, making sure to smallcaps certain
terms with which I have no argument: "sacrifice", "listen", "practicing", "critique"
and "teaching". And, in all honesty, these are things that I embrace, as well. But
I start getting a little dubious about the sanctity of your terminology, Paul, when
it's being used pretty blatantly as an advertising slogan and theme all over the site--if
you want the term to remain a Zen-like pursuit, then you need to keep the commercialism
out of it, in my opinion, or you invite the kind of criticism that's coming here (explicit
or implicit).
</p><p>
Paul's conclusion wraps up with: 
</p><blockquote> Do sacrificing, listening, practice, critiquing, and teaching sound
like elitist qualities to you? Software craftsmanship starts out as a humble endeavor
moving towards mastery. I won't let 140 or 1000 characters redefine the hours and
years spent working hard to become a craftsman. It gave me humility and the confidence
to be a professional software developer. Sometimes I let confidence get the better
of me, but I know when that happens I am not honoring the spirit of craftsmanship
which I was trained. </blockquote> Humility enough to trademark your phrase "Software
is our craft"? Humility enough to call yourself a "driving force" behind software
craftsmanship? Don't get me wrong, Paul, there is a certain amount of commercialism
that any consultant must adopt in order to survive--but either please don't mix your
life-guiding principles with your commercialism, or else don't be surprised when others
take aim at your "humility" when you do. It's the same when ministers stand in a multi-million
dollar building on a Sunday morning and talk about the parable of the widow giving
away her last two coppers--that smacks of hypocrisy.
<p>
Finally, Matt van Horn wrote in <a href="http://www.mattvanhorn.com/2013/01/24/craftsmanship-a-rebuttal/">Crafsmanship,
a rebuttal</a> that: 
</p><blockquote> there is an allusion to software craftsmen as being an exclusive
group who agre on the “right” tools and techniques. This could not be further from
the truth. Anyone who is serious about their craft knows that for every job there
are some tools that are better and some that are worse. </blockquote> ... but then
he goes right into making that exact mistake: <blockquote> Now, I may not have a good
definition of elegant code, but I definitely know it when I see it – regardless of
who wrote it. If you can’t see that 
<br /><pre>
(1..10).each{|i| puts i}
</pre><br />
is more elegant than 
<br /><pre>
x = 0
while true do
  x = x + 1
  if x &gt; 10
    break
  end
  puts x
end
</pre>
then you must near the beginning of your journey towards mastery. Practicing your
craft develops your ability to recognize these differences, just as a skilled tailor
can more easily spot the difference between a bespoke suit and something from Men’s
Wearhouse. </blockquote> Matt, you kind of make my point for me. What makes it elegant?
You take it as self-evident. I don't. As a matter of fact, I've been asking this question
for some years now, "What makes code 'elegant', as opposed to 'ugly'? Ironically,
Elliott Rusty Harold just blogged about how this style of coding is dangerous in Java,
and got crucified for it, but he has the point that functional style (your first example)
doesn't JIT as well as the more imperative style right now on the JVM (or on the CLR,
from what I can tell). Are you assuming that this will be running on a native Ruby
implementation, on JRuby, IronRuby, ...? You have judged the code in the second example
based on an intrinsic value system that you may have never questioned. To judge, you
have to be able to explain your judgments in terms of the value system. And the fact
that you judge without any context, kind of speaks directly to the point I was trying
to make: "craftsmen", it seems, have this tendency to judge in absence of context,
because they are clearly "further down their journey towards mastery", to use your
own metaphor.
<p>
Or, to put it much more succinctly, "Beauty is in the eye of the beholder".
</p><p>
Matt then tells me I missed the point of the samurai and tea master story: 
</p><blockquote> inally, he closes with a famous zen story, but he entirely misses
the point of it. The story concerns a tea master, and a samurai, who get into a duel.
The tea master prevails by bringing the same concentration to the duel that he brings
to his tea ceremony. The point that Ted seems to miss here is that the tea master
is a craftsman of the highest order. A master of cha-do (the way of tea) is able to
transform the simple act of making and pouring a cup of tea into something transcendant
by bringing to this simple act a clear mind, a good attitude, and years of patient,
humble practice. Arguably he prevails because he has perfected his craft to a higher
degree than the samurai has perfected his own. That is why he has earned the right
to wear the garb of a samurai, and why he is able to face down his opponent. </blockquote> Which,
again, I find funny, because most Zen masters will tell you that the story--any Zen
story, in fact--has no "definitive" meaning, but has meaning based on how you interpret
it. (There are a few Zen parables that reinforce this point, but it gets a little
meta to justify my understanding of a Zen story by quoting another Zen story.) How
Matt chooses to interpret that parable is, of course, up to him. I choose to interpret
the story thusly: the insulted samurai felt that his "earned sense of pride" at his
sword mastery was insulted by the tea master--clearly no swordsman, as it says in
the story--wore robes of a rank and honor that he had not earned. And clearly, the
tea master was no swordsman. But what the tea master learned from his peer was not
how to use his concentration and discipline to improve his own swordsmanship, but
how to demonstrate that he had, in fact, earned a note of mastery through an entirely
different discipline than the insulted samurai's. The tea master still has no mastery
of the sword, but in his own domain, he is an expert. This was all the insulted samurai
needed to see, that the badge of honor had been earned, and not just imposed by a
capricious (and disrespectful) lord. Put a paintbrush and canvas into the hands of
a house painter, and you get pretty much a mess--but put a spray painter in the hands
of Leonardo, and you still get a mess. In fact, to really do the parable justice,
we should see how much "craft" Matt can bring when asked to paint a house, because
that's about how much relevance swordsmanship and house painting have in relationship
to one another. (All analogies fail eventually, by the way, and we're probably reaching
the boundaries of this one.)
<p>
Billy Hollis is a master with VB, far more than I ever will be; I know C++ far better
than he ever will. I respect his abilities, and he, mine. There is no argument here.
But more importantly, there are friends I've worked with in the past who are masters
with neither VB nor C++, nor any other programming language, but chose instead to
sink their time and energy into skiing, pottery, or being a fan of a television show.
They chose to put their energies--energies the "craftsmen" seem to say should be put
towards their programming--towards things that bring them joy, which happen to not
be programming.
</p><p>
Which brings me to another refrain that came up over and over again: <b>You criticize
the craftsman, but then you draw a distinction between "craftsman" and "laborer".
You're confusing (or confused).</b> First of all, I think it important to disambiguate
along two axes: those who are choosing to invest their time into learning to write
better software, and those who are choosing to look at writing code as "just" a job
as one axis, and along a second axis, the degree to which they have mastered programming.
By your own definitions, "craftsmen", can one be early in your mastery of programming
and still be a "craftsman"? Can one be a master bowler who's just picked up programming
and be considered a "craftsman"? Is the nature of "craftsmanship" a measure of your
skill, or is it your dedication to programming, or is it your dedication to something
in your life, period? (Remember, the tea master parable says that a master C++ developer
will see the master bowler and respect his mastery of bowling, even though he can't
code worth a crap. Would you call him a "craftsman"?)
</p><p></p><p>
Frankly, I will say, for the record, that I think there are people programming who
don't want to put a ton of time and energy into learning how to be better programmers.
(I suspect that most of them won't ever read this blog, either.) They see the job
as "just a job", and are willing to be taught how to do things, but aren't willing
to go off and learn how to do them on their own. They want to do the best job they
can, because they, like any human being, want to bring value to the world, but don't
have that passion for programming. They want to come in at 9, do their job, and go
home at 5. These are those whom I call "laborers". They are the "fisherman" in <a href="http://www.lifeprinciples.net/SuccessatLife.html">the
following story</a>: 
</p><blockquote><p>
The businessman was at the pier of a small coastal Mexican village when a small boat
with just one fisherman docked. Inside the small boat were several large yellowfin
tuna. The businessman complimented the Mexican on the quality of his fish and asked
how long it took to catch them. The Mexican replied only a little while.
</p><p>
The businessman then asked why he didn't stay out longer and catch more fish? The
Mexican said he had enough to support his family's immediate needs. The businessman
then asked, but what do you do with the rest of your time? The Mexican fisherman said,
"I sleep late, fish a little, play with my children, take a siesta with my wife, Maria,
stroll into the village each evening where I sip wine and play guitar with my amigos;
I have a full and busy life, señor."
</p><p>
The businessman scoffed, "I am a Harvard MBA and I could help you. You should spend
more time fishing and with the proceeds buy a bigger boat. With the proceeds from
the bigger boat you could buy several boats; eventually you would have a fleet of
fishing boats. Instead of selling your catch to a middleman, you would sell directly
to the processor and eventually open your own cannery. You would control the product,
processing and distribution. You would need to leave this small coastal fishing village
and move to Mexico City, then LA and eventually New York City where you would run
your expanding enterprise."
</p><p>
The Mexican fisherman asked, "But señor, how long will this all take?" To which the
businessman replied, "15-20 years." "But what then, señor?" The businessman laughed
and said, "That's the best part! When the time is right you would announce an IPO
and sell your company stock to the public and become very rich. You would make millions."
"Millions, señor? Then what?" The businessman said, "Then you would retire. Move to
a small coastal fishing village where you would sleep late, fish a little, play with
your kids, take a siesta with your wife, stroll to the village in the evenings where
you could sip wine and play your guitar with your amigos."
</p></blockquote><p>
What makes all of this (this particular subject, craftsmanship) particularly hard
for me is that I <i>like</i> the message that craftsmanship brings, in terms of how
you conduct yourself. I <i>love</i> the book <a href="http://www.amazon.com/Apprenticeship-Patterns-Guidance-Aspiring-Craftsman/dp/0596518382">Apprenticeship
Patterns</a>, for example, and think that anyone, novice or master, should read this
book. I have taken on speaking apprentices in the past, and will continue to do so
well into the future. The message that underlies the meme of craftsmanship--the constant
striving to improve--is a good one, and I don't want to throw the baby out with the
bathwater. If you have adopted "craftsmanship" as a core value of yours, then please,
by all means, continue to practice it! Myself, I choose to do so, as well. I have
mentored programmers, I have taken speaking apprentices, and I strive to learn more
about my craft by branching my studies out well beyond software--I am reading books
on management, psychology, building architecture, and business, because I think there
is more to software than just the choice of programming language or style.
</p><p>
But be aware that if you start telling people how you're living your life, there is
an implicit criticism or expectation that they should be doing that, as well. And
when you start criticizing other peoples' code as being "unelegant" or "unbeautiful"
or "unclean", you'd better be able to explain your value system and why you judged
it as so. Humility is a hard, hard path to tread, and one that I have only recently
started to see the outlines of; I am guilty of just about every sin imaginable when
it comes to this subject. I have created "elegant" systems that failed their original
intent. I have criticized "ugly" code that, in fact, served the purpose well. I have
bragged of my own accomplishments to those who accomplished a lot more than I did,
or ever will. And I consider it amazing to me that my friends who've been with me
since long before I started to eat my justly-deserved humble pie are still with me.
(And that those friends are some amazing people in their own right.; if a man is judged
by the company he keeps, then by looking around at my friends, I am judged to be a
king.) I will continue to strive to be better than I am now, though, even within this
discussion right now: those of you who took criticism with my post, you have good
points, all of you, and I certainly don't want to stop you from continuing on your
journeys of self-discovery, either.
</p><p>
And if we ever cross paths in person, I will buy you a beer so that we can sit down,
and we can continue this discussion in person.
</p><img width="0" height="0" src="http://blogs.tedneward.com/aggbug.ashx?id=07ef7e67-accd-4232-9bb2-99082d1e0200" /><br /><hr />
Enterprise consulting, mentoring or instruction. Java, C++, .NET or XML services.
1-day or multi-day workshops available. <a href="mailto:ted@tedneward.com">Contact
me for details</a>.</body>
      <title>More on "Craftsmanship"</title>
      <guid isPermaLink="false">http://blogs.tedneward.com/PermaLink,guid,07ef7e67-accd-4232-9bb2-99082d1e0200.aspx</guid>
      <link>http://blogs.tedneward.com/2013/01/26/More+On+Craftsmanship.aspx</link>
      <pubDate>Sat, 26 Jan 2013 06:24:27 GMT</pubDate>
      <description>&lt;p&gt;
&lt;b&gt;TL;DR&lt;/b&gt;: To all those who dissented, you're right, but you're wrong. Craftsmanship
is a noble meme, when it's something that somebody holds as a personal goal, but it's
often coming across as a way to beat up and denigrate on others who don't choose to
invest significant time and energy into programming. The Zen Masters didn't walk around
the countryside, proclaiming "I am a Zen Master!"
&lt;/p&gt;
&lt;p&gt;
Wow. Apparently I touched a nerve.
&lt;/p&gt;
&lt;p&gt;
It's been 48 hours since I posted &lt;a href="http://blogs.tedneward.com/2013/01/24/On+The+Dark+Side+Of+Craftsmanship.aspx"&gt;On
the Dark Side of 'Craftsmanship'&lt;/a&gt;, and it's gotten a ton of interest, as well as
a few syndicated re-posts (DZone and a few others). Comments to the blog included
a response from Dave Thomas, other blog posts have been brought to my attention, and
Twitter was on FIRE with people pinging me with their thoughts, which turn out to
be across the spectrum, approving and dissenting. Not at all what I really expected
to happen, to be honest--I kinda thought it would get lost in the noise of others
commenting around the whole thing.
&lt;/p&gt;
&lt;p&gt;
But for whatever reason, it's gotten a lot of attention, so I feel a certain responsibility
to respond and explain to some of the dissenters who've responded. Not to defend,
per se, but to at least demonstrate some recognition and attempt to clarify my position
where I think it's gotten mis-heard. (To those who approved of the message, thank
you for your support, and I'm happy to have vocalized something you felt unable, unwilling,
unheard, or too busy to vocalize yourself. I hope my explanations here continue to
represent your opinions, but if not, please feel free to let me know.)
&lt;/p&gt;
&lt;p&gt;
A lot of the opinions centered around a few core ideas, it seems, so let me try and
respond to those first.
&lt;/p&gt;
&lt;p&gt;
&lt;b&gt;You're confusing "craftsmanship" with a few people behaving badly.&lt;/b&gt; That may
well be, but those who behaved badly included at least one who holds himself up as
a leader of the craftsman movement and has held his actions up as indications of how
"craftsmen" should behave. When you do this, you invite this kind of criticism and
association. So if the movement is being given a black eye because of the actions
of a single individual, well, now you know how a bunch of moderate Republicans feel
about Paul Ryan.
&lt;/p&gt;
&lt;p&gt;
&lt;b&gt;Corey is a nice guy, he apologized, don't crucify him.&lt;/b&gt; Of course he is. Corey
is a nice guy--and, speaking well to his character, he apologized almost immediately
when it all broke. I learned a long time ago that "true sorry" means you (a) apologize
for your actions, (b) seek to remedy the damage your actions have caused ("make it
right", in other words), and (c) avoid making the same mistake in the future. From
a distance, it seems like he feels contrition, and has publicly apologized for his
actions. I would hope he's reached out to Heather directly to try and make things
right with her, but that's between the two of them. Whether he avoids this kind of
activity in the future remains to be seen. I think he will, but that's because I think
he's learned a harsh lesson about being in the spotlight--it tends to be a harsh place
to be. The rest of this really isn't about Corey and Heather anymore, so as far as
I'm concerned, that thread complete.
&lt;/p&gt;
&lt;p&gt;
&lt;b&gt;You misunderstand the nature of "craftsmanship".&lt;/b&gt; Actually, no, I don't. At
its heart, the original intent of "craftsmanship" was a constant striving to be better
about what you do, and taking pride in the things that you do. It's related to the
Japanese code of the samurai (kaizen) that says, in essence, that we are constantly
striving to get better. The samurai sought to become better swordsmen, constantly
challenging each other to prove the mettle against one another, improving their skills
and, conditioning, but also their honor, by how they treated each other, their lord,
their servants, and those they sought to protect. Kanban is a wonderful code, and
one I have tried to live my entire life, even before I'd discovered it. Please don't
assume that I misunderstand the teachings of your movement just because I don't go
to the meetings.
&lt;/p&gt;
&lt;p&gt;
&lt;b&gt;Why you pick on "craftsmanship", anyway? If I want to take pride in what I do,
what difference does it make?&lt;/b&gt; This is me paraphrasing on much of the dissent,
and my response boils down to two basic thoughts: 
&lt;ol&gt;
&lt;li&gt;
If you think your movement is "just about yourself", why invent a label to differentiate
yourself from the rest?&lt;/li&gt;
&lt;li&gt;
If you invent a label, it becomes almost automatic to draw a line between "us" and
"them", and that in of itself almost automatically leads to "us vs them" behavior
and mentality.&lt;/li&gt;
&lt;/ol&gt;
Look, I view this whole thing as kind of like religion: whatever you want to do behind
closed doors, that's your business. But when you start waving it in other peoples'
faces, then I have a problem with it. You want to spend time on the weekends improving
your skills, go for it. You want to spend time at night learning a bunch of programming
languages so you can improve your code and your ability to design systems, go for
it. You want to study psychology and philosophy so you can understand other people
better when it comes time to interact with them, go for it. And hey, you want to put
some code up somewhere so people can point to it and help you get it better, go for
it. But when you start waving all that time and dedication in my face, you're either
doing it because you want recognition, or you want to suggest that I'm somehow not
as good as you. Live the virtuous life, don't brag about it.&gt;
&lt;p&gt;
There were some specific blogs and comments that I think deserve discusson, too:
&lt;/p&gt;
&lt;p&gt;
Dave Thomas was kind enough to comment on my blog: &lt;blockquote&gt; I remember the farmer
comment :) I think I said 30%, but I stand by what I said. And it isn't really an
elitist stance. Instead, I feel that programming is hard work. At the end of a day
of coding, I'm tired. And so I believe that if you are asking someone to do programming,
then it is in both your and their interest that they are doing something they enjoy.
Because if they don't enjoy it, then they are truly just a laborer, working hard at
something that has no meaning to them. And as you spend 8 hours a day, 5 days a week
doing it, that seems like an awful waste of an intelligent person's life. &lt;/blockquote&gt; Sure,
programming is hard. So is house painting. They're different kinds of exhaustion,
but it's exhaustion all the same. But, frankly, if somebody has chosen to take up
a job that they do just because it's a job, that's their choice, and not ours to criticize,
in my opinion. (And I remember it as 50%, because I very clearly remember saying the
"way to insult half the room" crack after it, but maybe I misheard you. I do know
others also heard it at 50%, because an attendee or two came up to talk about it after
the panel. At least, that's how I remember it at the time. But the number itself is
kinda meaningless, now that I think about it.) &lt;blockquote&gt; The farming quote was
a deliberate attempt at being shocking to make a point. But I still think it is valid.
I'd guess that 30% of the developers I meet are not happy in their work. And I think
those folks would be happier and more fulfilled doing something else that gave them
more satisfaction. &lt;/blockquote&gt; Again, you and I are both in agreement, that people
should be doing what they love, but that's a personal judgment that each person is
permitted to make for themselves. There are aspects of our lives that we don't love,
but we do because they make other people happy (Juliet and Charlotte driving the boys
around to their various activities comes to mind, for example), and it is not our
position to judge how others choose for themselves, IMHO. &lt;blockquote&gt; No one should
have to be a laborer. &lt;/blockquote&gt; And here, you and I will disagree quite fundamentally:
as I believe it was Martin Luther King, Jr, who said, "If you are going to be a janitor,
be the best janitor you know how to be." It seems by that statement that you are saying
that people who labor with their bodies rather than your minds (and trust me, you
may not be a laborer anymore, big publishing magnate that you are, but I know I sure
still am) are somehow less well-off than those who have other people working for them.
Some people don't want the responsibility of being the boss, or the owner. See the
story of the mexican fisherman at the end of this blog.&gt;
&lt;p&gt;
Nate commented: &lt;blockquote&gt; You have a logical fallacy by lumping together the people
that derided Heather's code and people that are involved in software craftmanship.
It's actually a huge leap of logic to make that connection, and it really retracts
from the article. &lt;/blockquote&gt; As I point out later, the people who derided Heather's
code were some of the same folks who hold up software craftsmanship. That wasn't me
making that up. &gt;
&lt;p&gt;
&lt;blockquote&gt; Now you realise that you are planting your flag firmly in the 'craftmanship'
camp while propelling your position upwards by drawing a line in the sand to define
another group of people as 'labourers'. Or in other words attempt to elevate yourself
by patronising others with the position you think you are paying them a compliment.
Maybe you do not realise this? &lt;/blockquote&gt; No, I realize it, and it's a fair critique,
which is why I don't label myself as a "craftsman". I have more to say on this below. &lt;blockquote&gt; However,
have you considered that the craft is not how awesome and perfect you and your code
are, but what is applicable for the task at hand. I think most people who you would
put into either camp share the same mix of attributes whether good or bad. The important
thing is if the solution created does what it is designed to do, is delivered on time
for when it is needed and if the environment that the solution has been created for
warrants it, that the code is easily understandable by yourself and others (that matter)
so it can be developed further over time and maintained. &lt;/blockquote&gt; And the very
people who call themselves "craftsmen" criticized a piece of code that, as near as
I can tell, met all of those criteria. Hence my reaction that started this whole thing. &lt;blockquote&gt; I
don't wish to judge you, and maybe you are a great, smart guy who does good in the
world, but like you I have not researched anything about you, I have simply read your
assessment above and come to a conclusion, that's being human I guess. &lt;/blockquote&gt; Oh,
people judge each other all the time, and it's high time we stopped beating them up
for it. It's human to judge. And while it would be politically correct to say, "You
shouldn't judge me before you know me", fact is, of course you're going to do exactly
that, because you don't have time to get to know me. And the fact that you don't know
me except but through the blog is totally acceptable--you shouldn't have to research
me in order to have an opinion. So we're all square on that point. (As to whether
I'm a great smart guy who does good in the world, well, that's for others to judge
in my opinion, not mine.) &lt;blockquote&gt; The above just sounds like more of the same
'elitism' that has been ripe in this world from playground to the workplace since
the beginning. &lt;/blockquote&gt; It does, doesn't it? And hopefully I clarify the position
more clearly later. &gt;
&lt;p&gt;
In &lt;a href="http://rtigger.com/blog/2013/01/25/its-okay-to-love-your-job/"&gt;It's OK
to love your job&lt;/a&gt;, Chad McCallum says that &lt;blockquote&gt; The basic premise (or at
least the one the author start out with) is that because there’s a self-declared group
of “software craftspeople”, there is going to be an egotistical divide between those
who “get it” and those who don’t. &lt;/blockquote&gt; Like it or not, Chad, that egotistical
divide is there. You can "call bullshit" all day long, but look at the reactions that
have popped up over this--people feel that divide, and frankly, it's one that's been
there for a long, long time. This isn't just me making this up.&gt;
&lt;p&gt;
Chad also says, &lt;blockquote&gt; 
&lt;p&gt;
It’s true the feedback that Heather got was unnecessarily negative. And that it came
from people who are probably considered “software craftspeople”. That said, correlation
doesn’t equal causation. I’m guessing the negative feedback was more because those
original offenders had a bad day and needed to vent. And maybe the comments after
that one just jumped on the bandwagon because someone with lots of followers and/or
respect said it.
&lt;/p&gt;
&lt;p&gt;
These are both things that can and have happened to anyone, regardless of the industry
they work in. It’s extremely unfair to associate “someone who’s passionate about software
development” to “person who’s waiting to jump on you for your mistakes”.
&lt;/p&gt;
&lt;/blockquote&gt; Unfortunately, Chad, the excuse that "others do it, too" is not an acceptable
excuse. If everybody jumped off a cliff, would you do it, too? I understand the rationale--it's
extremely hard being the one to go against the herd (I've got the psychological studies
I can cite at you that prove it), but that doesn't make it OK or excuse it. Saying
"it happens in other industries" is just an extension of that. In other industries,
women are still explicitly discriminated against--does that make it OK for us to do
that, too?&gt;
&lt;p&gt;
Chad closes his blog with "Stop calling us egotistical jerks just because we love
what we do." To which I respond, "I am happy to do so, as soon as those 'craftsmen'
who are acting like one, stop acting like one." If you're not acting like one, then
there should be no argument here. If you're trying to tell me that your label is somehow
immune to criticism, then I think we just have to agree to disagree.
&lt;/p&gt;
&lt;p&gt;
Paul Pagel (on a site devoted to software craftsmanship, no less) responded as well
with his &lt;a href="http://blog.8thlight.com/paul-pagel/2013/01/24/humble-pursuit-of-mastery.html"&gt;Humble
Pursuit of Mastery&lt;/a&gt;. He opens with: &lt;blockquote&gt; I have been reading on blogs and
tweets the sentiment that "software craftsmanship is elitism". This perception is
formed around comments of code, process, or techniques. I understand a craftsman's
earned sense of pride in their work can sometimes be inappropriately communicated. &lt;/blockquote&gt; I
don't think I commented on code, process or technique, so I can't be sure if this
is directly refuting what I'm saying, but I note that Paul has already touched on
the meme he wants to communicate in his last phrase: the craftsman's "earned sense
of pride". I have no problem with the work being something that you take pride in;
I note, however, that "pride goeth before a fall", and note that, again, Ozymandias
was justifiably proud of his accomplishments, too.&gt;
&lt;p&gt;
Paul then goes through a summation of his career, making sure to smallcaps certain
terms with which I have no argument: "sacrifice", "listen", "practicing", "critique"
and "teaching". And, in all honesty, these are things that I embrace, as well. But
I start getting a little dubious about the sanctity of your terminology, Paul, when
it's being used pretty blatantly as an advertising slogan and theme all over the site--if
you want the term to remain a Zen-like pursuit, then you need to keep the commercialism
out of it, in my opinion, or you invite the kind of criticism that's coming here (explicit
or implicit).
&lt;/p&gt;
&lt;p&gt;
Paul's conclusion wraps up with: &lt;blockquote&gt; Do sacrificing, listening, practice,
critiquing, and teaching sound like elitist qualities to you? Software craftsmanship
starts out as a humble endeavor moving towards mastery. I won't let 140 or 1000 characters
redefine the hours and years spent working hard to become a craftsman. It gave me
humility and the confidence to be a professional software developer. Sometimes I let
confidence get the better of me, but I know when that happens I am not honoring the
spirit of craftsmanship which I was trained. &lt;/blockquote&gt; Humility enough to trademark
your phrase "Software is our craft"? Humility enough to call yourself a "driving force"
behind software craftsmanship? Don't get me wrong, Paul, there is a certain amount
of commercialism that any consultant must adopt in order to survive--but either please
don't mix your life-guiding principles with your commercialism, or else don't be surprised
when others take aim at your "humility" when you do. It's the same when ministers
stand in a multi-million dollar building on a Sunday morning and talk about the parable
of the widow giving away her last two coppers--that smacks of hypocrisy.&gt;
&lt;p&gt;
Finally, Matt van Horn wrote in &lt;a href="http://www.mattvanhorn.com/2013/01/24/craftsmanship-a-rebuttal/"&gt;Crafsmanship,
a rebuttal&lt;/a&gt; that: &lt;blockquote&gt; there is an allusion to software craftsmen as being
an exclusive group who agre on the “right” tools and techniques. This could not be
further from the truth. Anyone who is serious about their craft knows that for every
job there are some tools that are better and some that are worse. &lt;/blockquote&gt; ...
but then he goes right into making that exact mistake: &lt;blockquote&gt; Now, I may not
have a good definition of elegant code, but I definitely know it when I see it – regardless
of who wrote it. If you can’t see that 
&lt;br /&gt;
&lt;pre&gt;
(1..10).each{|i| puts i}
&lt;/pre&gt;
&lt;br /&gt;
is more elegant than 
&lt;br /&gt;
&lt;pre&gt;
x = 0
while true do
  x = x + 1
  if x &gt; 10
    break
  end
  puts x
end
&lt;/pre&gt;
then you must near the beginning of your journey towards mastery. Practicing your
craft develops your ability to recognize these differences, just as a skilled tailor
can more easily spot the difference between a bespoke suit and something from Men’s
Wearhouse. &lt;/blockquote&gt; Matt, you kind of make my point for me. What makes it elegant?
You take it as self-evident. I don't. As a matter of fact, I've been asking this question
for some years now, "What makes code 'elegant', as opposed to 'ugly'? Ironically,
Elliott Rusty Harold just blogged about how this style of coding is dangerous in Java,
and got crucified for it, but he has the point that functional style (your first example)
doesn't JIT as well as the more imperative style right now on the JVM (or on the CLR,
from what I can tell). Are you assuming that this will be running on a native Ruby
implementation, on JRuby, IronRuby, ...? You have judged the code in the second example
based on an intrinsic value system that you may have never questioned. To judge, you
have to be able to explain your judgments in terms of the value system. And the fact
that you judge without any context, kind of speaks directly to the point I was trying
to make: "craftsmen", it seems, have this tendency to judge in absence of context,
because they are clearly "further down their journey towards mastery", to use your
own metaphor.&gt;
&lt;p&gt;
Or, to put it much more succinctly, "Beauty is in the eye of the beholder".
&lt;/p&gt;
&lt;p&gt;
Matt then tells me I missed the point of the samurai and tea master story: &lt;blockquote&gt; inally,
he closes with a famous zen story, but he entirely misses the point of it. The story
concerns a tea master, and a samurai, who get into a duel. The tea master prevails
by bringing the same concentration to the duel that he brings to his tea ceremony.
The point that Ted seems to miss here is that the tea master is a craftsman of the
highest order. A master of cha-do (the way of tea) is able to transform the simple
act of making and pouring a cup of tea into something transcendant by bringing to
this simple act a clear mind, a good attitude, and years of patient, humble practice.
Arguably he prevails because he has perfected his craft to a higher degree than the
samurai has perfected his own. That is why he has earned the right to wear the garb
of a samurai, and why he is able to face down his opponent. &lt;/blockquote&gt; Which, again,
I find funny, because most Zen masters will tell you that the story--any Zen story,
in fact--has no "definitive" meaning, but has meaning based on how you interpret it.
(There are a few Zen parables that reinforce this point, but it gets a little meta
to justify my understanding of a Zen story by quoting another Zen story.) How Matt
chooses to interpret that parable is, of course, up to him. I choose to interpret
the story thusly: the insulted samurai felt that his "earned sense of pride" at his
sword mastery was insulted by the tea master--clearly no swordsman, as it says in
the story--wore robes of a rank and honor that he had not earned. And clearly, the
tea master was no swordsman. But what the tea master learned from his peer was not
how to use his concentration and discipline to improve his own swordsmanship, but
how to demonstrate that he had, in fact, earned a note of mastery through an entirely
different discipline than the insulted samurai's. The tea master still has no mastery
of the sword, but in his own domain, he is an expert. This was all the insulted samurai
needed to see, that the badge of honor had been earned, and not just imposed by a
capricious (and disrespectful) lord. Put a paintbrush and canvas into the hands of
a house painter, and you get pretty much a mess--but put a spray painter in the hands
of Leonardo, and you still get a mess. In fact, to really do the parable justice,
we should see how much "craft" Matt can bring when asked to paint a house, because
that's about how much relevance swordsmanship and house painting have in relationship
to one another. (All analogies fail eventually, by the way, and we're probably reaching
the boundaries of this one.)&gt;
&lt;p&gt;
Billy Hollis is a master with VB, far more than I ever will be; I know C++ far better
than he ever will. I respect his abilities, and he, mine. There is no argument here.
But more importantly, there are friends I've worked with in the past who are masters
with neither VB nor C++, nor any other programming language, but chose instead to
sink their time and energy into skiing, pottery, or being a fan of a television show.
They chose to put their energies--energies the "craftsmen" seem to say should be put
towards their programming--towards things that bring them joy, which happen to not
be programming.
&lt;/p&gt;
&lt;p&gt;
Which brings me to another refrain that came up over and over again: &lt;b&gt;You criticize
the craftsman, but then you draw a distinction between "craftsman" and "laborer".
You're confusing (or confused).&lt;/b&gt; First of all, I think it important to disambiguate
along two axes: those who are choosing to invest their time into learning to write
better software, and those who are choosing to look at writing code as "just" a job
as one axis, and along a second axis, the degree to which they have mastered programming.
By your own definitions, "craftsmen", can one be early in your mastery of programming
and still be a "craftsman"? Can one be a master bowler who's just picked up programming
and be considered a "craftsman"? Is the nature of "craftsmanship" a measure of your
skill, or is it your dedication to programming, or is it your dedication to something
in your life, period? (Remember, the tea master parable says that a master C++ developer
will see the master bowler and respect his mastery of bowling, even though he can't
code worth a crap. Would you call him a "craftsman"?)&lt;p&gt;
&lt;p&gt;
Frankly, I will say, for the record, that I think there are people programming who
don't want to put a ton of time and energy into learning how to be better programmers.
(I suspect that most of them won't ever read this blog, either.) They see the job
as "just a job", and are willing to be taught how to do things, but aren't willing
to go off and learn how to do them on their own. They want to do the best job they
can, because they, like any human being, want to bring value to the world, but don't
have that passion for programming. They want to come in at 9, do their job, and go
home at 5. These are those whom I call "laborers". They are the "fisherman" in &lt;a href="http://www.lifeprinciples.net/SuccessatLife.html"&gt;the
following story&lt;/a&gt;: &lt;blockquote&gt; 
&lt;p&gt;
The businessman was at the pier of a small coastal Mexican village when a small boat
with just one fisherman docked. Inside the small boat were several large yellowfin
tuna. The businessman complimented the Mexican on the quality of his fish and asked
how long it took to catch them. The Mexican replied only a little while.
&lt;/p&gt;
&lt;p&gt;
The businessman then asked why he didn't stay out longer and catch more fish? The
Mexican said he had enough to support his family's immediate needs. The businessman
then asked, but what do you do with the rest of your time? The Mexican fisherman said,
"I sleep late, fish a little, play with my children, take a siesta with my wife, Maria,
stroll into the village each evening where I sip wine and play guitar with my amigos;
I have a full and busy life, señor."
&lt;/p&gt;
&lt;p&gt;
The businessman scoffed, "I am a Harvard MBA and I could help you. You should spend
more time fishing and with the proceeds buy a bigger boat. With the proceeds from
the bigger boat you could buy several boats; eventually you would have a fleet of
fishing boats. Instead of selling your catch to a middleman, you would sell directly
to the processor and eventually open your own cannery. You would control the product,
processing and distribution. You would need to leave this small coastal fishing village
and move to Mexico City, then LA and eventually New York City where you would run
your expanding enterprise."
&lt;/p&gt;
&lt;p&gt;
The Mexican fisherman asked, "But señor, how long will this all take?" To which the
businessman replied, "15-20 years." "But what then, señor?" The businessman laughed
and said, "That's the best part! When the time is right you would announce an IPO
and sell your company stock to the public and become very rich. You would make millions."
"Millions, señor? Then what?" The businessman said, "Then you would retire. Move to
a small coastal fishing village where you would sleep late, fish a little, play with
your kids, take a siesta with your wife, stroll to the village in the evenings where
you could sip wine and play your guitar with your amigos."
&lt;/p&gt;
&lt;/blockquote&gt; &gt;
&lt;p&gt;
What makes all of this (this particular subject, craftsmanship) particularly hard
for me is that I &lt;i&gt;like&lt;/i&gt; the message that craftsmanship brings, in terms of how
you conduct yourself. I &lt;i&gt;love&lt;/i&gt; the book &lt;a href="http://www.amazon.com/Apprenticeship-Patterns-Guidance-Aspiring-Craftsman/dp/0596518382"&gt;Apprenticeship
Patterns&lt;/a&gt;, for example, and think that anyone, novice or master, should read this
book. I have taken on speaking apprentices in the past, and will continue to do so
well into the future. The message that underlies the meme of craftsmanship--the constant
striving to improve--is a good one, and I don't want to throw the baby out with the
bathwater. If you have adopted "craftsmanship" as a core value of yours, then please,
by all means, continue to practice it! Myself, I choose to do so, as well. I have
mentored programmers, I have taken speaking apprentices, and I strive to learn more
about my craft by branching my studies out well beyond software--I am reading books
on management, psychology, building architecture, and business, because I think there
is more to software than just the choice of programming language or style.
&lt;/p&gt;
&lt;p&gt;
But be aware that if you start telling people how you're living your life, there is
an implicit criticism or expectation that they should be doing that, as well. And
when you start criticizing other peoples' code as being "unelegant" or "unbeautiful"
or "unclean", you'd better be able to explain your value system and why you judged
it as so. Humility is a hard, hard path to tread, and one that I have only recently
started to see the outlines of; I am guilty of just about every sin imaginable when
it comes to this subject. I have created "elegant" systems that failed their original
intent. I have criticized "ugly" code that, in fact, served the purpose well. I have
bragged of my own accomplishments to those who accomplished a lot more than I did,
or ever will. And I consider it amazing to me that my friends who've been with me
since long before I started to eat my justly-deserved humble pie are still with me.
(And that those friends are some amazing people in their own right.; if a man is judged
by the company he keeps, then by looking around at my friends, I am judged to be a
king.) I will continue to strive to be better than I am now, though, even within this
discussion right now: those of you who took criticism with my post, you have good
points, all of you, and I certainly don't want to stop you from continuing on your
journeys of self-discovery, either.
&lt;/p&gt;
&lt;p&gt;
And if we ever cross paths in person, I will buy you a beer so that we can sit down,
and we can continue this discussion in person.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blogs.tedneward.com/aggbug.ashx?id=07ef7e67-accd-4232-9bb2-99082d1e0200" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
Enterprise consulting, mentoring or instruction. Java, C++, .NET or XML services.
1-day or multi-day workshops available. &lt;a href="mailto:ted@tedneward.com"&gt;Contact
me for details&lt;/a&gt;.</description>
      <comments>http://blogs.tedneward.com/CommentView,guid,07ef7e67-accd-4232-9bb2-99082d1e0200.aspx</comments>
      <category>.NET</category>
      <category>C#</category>
      <category>C++</category>
      <category>Conferences</category>
      <category>Development Processes</category>
      <category>F#</category>
      <category>Industry</category>
      <category>Java/J2EE</category>
      <category>Languages</category>
      <category>Objective-C</category>
      <category>Parrot</category>
      <category>Personal</category>
      <category>Reading</category>
      <category>Review</category>
      <category>Ruby</category>
      <category>Scala</category>
      <category>Social</category>
      <category>Windows</category>
    </item>
    <item>
      <trackback:ping>http://blogs.tedneward.com/Trackback.aspx?guid=73f28449-07ec-4638-8bf6-24dd3c400c39</trackback:ping>
      <pingback:server>http://blogs.tedneward.com/pingback.aspx</pingback:server>
      <pingback:target>http://blogs.tedneward.com/PermaLink,guid,73f28449-07ec-4638-8bf6-24dd3c400c39.aspx</pingback:target>
      <dc:creator>Ted Neward</dc:creator>
      <wfw:comment>http://blogs.tedneward.com/CommentView,guid,73f28449-07ec-4638-8bf6-24dd3c400c39.aspx</wfw:comment>
      <wfw:commentRss>http://blogs.tedneward.com/SyndicationService.asmx/GetEntryCommentsRss?guid=73f28449-07ec-4638-8bf6-24dd3c400c39</wfw:commentRss>
      <slash:comments>14</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
I don't know Heather Arthur from Eve. Never met her, never read an article by her,
seen a video she's in or shot, or seen her code. Matter of fact, I don't even know
that she is a "she"--I'm just guessing from the name.
</p>
        <p>
But apparently she got <a href="http://harthur.wordpress.com/2013/01/24/771/">quite
an ugly reaction</a> from a few folks when she open-sourced some code: 
</p>
        <blockquote> So I went to see what people were saying about this project. I searched
Twitter and several tweets came up. One of them, I guess the original one, was basically
like “hey, this is cool”, but then the rest went like this: 
<br />
"I cannot even make this stuff up." --@steveklabnik 
<br />
"Ever wanted to make sed or grep worse?" --@zeeg 
<br />
"@steveklabnik or just point to the actual code file. eyes bleeding!" --@coreyhaines 
<br />
At this point, all I know is that by creating this project I’ve done something very
wrong. It seemed liked I’d done something fundamentally wrong, so stupid that it flabbergasts
someone. So wrong that it doesn’t even need to be explained. And my code is so bad
it makes people’s eyes bleed. So of course I start sobbing. </blockquote> Now, to
be fair, <a href="http://programmingtour.blogspot.com/2013/01/im-sorry.html">Corey
later apologized</a>. But I'm still going to criticize the response. Not because Heather's
a "she" and we should be more supportive of women in IT. Not because somebody took
something they found interesting and put it up on github for anyone to take a look
at and use if they found it useful. Not even because it's good code when they said
it was bad code or vice versa. (To be honest, I haven't even looked at the code--that's
how immaterial it is to my point.)
<p>
I'm criticizing because this is what "software craftsmanship" gets us: an imposed
segregation of those who "get it" from those who "don't" based on somebody's arbitrary
criteria of what we should or shouldn't be doing. And if somebody doesn't use the
"right" tools or code it in the "right" way, then bam! You clearly aren't a "craftsman"
(or "craftswoman"?) and you clearly don't care about your craft and you clearly aren't
worth the time or energy necessary to support and nourish and grow and....
</p><p>
Frankly, I've not been a fan of this movement since its inception. Dave Thomas (Ruby
Dave) was on a software panel with me at a No Fluff Just Stuff show about five years
ago when we got on to this subject, and Dave said, point blank, "About half of the
programmers in the world should just go take up farming." He paused, and in the moment
that followed, I said, "Wow, Dave, way to insult half the room." He immediately pointed
out that the people in the room were part of the first half, since they were at a
conference, but it just sort of underscored to me how high-handed and high-minded
that kind of talk and position can be.
</p><p>
Not all of us writing code have to be artists. Frankly, in the world of painting,
there are those who will spend hours and days and months, tiny brushes in hand, jars
of pigment just one lumens different from one another, laboring over the finest details,
creating just one piece... and then there are those who paint houses with paint-sprayers,
out of cans of mass-produced "Cream Beige" found at your local Lowes. And you know
what? <i>We need both of them.</i></p><p>
I will now coin a term that I consider to be the opposite of "software craftsman":
the "software laborer". In my younger days, believing myself to be one of those "craftsmen",
a developer who knew C++ in and out, who understood memory management and pointers,
who could create elegant and useful solutions in templates and classes and inheritance,
I turned up my nose at those "laborers" who cranked out one crappy app after another
in (what else?) Visual Basic. My app was tight, lean, and well-tuned; their apps were
sloppy, bloated, and ugly. My app was a paragon of reused code; their apps were cut-and-paste
cobbled-together duct-tape wonders. My app was a shining beacon on a hill for all
the world to admire; their apps were mindless drones, slogging through the mud....
Yeah, OK, so you get the idea.
</p><p>
But the funny thing was, those "laborers" were going home at 5 every day. Me, I was
staying sometimes until 9pm, wallowing in the wonderment of my code. And, I have to
wonder, how much of that was actually not the wonderment of my code, but the wonderment
of "me" over the wonderment of "code".
</p><p>
Speaking of, by the way, there appear to be the makings of another such false segregation,
in the areas of "functional programming". In defense of Elliott Rusty Harold's blog
the other day (which I criticized, and still stand behind, for the reasons I cited
there), there are a lot of programmers that are falling into the trap of thinking
that "all the cool kids are using functional programming, so if I want to be a cool
kid, I have to use functional programming too, even though I'm not sure what I'm doing....".
Not all the cool kids are using FP. Some aren't even using OOP. Some are just happily
humming along using good ol' fashioned C. And producing some really quality stuff
doing so.
</p><p>
See, I have to wonder just how much of the software "craftsmanship" being touted isn't
really a narcissistic "Look at me, world! Look at how much better I am because I care
about what I do! Look upon my works, ye mighty, and despair!" kind of mentality. Too
much of software "craftsmanship" seems to be about the "me" part of "my code". And
when I think about why that is, I come to an interesting assertion: That if we take
the name away from the code, and just look at the code, we can't really tell what's
"elegant" code, what's "hack" code, and what was "elegant hack because there were
all these other surrounding constraints outside the code". Without the context, we
can't tell.
</p><p>
A few years after my high point as a C++ "craftsman", I was asked to do a short, one-week
programming gig/assignment, and the more I looked at it, the more it screamed "VB"
at me. And I discovered that what would've taken me probably a month to do in C++
was easily accomplished in a few days in VB. I remember looking at the code, and feeling
this sickening, sinking sense of despair at how stupid I must've looked, crowing.
VB isn't a bad language--and neither is C++. Or Java. Or C#. Or Groovy, or Scala,
or Python, or, heck, just about any language you choose to name. (Except Perl. I refuse
to cave on that point. Mostly for comedic effect.)
</p><p>
But more importantly, somebody who comes in at 9, does what they're told, leaves at
5, and <i>never gives a rat's ass about programming except for what they need to know
to get their job done</i>, I have respect for them. Yes, some people will want to
hold themselves up as "painters", and others will just show up at your house at 8
in the morning with drop cloths. Both have their place in the world. Neither should
be denigrated for their choices about how they live their lives or manage their careers.
(Yes, there's a question of professional ethics--I want the house painters to make
sure they do a good job, too, but quality can come just as easily from the nozzle
of a spray painter as it does from the tip of a paintbrush.)
</p><p>
I end this with one of my favorite parables from Japanese lore: 
</p><blockquote><p>
Several centuries ago, a tea master worked in the service of Lord Yamanouchi. No-one
else performed the way of the tea to such perfection. The timing and the grace of
his every move, from the unfurling of mat, to the setting out of the cups, and the
sifting of the green leaves, was beauty itself. His master was so pleased with his
servant, that he bestowed upon him the rank and robes of a Samurai warrior.
</p><p>
When Lord Yamanouchi travelled, he always took his tea master with him, so that others
could appreciate the perfection of his art. On one occasion, he went on business to
the great city of Edo, which we now know as Tokyo.
</p><p>
When evening fell, the tea master and his friends set out to explore the pleasure
district, known as the floating world. As they turned the corner of a wooden pavement,
they found themselves face to face with two Samurai warriors.
</p><p>
The tea master bowed, and politely step into the gutter to let the fearsome ones pass.
But although one warrior went by, the other remained rooted to the spot. He stroked
a long black whisker that decorated his face, gnarled by the sun, and scarred by the
sword. His eyes pierced through the tea maker’s heart like an arrow.
</p><p>
He did not quite know what to make of the fellow who dressed like a fellow Samurai,
yet who would willingly step aside into a gutter. What kind of warrior was this? He
looked him up and down. Where were broad shoulders and the thick neck of a man of
force and muscle? Instinct told him that this was no soldier. He was an impostor who
by ignorance or impudence had donned the uniform of a Samurai. He snarled: “Tell me,
oh strange one, where are you from and what is your rank?”
</p><p>
The tea master bowed once more. “It is my honour to serve Lord Yamanouchi and I am
his master of the way of the tea.”
</p><p>
“A tea-sprout who dares to wear the robes of Samurai?” exclaimed the rough warrior.
</p><p>
The tea master’s lip trembled. He pressed his hands together and said: “My lord has
honoured me with the rank of a Samurai and he requires me to wear these robes. “
</p><p>
The warrior stamped the ground like a raging a bull and exclaimed: “He who wears the
robes of a Samurai must fight like a Samurai. I challenge you to a duel. If you die
with dignity, you will bring honour to your ancestors. And if you die like a dog,
at least you will be no longer insult the rank of the Samurai !”
</p><p>
By now, the hairs on the tea master’s neck were standing on end like the feet of a
helpless centipede that has been turned upside down. He imagined he could feel that
edge of the Samurai blade against his skin. He thought that his last second on earth
had come.
</p><p>
But the corner of the street was no place for a duel with honour. Death is a serious
matter, and everything has to be arranged just so. The Samurai’s friend spoke to the
tea master’s friends, and gave them the time and the place for the mortal contest.
</p><p>
When the fierce warriors had departed, the tea master’s friends fanned his face and
treated his faint nerves with smelling salts. They steadied him as they took him into
a nearby place of rest and refreshment. There they assured him that there was no need
to fear for his life. Each one of them would give freely of money from his own purse,
and they would collect a handsome enough sum to buy the warrior off and make him forget
his desire to fight a duel. And if by chance the warrior was not satisfied with the
bribe, then surely Lord Yamanouchi would give generously to save his much prized master
of the way of the tea.
</p><p>
But these generous words brought no cheer to the tea master. He thought of his family,
and his ancestors, and of Lord Yamanouchi himself, and he knew that he must not bring
them any reason to be ashamed of him.
</p><p>
“No,” he said with a firmness that surprised his friends. “I have one day and one
night to learn how to die with honour, and I will do so.”
</p><p>
And so speaking, he got up and returned alone to the court of Lord Yamanouchi. There
he found his equal in rank, the master of fencing, he was skilled as no other in the
art of fighting with a sword.
</p><p>
“Master,” he said, when he had explained his tale, “Teach me to die like a Samurai.”
</p><p>
But the master of fencing was a wise man, and he had a great respect for the master
of the Tea ceremony. And so he said: “I will teach you all you require, but first,
I ask that you perform the way of the Tea for me one last time.”
</p><p>
The tea master could not refuse this request. As he performed the ceremony, all trace
of fear seemed to leave his face. He was serenely concentrated on the simple but beautiful
cups and pots, and the delicate aroma of the leaves. There was no room in his mind
for anxiety. His thoughts were focused on the ritual.
</p><p>
When the ceremony was complete, the fencing master slapped his thigh and exclaimed
with pleasure : “There you have it. No need to learn anything of the way of death.
Your state of mind when you perform the tea ceremony is all that is required. When
you see your challenger tomorrow, imagine that you are about to serve tea for him.
Salute him courteously, express regret that you could not meet him sooner, take of
your coat and fold it as you did just now. Wrap your head in a silken scarf and and
do it with the same serenity as you dress for the tea ritual. Draw your sword, and
hold it high above your head. Then close your eyes and ready yourself for combat.
“
</p><p>
And that is exactly what the tea master did when, the following morning, at the crack
of dawn he met his opponent. The Samurai warrior had been expecting a quivering wreck
and he was amazed by the tea master’s presence of mind as he prepared himself for
combat. The Samurai’s eyes were opened and he saw a different man altogether. He thought
he must have fallen victim to some kind of trick or deception ,and now it was he who
feared for his life. The warrior bowed, asked to be excused for his rude behaviour,
and left the place of combat with as much speed and dignity as he could muster.
</p></blockquote> (excerpted from <a href="http://storynory.com/2011/03/27/the-samurai-and-the-tea-master/">http://storynory.com/2011/03/27/the-samurai-and-the-tea-master/</a>) 
<p>
My name is Ted Neward. And I bow with respect to the "software laborers" of the world,
who churn out quality code without concern for "craftsmanship", because their lives
are more than just their code.
</p><img width="0" height="0" src="http://blogs.tedneward.com/aggbug.ashx?id=73f28449-07ec-4638-8bf6-24dd3c400c39" /><br /><hr />
Enterprise consulting, mentoring or instruction. Java, C++, .NET or XML services.
1-day or multi-day workshops available. <a href="mailto:ted@tedneward.com">Contact
me for details</a>.</body>
      <title>On the Dark Side of "Craftsmanship"</title>
      <guid isPermaLink="false">http://blogs.tedneward.com/PermaLink,guid,73f28449-07ec-4638-8bf6-24dd3c400c39.aspx</guid>
      <link>http://blogs.tedneward.com/2013/01/24/On+The+Dark+Side+Of+Craftsmanship.aspx</link>
      <pubDate>Thu, 24 Jan 2013 05:06:24 GMT</pubDate>
      <description>&lt;p&gt;
I don't know Heather Arthur from Eve. Never met her, never read an article by her,
seen a video she's in or shot, or seen her code. Matter of fact, I don't even know
that she is a "she"--I'm just guessing from the name.
&lt;/p&gt;
&lt;p&gt;
But apparently she got &lt;a href="http://harthur.wordpress.com/2013/01/24/771/"&gt;quite
an ugly reaction&lt;/a&gt; from a few folks when she open-sourced some code: &lt;blockquote&gt; So
I went to see what people were saying about this project. I searched Twitter and several
tweets came up. One of them, I guess the original one, was basically like “hey, this
is cool”, but then the rest went like this: 
&lt;br /&gt;
"I cannot even make this stuff up." --@steveklabnik 
&lt;br /&gt;
"Ever wanted to make sed or grep worse?" --@zeeg 
&lt;br /&gt;
"@steveklabnik or just point to the actual code file. eyes bleeding!" --@coreyhaines 
&lt;br /&gt;
At this point, all I know is that by creating this project I’ve done something very
wrong. It seemed liked I’d done something fundamentally wrong, so stupid that it flabbergasts
someone. So wrong that it doesn’t even need to be explained. And my code is so bad
it makes people’s eyes bleed. So of course I start sobbing. &lt;/blockquote&gt; Now, to
be fair, &lt;a href="http://programmingtour.blogspot.com/2013/01/im-sorry.html"&gt;Corey
later apologized&lt;/a&gt;. But I'm still going to criticize the response. Not because Heather's
a "she" and we should be more supportive of women in IT. Not because somebody took
something they found interesting and put it up on github for anyone to take a look
at and use if they found it useful. Not even because it's good code when they said
it was bad code or vice versa. (To be honest, I haven't even looked at the code--that's
how immaterial it is to my point.)&gt;
&lt;p&gt;
I'm criticizing because this is what "software craftsmanship" gets us: an imposed
segregation of those who "get it" from those who "don't" based on somebody's arbitrary
criteria of what we should or shouldn't be doing. And if somebody doesn't use the
"right" tools or code it in the "right" way, then bam! You clearly aren't a "craftsman"
(or "craftswoman"?) and you clearly don't care about your craft and you clearly aren't
worth the time or energy necessary to support and nourish and grow and....
&lt;/p&gt;
&lt;p&gt;
Frankly, I've not been a fan of this movement since its inception. Dave Thomas (Ruby
Dave) was on a software panel with me at a No Fluff Just Stuff show about five years
ago when we got on to this subject, and Dave said, point blank, "About half of the
programmers in the world should just go take up farming." He paused, and in the moment
that followed, I said, "Wow, Dave, way to insult half the room." He immediately pointed
out that the people in the room were part of the first half, since they were at a
conference, but it just sort of underscored to me how high-handed and high-minded
that kind of talk and position can be.
&lt;/p&gt;
&lt;p&gt;
Not all of us writing code have to be artists. Frankly, in the world of painting,
there are those who will spend hours and days and months, tiny brushes in hand, jars
of pigment just one lumens different from one another, laboring over the finest details,
creating just one piece... and then there are those who paint houses with paint-sprayers,
out of cans of mass-produced "Cream Beige" found at your local Lowes. And you know
what? &lt;i&gt;We need both of them.&lt;/i&gt;
&lt;/p&gt;
&lt;p&gt;
I will now coin a term that I consider to be the opposite of "software craftsman":
the "software laborer". In my younger days, believing myself to be one of those "craftsmen",
a developer who knew C++ in and out, who understood memory management and pointers,
who could create elegant and useful solutions in templates and classes and inheritance,
I turned up my nose at those "laborers" who cranked out one crappy app after another
in (what else?) Visual Basic. My app was tight, lean, and well-tuned; their apps were
sloppy, bloated, and ugly. My app was a paragon of reused code; their apps were cut-and-paste
cobbled-together duct-tape wonders. My app was a shining beacon on a hill for all
the world to admire; their apps were mindless drones, slogging through the mud....
Yeah, OK, so you get the idea.
&lt;/p&gt;
&lt;p&gt;
But the funny thing was, those "laborers" were going home at 5 every day. Me, I was
staying sometimes until 9pm, wallowing in the wonderment of my code. And, I have to
wonder, how much of that was actually not the wonderment of my code, but the wonderment
of "me" over the wonderment of "code".
&lt;/p&gt;
&lt;p&gt;
Speaking of, by the way, there appear to be the makings of another such false segregation,
in the areas of "functional programming". In defense of Elliott Rusty Harold's blog
the other day (which I criticized, and still stand behind, for the reasons I cited
there), there are a lot of programmers that are falling into the trap of thinking
that "all the cool kids are using functional programming, so if I want to be a cool
kid, I have to use functional programming too, even though I'm not sure what I'm doing....".
Not all the cool kids are using FP. Some aren't even using OOP. Some are just happily
humming along using good ol' fashioned C. And producing some really quality stuff
doing so.
&lt;/p&gt;
&lt;p&gt;
See, I have to wonder just how much of the software "craftsmanship" being touted isn't
really a narcissistic "Look at me, world! Look at how much better I am because I care
about what I do! Look upon my works, ye mighty, and despair!" kind of mentality. Too
much of software "craftsmanship" seems to be about the "me" part of "my code". And
when I think about why that is, I come to an interesting assertion: That if we take
the name away from the code, and just look at the code, we can't really tell what's
"elegant" code, what's "hack" code, and what was "elegant hack because there were
all these other surrounding constraints outside the code". Without the context, we
can't tell.
&lt;/p&gt;
&lt;p&gt;
A few years after my high point as a C++ "craftsman", I was asked to do a short, one-week
programming gig/assignment, and the more I looked at it, the more it screamed "VB"
at me. And I discovered that what would've taken me probably a month to do in C++
was easily accomplished in a few days in VB. I remember looking at the code, and feeling
this sickening, sinking sense of despair at how stupid I must've looked, crowing.
VB isn't a bad language--and neither is C++. Or Java. Or C#. Or Groovy, or Scala,
or Python, or, heck, just about any language you choose to name. (Except Perl. I refuse
to cave on that point. Mostly for comedic effect.)
&lt;/p&gt;
&lt;p&gt;
But more importantly, somebody who comes in at 9, does what they're told, leaves at
5, and &lt;i&gt;never gives a rat's ass about programming except for what they need to know
to get their job done&lt;/i&gt;, I have respect for them. Yes, some people will want to
hold themselves up as "painters", and others will just show up at your house at 8
in the morning with drop cloths. Both have their place in the world. Neither should
be denigrated for their choices about how they live their lives or manage their careers.
(Yes, there's a question of professional ethics--I want the house painters to make
sure they do a good job, too, but quality can come just as easily from the nozzle
of a spray painter as it does from the tip of a paintbrush.)
&lt;/p&gt;
&lt;p&gt;
I end this with one of my favorite parables from Japanese lore: &lt;blockquote&gt; 
&lt;p&gt;
Several centuries ago, a tea master worked in the service of Lord Yamanouchi. No-one
else performed the way of the tea to such perfection. The timing and the grace of
his every move, from the unfurling of mat, to the setting out of the cups, and the
sifting of the green leaves, was beauty itself. His master was so pleased with his
servant, that he bestowed upon him the rank and robes of a Samurai warrior.
&lt;/p&gt;
&lt;p&gt;
When Lord Yamanouchi travelled, he always took his tea master with him, so that others
could appreciate the perfection of his art. On one occasion, he went on business to
the great city of Edo, which we now know as Tokyo.
&lt;/p&gt;
&lt;p&gt;
When evening fell, the tea master and his friends set out to explore the pleasure
district, known as the floating world. As they turned the corner of a wooden pavement,
they found themselves face to face with two Samurai warriors.
&lt;/p&gt;
&lt;p&gt;
The tea master bowed, and politely step into the gutter to let the fearsome ones pass.
But although one warrior went by, the other remained rooted to the spot. He stroked
a long black whisker that decorated his face, gnarled by the sun, and scarred by the
sword. His eyes pierced through the tea maker’s heart like an arrow.
&lt;/p&gt;
&lt;p&gt;
He did not quite know what to make of the fellow who dressed like a fellow Samurai,
yet who would willingly step aside into a gutter. What kind of warrior was this? He
looked him up and down. Where were broad shoulders and the thick neck of a man of
force and muscle? Instinct told him that this was no soldier. He was an impostor who
by ignorance or impudence had donned the uniform of a Samurai. He snarled: “Tell me,
oh strange one, where are you from and what is your rank?”
&lt;/p&gt;
&lt;p&gt;
The tea master bowed once more. “It is my honour to serve Lord Yamanouchi and I am
his master of the way of the tea.”
&lt;/p&gt;
&lt;p&gt;
“A tea-sprout who dares to wear the robes of Samurai?” exclaimed the rough warrior.
&lt;/p&gt;
&lt;p&gt;
The tea master’s lip trembled. He pressed his hands together and said: “My lord has
honoured me with the rank of a Samurai and he requires me to wear these robes. “
&lt;/p&gt;
&lt;p&gt;
The warrior stamped the ground like a raging a bull and exclaimed: “He who wears the
robes of a Samurai must fight like a Samurai. I challenge you to a duel. If you die
with dignity, you will bring honour to your ancestors. And if you die like a dog,
at least you will be no longer insult the rank of the Samurai !”
&lt;/p&gt;
&lt;p&gt;
By now, the hairs on the tea master’s neck were standing on end like the feet of a
helpless centipede that has been turned upside down. He imagined he could feel that
edge of the Samurai blade against his skin. He thought that his last second on earth
had come.
&lt;/p&gt;
&lt;p&gt;
But the corner of the street was no place for a duel with honour. Death is a serious
matter, and everything has to be arranged just so. The Samurai’s friend spoke to the
tea master’s friends, and gave them the time and the place for the mortal contest.
&lt;/p&gt;
&lt;p&gt;
When the fierce warriors had departed, the tea master’s friends fanned his face and
treated his faint nerves with smelling salts. They steadied him as they took him into
a nearby place of rest and refreshment. There they assured him that there was no need
to fear for his life. Each one of them would give freely of money from his own purse,
and they would collect a handsome enough sum to buy the warrior off and make him forget
his desire to fight a duel. And if by chance the warrior was not satisfied with the
bribe, then surely Lord Yamanouchi would give generously to save his much prized master
of the way of the tea.
&lt;/p&gt;
&lt;p&gt;
But these generous words brought no cheer to the tea master. He thought of his family,
and his ancestors, and of Lord Yamanouchi himself, and he knew that he must not bring
them any reason to be ashamed of him.
&lt;/p&gt;
&lt;p&gt;
“No,” he said with a firmness that surprised his friends. “I have one day and one
night to learn how to die with honour, and I will do so.”
&lt;/p&gt;
&lt;p&gt;
And so speaking, he got up and returned alone to the court of Lord Yamanouchi. There
he found his equal in rank, the master of fencing, he was skilled as no other in the
art of fighting with a sword.
&lt;/p&gt;
&lt;p&gt;
“Master,” he said, when he had explained his tale, “Teach me to die like a Samurai.”
&lt;/p&gt;
&lt;p&gt;
But the master of fencing was a wise man, and he had a great respect for the master
of the Tea ceremony. And so he said: “I will teach you all you require, but first,
I ask that you perform the way of the Tea for me one last time.”
&lt;/p&gt;
&lt;p&gt;
The tea master could not refuse this request. As he performed the ceremony, all trace
of fear seemed to leave his face. He was serenely concentrated on the simple but beautiful
cups and pots, and the delicate aroma of the leaves. There was no room in his mind
for anxiety. His thoughts were focused on the ritual.
&lt;/p&gt;
&lt;p&gt;
When the ceremony was complete, the fencing master slapped his thigh and exclaimed
with pleasure : “There you have it. No need to learn anything of the way of death.
Your state of mind when you perform the tea ceremony is all that is required. When
you see your challenger tomorrow, imagine that you are about to serve tea for him.
Salute him courteously, express regret that you could not meet him sooner, take of
your coat and fold it as you did just now. Wrap your head in a silken scarf and and
do it with the same serenity as you dress for the tea ritual. Draw your sword, and
hold it high above your head. Then close your eyes and ready yourself for combat.
“
&lt;/p&gt;
&lt;p&gt;
And that is exactly what the tea master did when, the following morning, at the crack
of dawn he met his opponent. The Samurai warrior had been expecting a quivering wreck
and he was amazed by the tea master’s presence of mind as he prepared himself for
combat. The Samurai’s eyes were opened and he saw a different man altogether. He thought
he must have fallen victim to some kind of trick or deception ,and now it was he who
feared for his life. The warrior bowed, asked to be excused for his rude behaviour,
and left the place of combat with as much speed and dignity as he could muster.
&lt;/p&gt;
&lt;/blockquote&gt; (excerpted from &lt;a href="http://storynory.com/2011/03/27/the-samurai-and-the-tea-master/"&gt;http://storynory.com/2011/03/27/the-samurai-and-the-tea-master/&lt;/a&gt;) &gt;
&lt;p&gt;
My name is Ted Neward. And I bow with respect to the "software laborers" of the world,
who churn out quality code without concern for "craftsmanship", because their lives
are more than just their code.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blogs.tedneward.com/aggbug.ashx?id=73f28449-07ec-4638-8bf6-24dd3c400c39" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
Enterprise consulting, mentoring or instruction. Java, C++, .NET or XML services.
1-day or multi-day workshops available. &lt;a href="mailto:ted@tedneward.com"&gt;Contact
me for details&lt;/a&gt;.</description>
      <comments>http://blogs.tedneward.com/CommentView,guid,73f28449-07ec-4638-8bf6-24dd3c400c39.aspx</comments>
      <category>.NET</category>
      <category>Android</category>
      <category>C#</category>
      <category>C++</category>
      <category>Conferences</category>
      <category>Development Processes</category>
      <category>F#</category>
      <category>Industry</category>
      <category>Java/J2EE</category>
      <category>Languages</category>
      <category>LLVM</category>
      <category>Objective-C</category>
      <category>Parrot</category>
      <category>Personal</category>
      <category>Reading</category>
      <category>Ruby</category>
      <category>Scala</category>
      <category>Social</category>
      <category>Visual Basic</category>
      <category>Windows</category>
    </item>
    <item>
      <trackback:ping>http://blogs.tedneward.com/Trackback.aspx?guid=316a7469-52e4-4ef8-bd75-4b6f8d28d7ab</trackback:ping>
      <pingback:server>http://blogs.tedneward.com/pingback.aspx</pingback:server>
      <pingback:target>http://blogs.tedneward.com/PermaLink,guid,316a7469-52e4-4ef8-bd75-4b6f8d28d7ab.aspx</pingback:target>
      <dc:creator>Ted Neward</dc:creator>
      <wfw:comment>http://blogs.tedneward.com/CommentView,guid,316a7469-52e4-4ef8-bd75-4b6f8d28d7ab.aspx</wfw:comment>
      <wfw:commentRss>http://blogs.tedneward.com/SyndicationService.asmx/GetEntryCommentsRss?guid=316a7469-52e4-4ef8-bd75-4b6f8d28d7ab</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Elliott Rusty Harold is <a href="http://cafe.elharo.com/programming/java-programming/why-functional-programming-in-java-is-dangerous/">blogging
that functional programming in Java is dangerous</a>. He's wrong, and he's way late
to the party on this one--it's coming to Java whether he likes it or not.
</p>
        <p>
Go read his post first, while I try to sum up the reasons he cites for saying it's
dangerous: 
</p>
        <ol>
          <li>
Java is not a lazy-evaluated language. Programmers in Java will screw up and create
heap and stack errors as a result.</li>
          <li>
See? Here's a naive implementation of Clojure code taken directly over to Java and
look how it blows up.</li>
          <li>
Programmers can do bad things with this idea, so therefore we should avoid it.</li>
          <li>
Oh, and by the way, it's "dangerously inefficient" in Java/JVM, even though I offer
no perf benchmarks or comparisons to back this statement, and I'm somehow ignoring
that Clojure and Scala run on the JVM as well, apparently without problem.</li>
        </ol>
That kind of about sums it up, I think.
<p>
Look, as Elliott points out, Java is not Haskell. Neither is it Lisp. It's its own
language, rooted in imperative and object-oriented history, but no less able to incorporate
functional features into its development than Lisp could incorporate object-oriented
features. However, if you do stupid things, like trying to re-create an infinite (implicitly
lazily-evaluated) list in Clojure by creating an actualized list that stretches to
infinity... you're going to blow the JVM up. Duh. Not even the supercomputer on the
USS Enterprise five hundred years from now will be able to construct that list.
</p><p>
Porting code from one language to another is not a trivial exercise. If you attempt
to port line-for-line and expression-for-expression, you can expect that your ported
code will not be idiomatically correct. (I know this already, having <a href="http://blogs.tedneward.com/2012/12/21/Envoy+In+Scala+JavaScript+And+More.aspx">done
the exercise myself</a>.) The root of the problem in his ported code is twofold. One,
he (rather foolishly and in elegant strawman fashion) badly simulates what an infinite
list would look like in Java--a commenter does the better job by showing how an Iterator
can be made to perform the same thing that Haskell actually does under the hood by
producing the next value on demand, rather than trying to create a list of Integers
stretching to infinity. For someone who professes to have some Haskell experience
and love, it surprises me that Elliott makes this kind of mistake, which leads me
to conclude that he's trying to create the strawman. Two, he assumes that anyone who
programs in Java functionally will have to create all of their functional tools by
hand, and frankly, using Guava or FJ here would make this code sample a LOT easier
to swallow. The fact that he ignores both of these in his stawman again sort of reinforces
the idea that he's deliberately crippling his strawman to make his point.
</p><p>
His underlying point, though, seems to be simple: "I work with bad programmers, who
don't seem to understand how to write code functionally in Java without screwing it
up." Dude. Sucks to be you. "Bad programmers will move heaven and earth to do the
wrong thing." --Glenn Vanderburg.
</p><p>
What really sucks for him is that these features are coming in Java 8, including lambda
expressions and library support including a Stream interface that will allow for exactly
this kind of code to be written without pain. Those programmers Elliott is working
with are going to be even more on fire to use their functional approaches (and all
the associated goodness of doing so, including composability and what-not) in their
Java code. What might make Elliott more happy is that at least they won't have written
it; it'll all be written by guys much smarter than any of them.
</p><img width="0" height="0" src="http://blogs.tedneward.com/aggbug.ashx?id=316a7469-52e4-4ef8-bd75-4b6f8d28d7ab" /><br /><hr />
Enterprise consulting, mentoring or instruction. Java, C++, .NET or XML services.
1-day or multi-day workshops available. <a href="mailto:ted@tedneward.com">Contact
me for details</a>.</body>
      <title>On Functional Programming in Java</title>
      <guid isPermaLink="false">http://blogs.tedneward.com/PermaLink,guid,316a7469-52e4-4ef8-bd75-4b6f8d28d7ab.aspx</guid>
      <link>http://blogs.tedneward.com/2013/01/21/On+Functional+Programming+In+Java.aspx</link>
      <pubDate>Mon, 21 Jan 2013 22:10:14 GMT</pubDate>
      <description>&lt;p&gt;
Elliott Rusty Harold is &lt;a href="http://cafe.elharo.com/programming/java-programming/why-functional-programming-in-java-is-dangerous/"&gt;blogging
that functional programming in Java is dangerous&lt;/a&gt;. He's wrong, and he's way late
to the party on this one--it's coming to Java whether he likes it or not.
&lt;/p&gt;
&lt;p&gt;
Go read his post first, while I try to sum up the reasons he cites for saying it's
dangerous: 
&lt;ol&gt;
&lt;li&gt;
Java is not a lazy-evaluated language. Programmers in Java will screw up and create
heap and stack errors as a result.&lt;/li&gt;
&lt;li&gt;
See? Here's a naive implementation of Clojure code taken directly over to Java and
look how it blows up.&lt;/li&gt;
&lt;li&gt;
Programmers can do bad things with this idea, so therefore we should avoid it.&lt;/li&gt;
&lt;li&gt;
Oh, and by the way, it's "dangerously inefficient" in Java/JVM, even though I offer
no perf benchmarks or comparisons to back this statement, and I'm somehow ignoring
that Clojure and Scala run on the JVM as well, apparently without problem.&lt;/li&gt;
&lt;/ol&gt;
That kind of about sums it up, I think.&gt;
&lt;p&gt;
Look, as Elliott points out, Java is not Haskell. Neither is it Lisp. It's its own
language, rooted in imperative and object-oriented history, but no less able to incorporate
functional features into its development than Lisp could incorporate object-oriented
features. However, if you do stupid things, like trying to re-create an infinite (implicitly
lazily-evaluated) list in Clojure by creating an actualized list that stretches to
infinity... you're going to blow the JVM up. Duh. Not even the supercomputer on the
USS Enterprise five hundred years from now will be able to construct that list.
&lt;/p&gt;
&lt;p&gt;
Porting code from one language to another is not a trivial exercise. If you attempt
to port line-for-line and expression-for-expression, you can expect that your ported
code will not be idiomatically correct. (I know this already, having &lt;a href="http://blogs.tedneward.com/2012/12/21/Envoy+In+Scala+JavaScript+And+More.aspx"&gt;done
the exercise myself&lt;/a&gt;.) The root of the problem in his ported code is twofold. One,
he (rather foolishly and in elegant strawman fashion) badly simulates what an infinite
list would look like in Java--a commenter does the better job by showing how an Iterator
can be made to perform the same thing that Haskell actually does under the hood by
producing the next value on demand, rather than trying to create a list of Integers
stretching to infinity. For someone who professes to have some Haskell experience
and love, it surprises me that Elliott makes this kind of mistake, which leads me
to conclude that he's trying to create the strawman. Two, he assumes that anyone who
programs in Java functionally will have to create all of their functional tools by
hand, and frankly, using Guava or FJ here would make this code sample a LOT easier
to swallow. The fact that he ignores both of these in his stawman again sort of reinforces
the idea that he's deliberately crippling his strawman to make his point.
&lt;/p&gt;
&lt;p&gt;
His underlying point, though, seems to be simple: "I work with bad programmers, who
don't seem to understand how to write code functionally in Java without screwing it
up." Dude. Sucks to be you. "Bad programmers will move heaven and earth to do the
wrong thing." --Glenn Vanderburg.
&lt;/p&gt;
&lt;p&gt;
What really sucks for him is that these features are coming in Java 8, including lambda
expressions and library support including a Stream interface that will allow for exactly
this kind of code to be written without pain. Those programmers Elliott is working
with are going to be even more on fire to use their functional approaches (and all
the associated goodness of doing so, including composability and what-not) in their
Java code. What might make Elliott more happy is that at least they won't have written
it; it'll all be written by guys much smarter than any of them.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://blogs.tedneward.com/aggbug.ashx?id=316a7469-52e4-4ef8-bd75-4b6f8d28d7ab" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
Enterprise consulting, mentoring or instruction. Java, C++, .NET or XML services.
1-day or multi-day workshops available. &lt;a href="mailto:ted@tedneward.com"&gt;Contact
me for details&lt;/a&gt;.</description>
      <comments>http://blogs.tedneward.com/CommentView,guid,316a7469-52e4-4ef8-bd75-4b6f8d28d7ab.aspx</comments>
      <category>Android</category>
      <category>Java/J2EE</category>
      <category>Languages</category>
      <category>Personal</category>
      <category>Review</category>
      <category>Scala</category>
    </item>
  </channel>
</rss>