Writing Scripts
A file system layout
It is not always easy to keep tidy a file system and many students don't really understand why this is necessary. During your studies you hardly write programs much longer than some 100 lines of code. "Normal" programs however can necessitate several tens of thousands of lines and without a very strict discipline in how to organize the file structure such a program becomes unmaintainable.
Let us therefore decide on a structure you should keep thought this course:
For each exercise session, you maintain a separate directory. You never mix files from different exercise sessions. Each directory has the same layout with a sub-directory for the exercise text (exercise) , a sub-directory for your documentation (doc) and a sub-directory solutions for your solution scripts. Should you need several Python modules for a single solution, then all these module go into another sub-directory named after the solution.
Example: You write a script for readout of an ADC and you need a module in which you implement a class with all the ADC access methods (see later in the course for what a class and a method is) and another module with your code accessing the ADC class. Then you would have a sub-directory adc with the files adcClass.py and adcAccess.py.
--
Uli Raich - 2020-04-25
Comments