Putting It All Together
Though it has been awhile, you might remember running the original C++ code in the command pattern article. This program produces the output in Figure 3.
Figure 3 The old C++ program output.
Now that we’ve ported the code to C# successfully, the new program output is as illustrated in Figure 4.
Figure 4 The newly ported C# program.
"Not much difference between Figures 3 and 4," I hear you say. However, the back-end technologies are worlds apart. Figure 3 illustrates pure C++, whereas Figure 4 is a window into the .NET universe. You can even see the optional friendly message "Hello World!" in Figure 4.
The similarity between Figures 3 and 4 points to an interesting aspect of the little-known area of code porting—your job is done once the new program output matches that of the old. However, getting to this point requires following a set of what are often quite tricky steps.