pete snipped-for-privacy@hotmail.com wrote: : Hi,
: Im in the process of writing a simple digital logic circuit simulator : application (similar to B2Logic).
What a novel idea! But, ummm, why not contribute to an existing project such as TkGate:
formatting link
Or do a quick search on OpenCollector to see what other logic simulators are already out there:
formatting link
Why re-invent the wheel, unless you think the world needs yet another independent logic simulator?
: What would be the best approach or : design for a project like that?
Extend an existing project.
: I mean should I use the object-oriented : design: making gates as classes, and if so, should I make ALL gates as : classes or should it be just the BASIC gates (AND, NOT, OR) and build : all other components (XOR, NOR, NAND, FULLADDER, etc.) as C-style : FUNCTIONS that use those basic classes?
Welcome to software engineering 101. This is your first homework question.
: I guess my questions should be: Whats the most common design in : commercial applications (e.g. B2Logic)? Is it pure, C-Style code, or is : it OOD? And how is it generally done (details are highly : appreciated)???
I believe that it depends upon when the commercial simulators were written. Older programs tend be be C [1], whereas newer programs tend to be C++ or Java since the OO discipline is a relatively recent thing.
Personally, I would avoid C++ and Java altogether and do it in Python. C++ has all kinds of cross-platform quirks and has also inherited C's inherent memory bug pitfalls. Java is a cleaner language, but if you use it you are chained to a Java VM (unless you can get the GNU Java compiler to work). Python is an OO language with clean syntax and it handles garbage collection for you, so you don't have to worry about memory bugs.
But first I would look to see if a suitable logic simulator already exists, and then just add to it.
Stuart
[1] Really old stuff is written in Fortran. Real men don't need any foofy object oriented nonsense!