CS 214: Programming Languages
Spring 2009

Home|Syllabus|Schedule
<<|>>

Goodbye, Procedural Interpreter!
Setup, Iteration 8

The procedural interpreter in the interpreter iterations has been there purely for compare-and-contrast reasons. It's code that could have been written in C or Pascal, and there's a reason why most developers favor functional or object-oriented programming.

So this "setup" iteration is to nuke all traces of your procedural interpreter.

Courage

One of the virtues that agile developers talk about is courage. You need to have the courage to write tests for all of your code. You need to have the courage to refactor the code. You must have the courage to throw away code.

These last two examples are made much easier due to version control systems. If you have your old code saved in a repository, it's not truly gone forever. But the repository is effective only if you're using it properly.

Make sure you have everything in your _interpreter repository committed and even pushed. (The push shouldn't be necessary, but it doesn't hurt.)

Using the Compiler to Find Things to Delete

The key file for the procedural interpreter is ProceduralHobbesInterpreter.

Delete ProceduralHobbesInterpreter.

You'll get errors.

Any class with an error in it relies on the procedural interpreter. Delete those classes, too. When everything compiles, run your unit tests.

There's a shell script that's still clinging:

Delete the line that invokes the procedural interpreter in scripts/hobbes. Run that script on a few of your files to make sure it works.

After a major change like this, you should get things into your repository.

Add, commit, and push your changes into your repository.

Rename What's Left

Now the "object-oriented interpreter" is just simply the interpreter.

Here are the name changes I made:

Original Renamed
OOHobbes HobbesCLI (for "command line interface")
OOHobbesInterpreter HobbesInterpreter
OOHobbesInterpreterTest HobbesInterpreterTest

Change the names of your classes to make them simpler. Run unit tests. Add, commit, and push to your repository.