[Ktechlab-devel] The three roles of a Component.

Alan Grimes agrimes at speakeasy.net
Fri Sep 17 03:57:30 UTC 2010


Lets take a peek at the the class FullAdder to see what a component in
ktechlab 3 did.

It basically had several functions:

-> As a part in the component library, the class contained information
that rightfully belongs in a database about it's nature and function.

-> as a visual representation, mainly in the parent class
DIPComponenent, which contained code to draw it on the screen.

-> As a description of the electrical configuration of the part in the
form of a collection of "1pinElement"s.

and finally

-> As an implementation of a computation that the part performs. The
true evil of FullAdder isn't obvious until one realizes that I'm
applying the + operator to booleans and getting away with it! =P

Yes I know I'm evil...

The flipflop functions, most of them at least, are also instructive
because they show how the charactoristic equations for each part can be
used directly as a model for that part. The key difference between this
version and an ancient version of ktechlab is that the component classes
are almost entirely stateless, especially in the case of the SR
flipflop. The state of the part is entirely encoded in the elements in
the simulator, the flipflop code that is currently in the component
class only applies a very simple computation on that state. So even
though the implementation of the SR flipflop is stateless, the actual
simulated flipflops hold their state just fine, (iirc).

-- 
DO NOT USE OBAMACARE.
DO NOT BUY OBAMACARE.
Powers are not rights.





More information about the Ktechlab-devel mailing list