0

I'm planning on writing a program but I am stuck in a conundrum. I don't want to start writing something and then have to rewrite it all when I find out that my program is not extensible. The other problem, is I do not have enough programming knowledge to know where to begin designing my program so that it is extensible.

I have done some reading on DLLs (or delayed loading for unix), dynamic loading, run-time library loading/deloading, etc.. but I still cannot quite comprehend what I need to do. I will give a sample program example, and if someone could lead me in the right direction for what to learn so my bigger program can begin, I will be extremely grateful!

Let's say I create a console program 'iAmDog' where you can type in commands, and the dog will respond accordingly with output to the console. Now let's assume when I create this program, the dog only has 1 command, 'bark' which produces the output 'roof roof!'. How would I go about writing this program so that while the user is still running the program, I can edit a library, or code somewhere else, to add a 'sit' command to the dogs repertoire.

Again, Ideally my plan is to have no downtime or as minimal downtime as possible, all while being able to code updates to functionality of the always running program.

Thank you for reading!

Russell aka SgtPooki

SgtPooki
  • 11,012
  • 5
  • 37
  • 46
  • Any particular reason why it must be no-recompile and not just no-compile? (I.e. Ruby) – Robert Sep 08 '11 at 20:33
  • I was mainly asking about C++, guess I should have indicated that, but I was hoping to learn how to do it in C++ based off of the ways other languages do it if nothing came up about C++. I like C++ =) – SgtPooki Sep 09 '11 at 00:53
  • And after learning more about MySQL since posting this, I realize I should be able to accomplish something as simple as command & output. The program would then check for commands in the database instead of having them hardcoded.. but that would leave it very limited to just [ cout << getOutPutFor(userCommand); ] or something similar.. – SgtPooki Sep 09 '11 at 00:56

1 Answers1

1

Are you using .NET? Then MEF, Managed Extensibility Framework, is probably suited well for you.

There is a podcast on Hanselminutes about MEF. You find an mp3 as well as a PDF transcript, that lets you search the show. They even discuss the possibility to continuously watch a folder for updates, to achieve what you descripbe, although they discourage to do this.

Marcel
  • 15,039
  • 20
  • 92
  • 150
  • I was planning on using C++ but I thought there may have been some sort of general way to do this for all languages, even if they are a stretch for some. Why is it not recommended to do this? – SgtPooki Jan 29 '11 at 21:32
  • @SgtPooki. I can not remember actually why, but I remember that the discussed that. Have a look into the show. – Marcel Jan 29 '11 at 23:23