Home > Programming > If the only tool you have is Java, everything looks like a class

If the only tool you have is Java, everything looks like a class

<rant>

There’s a common phrase used within software development:

If the only tool you have is a hammer, everything looks like a nail

It exists in various forms, but the original source is the Law of the instrument, or Maslow’s Hammer.

I started thinking about this while reading through Head First Design Patterns today (a bizarre book, not quite sure yet whether I can recommend it).

What struck me was that the solution to every design problem in Java revolves around writing a new class. It just astounds me that there’s basically no other means of abstraction in the language. I’ve got so used to languages with lambdas, for example, that the idea of creating a LightOnCommand class that implements the Command interface to encapsulate the act of turning a light on feels like such a waste of brainpower, bytes, and sanity. I’d hate to have my expressivity limited so heavily.

</rant>

Categories: Programming Tags: ,
  1. September 5th, 2011 at 15:19 | #1
  2. September 5th, 2011 at 15:27 | #2

    @Peter Alexander Thanks a lot! I love a bit of Stevey :)

  3. Kimon
    September 6th, 2011 at 12:44 | #3

    Unortunately, Stevey forgets that lambdas are also nouns

  4. September 6th, 2011 at 17:58 | #4

    Because principles of Java revolve about encapsulation of similar functionality within entities that are allowed to have some internal state. Not about having concepts from different paradigms because that would be easier to write.

    On the other hand, if you were brought up in a pattern circle, you’d now state that most of the lambdas are a shorthand to implementing Strategy pattern (yeah, I know this is an understatement when a function is a first-class entity). ;)

  5. August 6th, 2013 at 18:39 | #5

    Narrow blood vessels lie alongside the intestines of the earthworm and they absorb the nutrients from the alimentary canal feeding the rest of the body. You must definitely be planning to make it special and memorable by keeping a good theme, ordering the best food and choosing the best games. The food is decent and the drink specials on Tuesdays include $2.

  6. February 21st, 2014 at 16:50 | #6

    For more information about sex offenders and their release in Minnesota, see the following link-. Graydon Earl Comstock and four other inmates in the Butner facility filed suit in the District Court for the Eastern District of North Carolina, challenging the government’s authority to detain them indefinitely under 4248. Family Watch Dog even has a service where you can put in your address and it will alert you when a sexual offender moves nearby to you.

    Civilian GPS units are often not particularly accurate, especially older or cheaper models. Sexual assault includes contact such as sexual touching. Finally, along with your general sexual harassment and discrimination policy, if one employee accuses another of either charge, you will need to file a proper incident report, so we’ve provided a free report here to ensure you’re following labor laws correctly.

  1. September 30th, 2011 at 01:30 | #1

Comments parsed as Markdown.