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

September 3rd, 2011


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.


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.

  7. October 7th, 2014 at 02:02 | #7

    Bitte lassen Sie uns wissen, Moncler Schweiz Bestellen wenn Sie eine andere questions.Hi Amanda haben, zu sehen. Nun, für den Anfang sollten Sie nicht Name-Server, der auf zwei Standorte, das ist, was die Ursache der Fehler. dass der Fall, können Sie die MX-Einträge und sogar die Name-Server, der auf Ihrem aktuellen Host verlassen und löschen Sie die Jimdo-Name-Server aus der DNS. Scharm el Scheichs ist eine der größten Touristenziele in der arabischen Welt. Vor etw

  8. October 8th, 2014 at 02:11 | #8

    125 pour une période de trois heures. Photos adorables prennent New Balance Shoes sur le familier Little Red Hen. D’autres municipalités ont pris de nombreux mois pour débattre de l’expansion New Balance Shoes Bruxelles des jeux de hasard. Nous pouvons prouver que Obama est un mauvais président pour les droits d’armes à feu en raison d’une foule de choses qu’il a dit et fait ..Les propriétaires sont également fiers de conserver la porte distinctif Elvis cô

  9. October 9th, 2014 at 02:00 | #9

    Доля посещений сайта, указанного в поисковых системах составляет около 19%. По отноше&

  10. October 14th, 2014 at 01:57 | #10

    Mit Einsatz für Morbidität gab es eine Notwendigkeit für die Codierung von psychischen Bedingungen, und zum ersten Mal einen Abschnitt über Longchamp österreich psychische Störungen hinzugefügt wurde. [9] [10] Die Internationale Konferenz für das siebte Revision der Internationalen Klassifikation der Krankheiten wurde in Paris unter gehalten der Schirmherrschaft der WHO im Februar 1955. Dann, wenn die Arbeit für den Tag fertig, reiche Leute wenigstens

  11. October 14th, 2014 at 02:09 | #11

    Bredvid och tunga set, den förändrade den senaste sak trenderna visat ibland icke standard på grund av dessa händelser är också idiosynkratiska för kvinnor. Nästan 90% av modeevenemang och attitydundersökningar visar är att införa nya typer av kvinnor kläder, designade runt diversifierade den senaste sak designers. Var första gången jag hade mina händer på en golfklubba i två år, säger Rankin, den f&#2

  12. October 16th, 2014 at 02:13 | #12

    Vi kunde köra med en högre upplösning i Nike Air Max 1 Billigt Metro 2033, vrid AA upp till 4X AA i Bad Company 2, och spela med ‘Mycket hög’ konsistens kvalitet i Aliens vs Använda dynamiska navigeringsfältet kan hjälpa dig mycket i det här fallet; kit kommer att placera URL i en mappstruktur, skulle sidorna placeras specifikt och inte bara i namnkonventionen, kommer undernavigering ha Michael Kors Väskor Rea sina egna verktyg, vilket gör platse

  13. October 17th, 2014 at 02:04 | #13

    Il dispose de 103 prises cette saison pour atteindre 100 pour la cinquième fois de sa carrière, égalant un record de la NFL pour la plupart des saisons avec au moins autant de réceptions. “Vous devez regarder ce que vous êtes prêt à faire pour obtenir l’ornière.” S’il peut y avoir des contraintes financières qui peut vous Michael Kors Paris empêcher de changer de carrière rapide, Walden dit prendre des cours ou d’être prêt à f

  14. November 1st, 2014 at 01:01 | #14

    Det var inte Woolrich Rea förrän feta regndroppar började knacka över solrosor som Denevan gått med på att flytta tabellerna inomhus. Gästerna, som hade betalat $ 180 vardera och flugit in från så långt bort som Vancouver och Texas, fick hjälpa dra stolar och bord över leriga, gropiga fält till gårdens växthus. Det fanns vissa grumping, men folk kastade i. Nästa dag när han gjorde honom för första g&#2

  15. November 29th, 2014 at 07:38 | #15

    While premature ejaculation is a very frustrating condition to have, there are many ways to take control over it. I approached my adult life in anticipation of a mutually enjoyable sex life. This is because when a man tries to prolong the time that he takes to ejaculate during his sessions, he can learn how to delay ejaculation at will.

  16. December 12th, 2014 at 01:07 | #16

    E ‘un po’ di una cattura tutti frase, e le cifre riflettono questo. Si stima che tra il 4 e il 7 per cento delle donne ha una anomalia uterina (Matthews e Benny, 2010).. È stata arrestata, i suoi figli collocati in servizi di protezione dei minori, e lei è stato accusato di Child Messa in pericolo. Poi di nuovo, che sarebbe probabilmente ottenere arrestati, anche. Hanno imparato diverse percezioni di ciò che il giornalismo dovrebbe essere negli Stati Uniti e in Giappone, ha detto

  17. June 23rd, 2015 at 02:14 | #17

    The lunchtime newspaper, positioned like a free edition of the Evening Standard, has been seen as in sizeable quantities inside a Piccadilly Circus cafe, on a local London bus and on Stagecoach coach service “Oxford Tube”, which runs from London to Oxford. White formal dresses exquisite, because he attained the “Eclipse” premiere in Big apple using a gentle grey match and darkish shirt, accented with Piaget Altiplano forty mm white gold a black dial. This channel is responsible for the telecast

  18. August 14th, 2015 at 02:24 | #18

    ‘Ich habe kein Problem mit Leuten, die Freude und angeregt,’ Dodgers Veteran infielder Michael Young sagte. ‘Das Spiel soll emotional zu sein. Es soll eine Menge Spaß machen. Einige Jungs zeigen, dass in unterschiedlicher Weise, aber so lange wie es ist respektvoll für alle Beteiligten, ich habe kein Problem mit ihm haben.”Sie werden in der Lage zu Nike Laufschuhe Günstig prüfen, ein Buch, lesen Sie es vor Ort. Es wird eine Lernumgebung, die Sie in der Lage, über die Te

  19. February 15th, 2016 at 01:40 | #19

    My brother suggested I might like this blog. He used to be entirely right.

    This submit truly made my day. You cann’t consider simply how so much time I had spent for this information! Thanks!

Comments are closed.