End of June - Refactoring Continues
Big refactoring progress today. Now the project starts up following a huge refactoring effort, but I now need to fix run-time errors and review the code.
I simplified some Parts that had fancy features such as pressing a button shortly after it was dropped into the Graph to set up the number of IO pins. Now the pin width is fixed to 8 or 16 bits depending on the Part variant that is chosen.
Also, the code was simplified, stripping out things that were in hindsight, not needed such as types of pin e.g. high impedance, input or output. This is taken care of naturally by the way that connections are allowed.
A great improvement made was to create an inline class in the Part class to define the characteristics of a pin rather than having separate dictionaries of pin info. Before I was checking if the dictionary had the pin index and then setting or getting the data value. Now, at setup time of the Part, arrays of Input and Output pins are set up.
When refactoring code, we want to make it simpler, more modular, and easy to understand. We should clearly be able to understand what everything is for and how it works. Sounds kind of obvious, but it is easy to churn out code and later come back to it with no idea how it was meant to work without taking great care to name things well and keep things well organized.
I removed all the
ENUMS that were used in match statements and
if statements to modify behavior according to types of Parts. Now every Part extends from Part and other Parts. Of course, there are many more script files now, but that is not a problem since they are grouped in a directory and are well named.
My idea for using Composition to add the Bus functionality to objects was abandoned since I now have extended objects for every Part and the common Bus functionality consists of one custom function which I call
set_value which sets an integer value of the Bus data value and emits a signal when this value changes. So there was no need for a separate scene node to instantiate for the purposes of adding a Bus to an object.
Hopefully by the weekend, I will have the software working as well as or better than before, but with lovely clean code.
More Devlog entries
Most recent first
- 2021 10 02 New Release of Digital Logic Simulator
- 2021 08 28 Nested Sub Blocks
- 2021 08 27 Debugging with a log file
- 2021 08 26 Testing Circuit Blocks
- 2021 08 24 Bug Fixing with Blocks
- 2021 08 22 Debugging Circuit Blocks
- 2021 08 21 Circuit Blocks Update
- 2021 08 18 Circuit Blocks
- 2021 08 16 Highlighting of wires
- 2021 08 12 Adding Tutorial Content
- 2021 08 07 Numbers Scene
- 2021 08 06 Numbers Tabbed Scene
- 2021 08 04 Number Display Widget
- 2021 07 26 Logic Simulator Update
- 2021 07 24 - Launch of V1.0
- 2021 07 23 - Truth Tables
- 2021 07 22 Progress Update
- 2021 07 21 - Simple Computer Simulation
- 2021 07 16 - Community Forum
- 2021 07 15 - Community News
- 2021 07 11 - Save and Load ROM Data
- 2021 07 09 - Documentation About The Logic Simulator
- 2021 07 08 - Big Progress
- 2021 07 07 - RAM and ROM Testing Complete
- 2021 07 06 - Implementing Tests
- 2021 07 05 - Cool algorithm for binary text string
- 2021 07 04 - Debugging Complex Situations
- 2021 06 29 Community
- 2021 06 28 Implementing More OOP
- 2021 06 27 Memory Parts
- 2021 06 26 Improving the Memory Manager
- 2021 06 25 Memory Data
- 2021 06 24 Memory Management
- 2021 06 23 First Devlog Entry