Version without JavaScript, read-only: workshops, quizzes and running code are not available here. Full version · Catalogue · Sign in
Lecture notes · chapter 1
Why Java, and why this module
The context of the module, what Java brings to companies, and what “professional programming” means here. Nothing certified in this chapter.
This chapter will not be in the written exam. It explains why the module is taught in Java and sets out the vocabulary used in the following chapters.
Portability, robustness, ecosystem, longevity
Portability. A .java file is compiled into bytecode (.class), which the JVM executes. The same file runs on the developer's Windows machine, on the Linux server and in the production Docker image. During execution, the just-in-time (JIT) compiler optimises the code according to how it is actually used.
On the other hand, you need a JVM. In this module, it runs in your browser and you have nothing to install.
Robustness. Typing is static: a type error is detected at compile time, and therefore before going into production. Exceptions make it possible to handle failures in a structured way, and the garbage collector avoids most memory-management errors.
List<Integer> nombres = new ArrayList<>();
// nombres.add("coin"); ← rejected by the compiler, not at run time
On the other hand, Java requires more code than a language such as Python for the same result. This criticism is discussed again in chapter 13.
The ecosystem. Spring, Jakarta EE and Quarkus for the web; JPA and Hibernate for persistence; Maven and Gradle for building; JUnit, Mockito and Testcontainers for testing; Checkstyle, SpotBugs and SonarQube for quality. None of these tools is on the syllabus, but you will come across them in industry.
Longevity. There are several JDK distributions, and LTS versions are maintained for years. In banking, insurance, public administration or industry, many Java applications are more than fifteen years old and are still maintained.
Common misconceptions
What “professional” means here
A school exercise is mostly judged on one criterion: does the program work? In industry, three other questions are also asked.
- Is the code readable? Someone else, or you yourself in three months, must be able to understand it without explanation.
- Can it be modified easily? Requirements change. Adding a case should not force you to reread the whole program.
- Can it be tested? If a unit test requires starting a database, it is the design that needs rethinking.
Organisation of the lecture notes
The lecture notes have fourteen chapters, this one included. They do not have to be read in order: each sequence of the course indicates the chapter that complements it.
- Chapters 3 to 9 cover the core notions, assessed in the written exam.
- Chapter 10 presents design patterns; only three of them are certified.
- Chapters 12 and 13 are to be read, but will not be assessed.
- Chapter 14 is an exercise: code with flaws, to analyse.
Throughout the course, the examples use the same classes: Canard, CanardColvert, CanardEnPlastique, Aile, Troupe, Dresseur, and the fictional company CanardFactory, whose code is full of flaws. Keeping the same setting from one chapter to the next makes it possible to concentrate on the notion being studied rather than on a new example.