Skip to content

hh-programming-2/programming-2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

123 Commits
 
 
 
 

Repository files navigation

Programming 2

Welcome to the Programming 2 course! 👋 In this course, we will deepen our programming skills and apply previously learned programming techniques, including in the context of databases. In addition to syntax and necessary libraries, we will focus on unit testing, automation tools, and version control.

👉 Full course description

Contents

🤖 Plagiarism & using generative AI tools

Copying code from other students is strictly forbidden, and automated plagiarism checks are used to detect it. Systematic plagiarism will lead to a failing grade and a report of cheating.

Also, using generative AI tools (e.g., ChatGPT or Copilot) to generate solutions directly is strictly forbidden and considered plagiarism. If you are using Visual Studio Code's GitHub Copilot extension or some other code generation autocomplete extension, make sure they are disabled. Instead, you should use generative AI tools to ask advice, such as "How to filter items in a stream using Java" or "What is the purpose of interfaces in Java". Use these tools to improve your learning, not replace your thinking.

📅 Weekly schedule

Important

To confirm your course participation, you must submit the first week's exercises before the deadline. Course assessment is based on weekly exercise points. Submissions made after the weekly deadline won't earn points.

The course requirements include weekly exercises covering different areas of the course. Exercises are submitted to GitHub. Exercises must be submitted according to the schedule, and late submissions will generally not be accepted. In cases of force majeure, extensions must be requested well in advance of the exercise deadline.

There are two types of weekly sessions:

  • Theory sessions on Mondays from 8:00 to 10:45. During these sessions, we will cover the week's topic.
  • Lab sessions on Wednesdays from 8:00 to 10:45. During these sessions, we will work on the week's exercises.

The course's attendance policies follow Haaga-Helia's common policies. Attendance should be marked on Moodle during each session.

The weekly topics and exercise deadlines can be found below. The exercise descriptions can be found in Moodle's "Exercises" tab.

👉 Here are the code examples covered during the lessons

Week Topic Deadline
1 Version control and tools of the course 26.10. at 8:00
2 The Map data structure 2.11. at 8:00
3 Unit testing 9.11. at 8:00
4 Inheritance and interfaces 16.11. at 8:00
5 Streams and lambdas 23.11. at 8:00
6 Database programming 30.11. at 8:00
7 Data structures and algorithms. See exam instructions before next week's final exam! 7.12. at 8:00
8 ‼️ Final exam on 7.12. at 8:00. Final exercise and optional advanced topics 13.12. at 23:59

Week 1: Version control and tools of the course

Warning

Exercises require a Java version between 21 and 25.

In the first week of the course, we will get acquainted with the tools we will be using throughout the remainder of the course. Our goal is to enable the application to run smoothly outside of the code editor and to automate if needed, the building, dependency installation, packaging, and testing of the application.

You can use any coding editor during the course, but the use of Visual Studio Code is highly recommended, and it will be used in all the lesson examples. Instructions on setting up Visual Studio Code for Java can be found in the materials below. Note that, using generative AI tools (e.g., ChatGPT or Copilot) to generate solutions directly is strictly forbidden and considered plagiarism. If you are using Visual Studio Code's GitHub Copilot extension or some other code generation autocomplete extension, make sure they are disabled.

Git version control will be used in this course for distributing assignments, submitting them, and for automatic evaluation. In future courses and in working life, you will likely use version control as an essential part of daily work.

The course's Java content revisits topics covered in Programming 1, aiming to ensure that by the end of the first week, all participants have a sufficient foundation in topics like collections and object-oriented programming to study the subsequent topics.

Recommended materials

Command-line/terminal:

"In your development process, you'll undoubtedly be required to run some commands in the terminal (or on the "command line" — these are effectively the same thing). This article provides an introduction to the terminal, the essential commands you'll need to enter into it, how to chain commands together, and how to add your own command line interface (CLI) tools."

Command line crash course. mdn web docs.

Git:

Java in Visual Studio Code:

Gradle:

Exercises

Note

You can find the exercise descriptions in the "Exercises" tab in Moodle. Submitting the "Git installation and GitHub account" exercise in Moodle is necessary to receive exercise points.

  • Git installation and GitHub account
  • Git "Hello world"
  • Warming up

Week 2: The Map data structuce

"Maps are data structures stores a collection of key-value pairs. Each key is unique and allows for quick access to values. A real life example of a map could be storing the grades for students in a class (student name is key, grade is value)."

Data Structures & Algorithms, Google

Recommended materials

Exercises

Note

You can find the exercise descriptions in the "Exercises" tab in Moodle.

  • Map exercises

Week 3: Unit testing

This week, we will get familiar with JUnit unit testing and write our own unit tests for existing code.

Recommended materials

Exercises

Note

You can find the exercise descriptions in the "Exercises" tab in Moodle.

  • JUnit exercises

Week 4: Inheritance and interfaces

This week, we will deepen our object-oriented programming skills by exploring inheritance and interfaces. Inheritance and interfaces are object-oriented solutions that promote code reusability and compatibility.

Recommended materials

Exercises

Note

You can find the exercise descriptions in the "Exercises" tab in Moodle.

  • Interfaces and inheritance

Week 5: Streams and lambdas

"The Stream API is probably the second most important feature added to Java SE 8, after the lambda expressions. In a nutshell, the Stream API is about providing an implementation of the well known map-filter-reduce algorithm to the JDK.

