This repository provides the solution to a simple programming challenge, the weather challenge. Though the challenge is very simple and a rather synthetic use-case, the results are a helpful starting point to discuss programming flavor, skills and methodology.
NB: Please do not try to work on this challenge, it has already been solved. Start with the original state (upstream version).
A solution for the given tasks has been implemented which aims for
-
robustness & correctness,
-
readability & maintainability,
-
clean software design & architecture.
The author is prepared to discuss the implementation and software design decisions. In order to show eXXcellent staff how one would solve the task when working on one’s day-to-day job, development notes have been taken.
Programmers usually scan forks of a project looking for inspiration and in order to try to reinvent the wheel. This has been omitted this time, and in this case, ideas & solutions are author’s own, as you want to partly reinvent the wheel with this programming challenge.
There is no plain "right" or "wrong". Instead, people will talk about how the goal has been achieved and about thoughts and design idea and process.
The challenge has not really been boring, but rather synthetic of course. It and its solution hopefully more or less resembles the development needs at eXXcellent and helps with a job interview.
Between ~1 hour up to ~3.5 hours,
depending on your previous experience & development environment.
- Weather
-
In
weather.csv
you’ll find the daily weather data of a single month. Read the file, then output the day number (column oneDay
) of the day with the smallest temperature spread (difference between maximum & minimum temperature of the day.) The maximum temperature is the second columnMxT
, the minimum temperature the third columnMnT
. - Football
-
The
football.csv
file contains results of the English Premier League. The columns labeled ‘Goals’ and ‘Goals Allowed’ contain the total number of goals scored by and against each team (so Arsenal scored 79 goals themselves and had 36 goals scored against them). Read the file, then print the name of the team with the smallest distance (absolute difference) between ‘Goals’ and ‘Goals Allowed’. - Task
-
-
Try to write a single program, which is able to solve the "Weather" challenge.
-
Then try to refactor & extend your solution, that it additionally supports the Football challenge.
-
- Process
-
-
Favour the software design goals described under Goal over other goals like performance or feature set.
-
Try to follow a test-driven development approach.
-
Your solution should focus on maintainability, reusability and readability. Here are some hints on how you may achieve these goals:
-
The most important aspect is separation of concerns. Think about the different concerns involved in the task and how they may need to change in the future. For example: one concern is reading the file. What others components can you think of? Try to design separate, concise software components for each concern.
-
Often a quick diagram illustrating the components and their interactions can be helpful. If you draw a diagram, feel free to include it in your solution.
-
Design intuitive interfaces for the components in a way that each component can be replaced. For example in the next evolution step of your solution you might need to support other data formats like JSON files or even Web services. The Reader for the CSV-files in your example could be replaced with a reader that implements the same interface but reads JSON-files.
-
Use meaningful names for classes, properties and methods. By reading the name, one should already have an idea of what something does.
-
Document your development by small, frequent git commits that address a specific matter each (e.g a feature). Try to make the commit messages as expressive as possible, so a reader knows what a commit does.
First, fork or directly clone the repository.
The project scaffolds provides a Maven pom.xml
as starting
point. You should be able to start with any IDE or text editor
you are convenient with.
After installing Maven 3.x you should be able to
- Build & test your project
-
mvn verify
- Then to run the main class de.exxcellent.challenge.App
-
mvn exec:java
- To remove the compilation output
-
mvn clean
- Or use your IDE functionality
-
to run & debug you program.