Nov 1st 2016

Introduction to Programming with Java Part 2: Writing Good Code (edX)

Learn to program in an easy and interactive way and enter the fascinating world of computer science. This is an introductory course to learn programming with Java in an easy and interactive way. This course is designed taking into account the subset and recommendations of the College Board in order to prepare learners for the Advanced Placement (AP) Computer Science A exam. The course is divided in three parts of five weeks each.

Part 2 takes over from the first part, and aims to teach how to code good programs in Java, understanding “good” as both correct and efficient. Basic principles of software engineering will be introduced to make it easier for our future self and others to reuse code. Ethical issues and the intellectual property of our programs will also be addressed in the last part of this course. Examples and case studies will be provided, so that learners can implement simple but increasingly complex programs in Java.

Part 3 will deal with fundamental data structures, such as sequences, and algorithms on them, such as searching and sorting.

Emphasis is put on immediate feedback and on having a fun experience. Programming knowledge is not only useful to be able to program today’s devices such as computers and smartphones. It also opens the door to computational thinking, i.e. the application of computing techniques to every-day processes.


It is recommended to be familiar with the topics covered in Introduction to Introduction to programming with Java, Part 1: Starting to Code with Java.

What you'll learn:

- Detect and correct common programming errors at compile time.

- Detect and correct common programming errors at run time using debugging tools.

- Check that the program does what it is supposed to using unit-testing processes.

- Compare the efficiency of two programs in terms of the resources used.

- Model simple programs using basic software engineering techniques.

- Determine if a program has been developed respecting ethical considerations.


1. Debugging

The first week starts from basic errors that occur at compile time and at run time when developing programs, and introduces debugging as a powerful and flexible strategy to detect and correct errors. The Eclipse IDE Debugger will be used to illustrate the debugging process with practical examples.

2. Reasoning & Testing

The second week addresses formal mechanisms to test that programs do what is expected of them, introducing unit testing processes, particularized in the JUnit framework for testing programs written in the Java language.

3. Complexity

The third week analyzes programs from the point of view of efficiency in the use of resources, such as computation time and storage, and presents simple mechanisms to improve the efficiency of Java programs.

4. Software Engineering

The fourth week introduces basic principles of software engineering with the aim to improve robustness, modularity, reusability and maintainability of programs.

5. Ethics

The last week studies ethical issues related to software development, including privacy, legal issues, intellectual property rights, and social ramifications.