The Collections Framework is about storing and organizing your data in the memory of your JVM. You can see the Stream API as a companion framework to the Collections Framework, to process this data in a very efficient way. Indeed, you can open a stream on a collection to process the data it contains."

Processing Data in Memory Using the Stream API. https://dev.java/learn/api/streams/map-filter-reduce/

Recommended materials

Exercises

Note

You can find the exercise descriptions in the "Exercises" tab in Moodle.

  • Streams and lambdas

Week 6: Database programming

This week, we will start by learning how to establish a connection to a database from a Java program and perform basic CRUD operations (Create, Read, Update, & Delete). We will also explore the DAO (Data Access Object) design pattern, which models both database operations and the data contained in the database using Java classes.

Recommended materials

Exercises

Note

You can find the exercise descriptions in the "Exercises" tab in Moodle.

  • SQL databases (Chinook, JDBC & DAO)

Week 7: Data structures and algorithms

"A process or set of rules to be followed in calculations or other problem-solving operations, especially by a computer."

Oxford Languages

Recommended materials

"The purpose of this exercise is to explore various data structures and algorithms, especially from the perspective of their performance. We will also touch on performance testing of programs and the concept of asymptotic runtime.

The first part of the exercise focuses on the performance of Java lists. In the second part, the application to be developed will use an open dataset of names and dictionary entries to find Finnish first names that also have another meaning in the dictionary. Examples of such names include Tuuli ("wind") and Onni ("luck" or "happiness")."

Videos:

Articles:

Exercises

Note

You can find the exercise descriptions in the "Exercises" tab in Moodle.

  • Sorting and filtering

Week 8: Final exercise & advanced and applied topics

At the end of the course, we will deepen and apply previous topics, exploring concepts such as concurrency and recursion. This week's materials are optional and won't be included in the final exam.

Exercises

Note

You can find the exercise descriptions in the "Exercises" tab in Moodle.

  • Commit history (the final exercise)
  • ⭐ Bonus exercise: Generics and Sudoku

⭐ Bonus: Further reading


✅ Confirming the course participation

To confirm your course participation, it is necessary to submit the firt week's exercises before the deadline. The first week's exercises will revisit topics you have learned previously. The purpose of this practice is not to stop anyone from learning or completing the course but to make sure that everyone can get started with the course without problems.

📥 Submitting exercises

The course has weekly exercises that need to be submitted before the deadline. Exercises will be submitted to GitHub. Don't hesitate to ask for help with the exercises during the lessons from the teacher or your fellow students.

📊 Assesment

Caution

Submissions made after the weekly deadline won't earn points, unless discussed otherwise before the deadline.

The course assessment is based on the 0 to 5 grading scale. The final grade is based on the weekly exercise submissions and the final exam points. At least 20% exercise points (8 out of 40) and 50% of exam points are required for a passing grade.

Based on the weekly exercise points (8 weeks and 5 points from each week), you'll get the exercise grade between 0 and 5 using the following formula:

// totalExercisePoints = week1Points + ... + week8Points
public double calculateExerciseGrade(double totalExercisePoints) {
  if (totalExercisePoints < 8) {
    return 0;
  }

  return Math.round(totalExercisePoints / 8);
}

Based on the exam points, you'll get and exam grade based on the following formula.

60% of the final grade is based on the exercise grade and 40% on the exam grade. That is, the final grade is calculated using the following formula:

public int calculateFinalGrade(int exerciseGrade, int examGrade) {
  return Math.round(exerciseGrade * 0.6 + examGrade * 0.4);
}

Exam

Read the exam instructions to learn more about the exam.

⏱️ Workload

The course lasts 8 weeks and is worth 5 credits. This means that the official workload in hours is around 135 hours, which responds to around 17 hours a week. That being said, reserve enough time for the course each week.

int durationInWeeks = 8;
int credits = 5;
int workHoursForOneCredit = 27;

int totalWorkHours = credits * workHoursForOneCredit;
System.out.println(totalWorkHours); // 135 hours

double workHoursForOneWeek = 1.0 * totalWorkHours / durationInWeeks;
System.out.println(workHoursForOneWeek); // 16.875 hours a week

🔍 Finding information

This course material is mostly based on external online resources, such as documentation and tutorials. Each topic contains links to relevant materials but you will also need to find relevant resources yourself.

The purpose of the course exercises is not only to assess whether you have understood the material presented in the lessons or learning materials; rather, solving the exercises requires independent information gathering. Alongside working independently, we recommend asking questions during the lessons.

📑 Using sources of information

Programming problems often have ready-made or partial solutions available across the Internet, from forums to tutorials. In the worst case, you might find a solution that works for your problem, but don't fully understand what the code does or why it solves the issue. In professional software development, this can lead to potentially serious consequences.

Using online sources and drawing inspiration from them is allowed and encouraged, but you must not simply copy solutions; you need to understand how your code works. Additionally, especially since this is a university course, you are required to cite your sources when you borrow code, for example, from StackOverflow. An appropriate citation could be the webpage URL as a Java comment alongside the borrowed code, or another type of reference compliant with the source’s terms of use.

🧠 Prerequisites

"The course prerequisite is that you have passed the course Programming 1 (SOF005AS2AE), or can demonstrate equivalent skills and knowledge prior commencing the course. We recommend that you take the course Data Management and Databases (SOF001AS2AE) alongside the Programming 2 course if you don't already have equivalent skills in basics of databases and SQL."

Course description

If you haven't acquired solid skills from the Programming 1 course, this course will require a significant amount of work and personal effort.

About

Material for the Programming 2 course

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors