1.4-Software-Development-Principles

Exam Software Development Principles - 2024-07-01 (Exam)

Introduction

This exam is made up of three parts. These test your ability to explain and apply development principles.

Points

You can get a total of 16 points. These points are distributed as follows:

Component Number of points Time suggestion
Part 1 4 15 min
Part 2 8 30 min
Part 3 18 90 min

Documentation

The following websites are available during the test:

Part 1: Terminology [4pt]

Answer the questions below. Write your answers in the studentAnswers.md. There is a .md file for english and dutch. Choose the language you prefer. (You must not add other languages!)

Question 1a [2pt]

What is meant by a declaration? How would you define what this is? Give two examples.

Write your answer in the student answers file of the project.

Question 1b [2pt]

What is meant by “KISS”? Give an example of this too.

Write your answer in the student answers file of the project.

Part 2: Streams [8pt]

The resources folder contains a file which lists pokemon and their characteristics. Some fields are:

This last field is a boolean.

For instance, the first pokemon in the list is “Bulbasaur”, which has the types “Grass” and “Poison”. It has 45 hitpoints. It belongs to generation 1. And it is NOT a legendary. Please note that a bit further down: “Squirtle” only has a type “Water” the other type is empty.

Questions to answer [2pt per question]

There are four methods with no meaningful content (doStreams1(), doStreams2(), etc.) They are used to display information about the dataset.

  1. Return the number of Legendary pokemons (There are more than 100)
  2. Return a list of names of all pokemon with a singly type. (Among others, the list contains Charmander and Squirtle)
  3. Calculate average hitpoints for Grass type pokemons. (Answer lies between 60 and 70)
  4. List the names of the top 10 weakest (hp) pokemons. (List starts with Shedinja and Diglett)

Implement the four methods using java streams. Any other implementation method will not award any points.

Assignment 3: Refactoring [18pts total]

Introduction

In this segment you will improve a rather badly written program. The questions below will guide you through the process.

You are ONLY required to change the code of the TourismManager. The Application and the PointOfInterest class do not require any changes.

This program loads a list of Point of Interests (PointOfInterest) or POI’s. The tricky thing is that my datasource contains different “fields” per item. Some have a field “artist”, others have a “webpage” or other codes that we don’t need to understand.

There are only four fields guaranteed:

The lat and long identify the POI’s location. The tourism fields can have the following values: “statue”, “museum”, “viewpoint”, “hotel”. But there may be many other possible values!

3a Generics [4pt]

Reading POI’s from a file delivers data in a non-generic list structure.

3b Enums and/or constants [4pt]

The POIManager uses a lot of fixed value to analyse the JSON structure. Improve the code to use either constants of enums. Also simplify the code by applying KISS.

3c Dependency injection [4pt]

Once again, the implementation of the TourismReader class must not be changed except for the following.

The POIManager is now directly dependent on the TourismReader, this makes testing the POIManager hard. We want you to use dependency injection so that we can test its functionality separately without having to read an actual file.

3d Additional Testing [4pt]

Please write tests for the following classes and situations:

3e Readability [2pt]

After making changes to the code, please confirm that the code clearly improves.

Create packages that divide the code in clear segments.

When writing tests follow these rules: