Interpreter Design Pattern Tutorial

Interpreter Design Pattern TutorialWelcome to my Interpreter Design Pattern Tutorial! The Interpreter design pattern is ignored by most, but in this tutorial I’ll show you how to do some cool things with it.

In top of that, I’ll also answer all of the recent questions I’ve received about both Java Reflection and String manipulation. I found you can do pretty great things if you combine reflection with the interpreter design pattern.

All of the code follows the video and it is heavily commented to help you learn.

If you found this tutorial useful, it helps others when you tell Google [googleplusone]

If you know someone who’d be interested in this crazy tutorial, feel free to share it [nttfblike]

Code from the Video

CONVERSIONCONTEXT.JAVA

EXPRESSION.JAVA

GALLONS.JAVA

QUARTS.JAVA

PINTS.JAVA

CUPS.JAVA

TABLESPOONS.JAVA

MEASUREMENTCONVERSION.JAVA

13 thoughts on “Interpreter Design Pattern Tutorial”

  1. youtube is still off from Bangladesh. may be after few days we will be able to access. i dont know any alternative site of youtube.

    1. It looks like it may be off for a long time? From what I read, Google is saying they won’t block free speech of any kind even if it could be inflammatory. The government in Bangladesh is demanding that they remove anything that could be deemed anti-religious.

      I would never make any judgements on any other country because I have no knowledge of any country but the U.S. What I can tell you about the U.S. though is that our only freedom is the freedom of speech. Actually freedom of speech is under attack as you can see from the Wikileak attack that is going on.

      I haven’t seen this video that has upset so many people and I don’t plan on watching it. I just think it is sad that a few lone lunatics (video makers) are able to so easily bend governments. There isn’t much that makes sense to me though government wise?

  2. Derek
    First i want to thank you for the best vidoes of design pattern on youtube.
    I copied all the code, and when i run, it gives me this error pasted below

    java.lang.ClassNotFoundException: Gallons
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at com.MeasurementConversion.main(MeasurementConversion.java:33)

  3. Hi Derek,

    Thank you very much for such great tutorial, I want to know are there any other scenarios we could make user of interpreter design patter?

    Best Regards,

    Langston

    1. Hi Langston,

      You’re very welcome 🙂 You could use the Interpreter any time you need to translate from one thing to another. Languages, from a note to a sound, etc. You could also use it to generate different reports based off of different data presented. It is a great pattern.

      I hope that helps
      Derek

  4. Hi Derek,

    I had an assignment for simulation of robot in mars planet. I was able to do this using your java game spaceship tutorials.

    Thank you very much,some how i feel like the code is to be dedicated to you.

    In this video you have mentioned some game tutorial called Zorak game. Do you mind publishing the code.

    Thank you once again

    1. Hi Umair,

      I’m very happy that I was able to help. That game was a lot of fun to make. I plan on making a ton of games over the course of 2014. I’m not sure what I did with the Zork code, but I’ll cover how to make a game like that soon.

Leave a Reply

Your email address will not be published. Required fields are marked *