Welcome 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
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.
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?
great tutorials!
Thank you 🙂
Bangladesh should merge with india, and be a free country, where you have all the rights as a citizen.
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)
Sam,
Thank you 🙂 Did you save Gallons.java in the same folder? That sounds like the problem. Tell me if that doesn’t solve it.
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
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
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
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.