|
50 | 50 | So you now have the file with the program code.
|
51 | 51 | The problem is solved.
|
52 | 52 |
|
53 |
| -Is that easy? |
| 53 | +Is it that easy? |
54 | 54 | On one hand, you may wonder whether you made any mistake.
|
55 | 55 | We are people, we all make mistakes.
|
56 | 56 | The more complex the task we tackle, the more (program code) we write, the more likely it is that we make some small error somewhere.
|
|
61 | 61 | What if other programs may later need to use/run it?
|
62 | 62 | Maybe it can access some sort of sensor measuring something, or maybe it can convert data from one file format to another one.
|
63 | 63 | Then, other programmers may need to be able to at least understand how to correctly run the program and what kind of input and output data it will expect or produce, respectively.
|
| 64 | +You must \emph{document} your program clearly. |
| 65 | +If you write a package that offers functions that can be used by other programs, there must be annotations that clearly explain what kind of input and output datatypes these functions accept and produce, respectively. |
64 | 66 |
|
65 | 67 | What if this program is going to be needed for the next ten or so years?
|
66 | 68 | Maybe it could eventually become necessary to add new functionality?
|
67 | 69 | Maybe some of the software libraries you use get outdated and need to be replaced?
|
68 | 70 | There also are several situations in which a totally different person may need to work, read, modify, and improve \emph{your} code.
|
| 71 | +They need to be able to read and understand your code easily. |
| 72 | +You cannot just write stuff down quickly, you cannot just produce one big soup of unformatted code. |
| 73 | +You need to both have good documentation and write clean and easy-to-read code. |
69 | 74 |
|
70 | 75 | Or maybe you are a researcher, using \python~3 to implement some algorithm and to run an experiment.
|
71 | 76 | In order to make your experiments and results replicable, you would probably want to publish your algorithm implementation together with the results.
|
72 |
| -This only makes sense if your code is at least a bit readable. |
| 77 | +This, agin, only makes sense if your code is at least a bit readable. |
| 78 | +The names of variables and functions must be clear and understandable. |
| 79 | +The coding style should be consistent throughout all files and it should follow common conventions~\cite{PEP8}. |
73 | 80 |
|
74 | 81 | All of these things need to be considered when we learn how to program.
|
75 | 82 | Because you do not just \inQuotes{program,} you develop software.
|
| 83 | +Indeed, a good share of programmers usually spend only about 50\%~of their time with programming~\cite{T2019MOSWBFDHOT2TMOSS,AS2019DS2OSRP}. |
| 84 | +Of course, we cannot cover all other topics related to software engineering in a programming course. |
76 | 85 |
|
77 |
| -In typical courses, such aspects are ignored. |
| 86 | +However, in typical courses, such aspects are ignored entirely. |
78 | 87 | In a typical course, you learn how to write a small program that solves a certain task.
|
79 | 88 | The task is usually simple, so the teachers are able to read your code even if you have ugliest style imaginable.
|
80 | 89 | Also, nobody is ever going to look at or use the programs you write as your homework again.
|
|
90 | 99 |
|
91 | 100 | As a result, this will be a course which is very practice centered.
|
92 | 101 | We will learn programming the \emph{right} way.\footnote{%
|
93 |
| -Well, at least, what I consider as the \emph{right} way.% |
| 102 | +Well, at least, what \emph{I} consider as the \emph{right} way.% |
94 | 103 | }
|
95 | 104 | The downside of this approach is that we will sometimes go off on tangents in the text.
|
96 | 105 | While I am introducing variables in \cref{sec:variables}, for example, I will also explain how to use a static code analysis tool designed to find type errors in variable use.
|
|
0 commit comments