[Ktechlab-devel] A few more ideas

Alan Grimes agrimes at speakeasy.net
Mon Jul 14 06:24:38 UTC 2008


P Zoltan wrote:
> On Tue, 08 Jul 2008 21:55:58 +0200, Alan Grimes <agrimes at speakeasy.net>  
> wrote:
> 
>>> Any other TODOs?
>> just general code-cop operations...
>>
> 
>   I would also like to see:
> - more documentation comments in the code
> - automated tests: there could be a program, which loads a circuit in the  
> simulator, runs the simulation and compares the results with the correct  
> ones. If there is a significant error ( +/- 5% ?), then something is wrong.
> - some kind of logging, for debugging purposes

I had taken a slightly different approach. Since certain things must
always be true for a circuit (eg, all currents must sum to 0, etc..),
the voltage on both sides of a wire must always be equal, it is possible
to implement runtime checks. Several of my recent versions will print
out some of those errors. The trick is to design the code such that it
will be difficult for these bugs to appear.


>   I have to admit that all those abbreviations in the name of the classes  
> annoy me. I prefer longer, and more descriptive class names.
> 
>   Proposed changes:
> Node class:
> - node_type
> - m_type, m_inputConnectorList, m_outputConnectorList protected members  
> shall disappear
> - obsolete functions: acceptInput, acceptOutput, creatInputConnector,  
> *Connector* (all the members)
> 
> ECNode: (I don't like it's name, I'd prefer ElectricNode )

I think EC means "electronic component"

> - type() member overridden
> - protected member: connectorList
> - add needed methods for connectorList: createConnector, addConnector,  
> removeNullConnectors, getConnectorList, (others if needed)
> 
> new class: PinNode ( or NodePin ? :)) ), inherits from ECNode
> - type() member overridden
> - in its header file, define a constant equivalent to ec_pin
> 
> new class: JunctionNode ( or NodeJunction ? :)) ), inherits from ECNode
> - type() member overridden
> - in its header file, define a constant equivalent to ec_pin
> 
> new class: FlowNode, inherits from Node
> - type() member overridden, add constant in header
> - all the stuff removed from ECNode comes here
> 
> FPNode class: I'd like to rename it VerifiedFlowNode
> 
> new class: InputFlowNode, inherits from FPNode
> - type() overridden & stuff

> new class: OutputFlowNode, inherits from FPNode
> - type() ...

> new class: JunctionFlowNode, inherits from FPNode
> - type() ...

> ... after these comes the fun to fix things that don't compile :))

>   Maybe the healtiest solution would be to get rid of that type() member  
> and fix the code that uses it. The problem is that it is also the hardest  
> thing to do.

yeah...
I like the idea of moving to overloaded type() first, that will help to 
clean up the class heirarchy... Then we can fix the other stuff.


-- 
Ron Paul: A man of Peace.
Chemistry.com: A total rip-off.
Powers are not rights.
We did not invade Iraq, the government did.





More information about the Ktechlab-devel mailing list