Distance Teaching Information
To limit the spread of the corona virus, the course is currently strictly restricted to distance teaching.
- Lectures and take place online using the Zoom conference system.
- Passwords required to join the Zoom meetings will be sent to the course mailing list.
- The course will follow the normal schedule below, including the irregular labs.
- Students are advised to review the material in the lectures and labs resource sections below.
Programming is not just a matter of writing a program that runs (correctly), or implementing a particular algorithm. Modern programming has become a task in managing structural complexity of computer systems. For small-scale programs, which often serve as a wrapper (handling inputs and outputs) for some algorithm, the (structural) complexity is dominated by the abstractions, operations, and data structures required to implement the algorithm. In medium-sized programs and large-scale software systems, the complexity due to algorithm and the associated data structures stops dominating as the program becomes complex as a result of the number of concepts and their interactions. For such programs, design plays a critical role as the ability to develop and maintain such programs surpasses the capacity of a single person.
In such projects, the ability of team members to communicate effectively becomes extremely important, and the source code of a software system becomes one of the communication channels, which also happens to exactly reflect the current state of the system. While source code quality is (usually) not directly related to correct function of a software system, it does have a significant impact on other important aspects, such as readability, maintainability, and together with design also extensibility and reusability.
The source code quality manifests in many ways, from source code formatting, ordering of statements, choice of variable and function names, decomposition into methods, the content of comments, to design of classes and interfaces. At the lowest level, the goal is to find how to clearly and conveniently capture the executed operations, while at the highest level, the goal is to identify and use good abstractions, which simplify writing and orientation in code, and thus make a program easier to maintain and extend.
Through lectures and lab work during the semester, the course aims to introduce the students to (best) programming practices that lead to better code and program design. The goal is to motivate the students to adopt and use these techniques in practice.
- Software construction and design, managing essential and accidental complexity.
- API design, general principles, impact on class and method design.
- Class design, abstraction & encapsulation, inheritance & composition, polymorphism, immutability.
- SOLID design principles, design patterns in the context of design principles.
- Method design, cohesion, naming, parameter passing, returning values, using exceptions, defensive programming.
- Basic building blocks, variables and constants, general guidelines, naming convetions, fundamental data types.
- Control structures and primitives, general guidelines, conditional statements, loop statements, code organization.
- Code formatting, general principles, formatting blocks of code and code elements, formatting aids.
- Documentation, internal documentation and comments, self-explanatory code.
Contact and office hours
The course has a mailing list which serves as the primary means of communication between the students and the lecturers. Please use the mailing list for any questions or suggestions related to the course, because it will (most probably) be of interest to other students as well.
If there is something that you do not want to discuss in the mailing list, do not hesitate to contact either of us directly or via email:
When sending us an email, please do try to make sure that what you are asking is not already answered elsewhere – either in the mailing list or on the course web page.
E-mail is preferred for brief inquiries and it is generally OK to come to my office without an appointment. However, a consultation is not a private lecture, therefore if you need to discuss a topic at length, it is better to arrange an appointment with a clear goal. This is especially important if you have trouble understanding something, because the first step is to find out what is it that you still understand and what is the next bit which is unclear.
I can be found in office 205 (2nd floor in the Malá strana building), except when I’m not, which is: on Fridays, when I’m teaching, when attending the department seminar, or when attending a conference or a project meeting. It is safe to assume that I will be in the office between 10am and 5pm (I often come earlier and stay longer), but if you plan to come outside those hours, it is better to contact me in advance.
The focus of the work during the semester lies in a set of assignments which students are expected to work on outside of class. To compensate, the number of labs is reduced and the labs follow an irregular schedule. The following calendar shows the lab schedule and the deadlines for assignment turn-ins:
Video recordings from the lectures given on Zoom have been moved to a
hosted on SharePoint. You will need to log in with your CAS credentials to access the files.
<your-login>@cuni.cz on the log-in screen where
<your-login> is the login name you
use to log into the Study Information System (SIS).
|2020-02-17||Introduction, software development||Slides|
|2020-03-02||API design, class design||Slides|
|2020-03-16||Design principles||Slides, SRP, OCP, LSP, ISP, DIP, Video|
|2020-03-23||Design principles in design patterns||Slides, Video|
|2020-03-30||Unit testing and testable design||Slides, Video|
|2020-04-06||Design principles in design patterns (continued)||Slides, Video|
|The April 14 lecture was not scheduled (Easter holiday)|
|2020-04-20||Design principles in design patterns (finished), Method design||Slides (patterns), Slides (method design), Video|
|2020-04-27||Method design||Slides (method design), Video|
|2020-05-04||Method design, Defensive programming||Slides (method design), Slides (defensive programming), Video|
|2020-05-11||Basic building blocks – variables and constants||Slides, Video|
|2020-05-18||Structured programming primitives – sequencing, selection, and iteration||Slides, Video|
|Additional topics: code formatting, documentation, refactoring (not covered during the lectures)||Slides (formatting), Slides (documentation), Slides (refactoring)|
|2020-02-24||Agenda, circuits API design exercise||Agenda slides, Initial circuits API design exercise, Modified circuits API design exercise|
|2020-03-09||API review, API examples, circuits & benchmarking harness||API review slides, API mis-design examples, API design exercises|
|2020-03-23||API design presentations||Videos|
|2020-04-27||Progress update presentations||Videos|
Assignments and grading
The core of the work in the course comes from multiple assignments. Some of them are intended for pairs of students (to facilitate discussion about design and to try working with someone else), while others have to be submitted individually. The final grade is mostly determined by the assignments and the course can be passed with flying colors solely on the basis of excellent work during the semester.
The maximum amount of points that can be awarded is 100. The mapping between points and the final grade is shown in the following table:
|1||≥ 87 pts|
|2||≥ 73 pts|
|3||≥ 60 pts|
The course is mostly based on the 2nd edition of the Code Complete book by Steve McConnel (also in Czech):
- McConnell, S. Code Complete: A Practical Handbook of Software Construction. 2nd edition, Microsoft Press, 2004, ISBN 978-0735619678
- McConnell, S. Dokonalý kód: Umění programování a techniky tvorby software. 2. vydání, Computer Press, 2006, ISBN 80-251-0849-X
While there are many other books dealing with the software development and maintenance, only a few put such a strong emphasis on writing program code. Another useful source of insight is the 2nd edition of the Effective Java book by Joshua Bloch:
- Bloch, J. Effective Java. 2nd edition, Addison-Wesley, 2008, ISBN 978-0-321035668-0
With respect to design principles, essays and books by Robert C. Martin are a time-proven classic, and when it comes to design patterns and their connection to design principles, I have found the Head First Design Patterns book by Eric Freeman, Elisabeth Robson, Kathy Sierra, and Bert Bates to be both entertaining and enlightening:
- Freeman, E., Robson, E., Sierra, K., and Bates, B. Head First Design Patterns. 2nd edition, O’Reilly, 2014, ISBN 978-0-59600712-6
In addition to books, many interesting essays and articles on software design and good practices can be found on the web. Links to many of those can be found in the notes to lecture slides.
When it comes to design and testing, the online guide on Writing Testable Code by Miško Hevery provides a set of guidelines that help keep certain design malpractices at bay and testers happy:
- Hevery, M. Writing Testable Code. Available online at http://misko.hevery.com/code-reviewers-guide/.