It is hardly readable: we don't have an overview on all the inputs for the irrigation problem (address, crop, irrigation planning, weather data queried etc)
It is difficult to test other parameters: we have to change the parameters directly in the source code
Also there is a lot of magic numbers every where: 8 for the dimension of the problem which appears to be 2 * 4:
4: number of irrigation days during the crop season starting from 2006-03-31 to 2006-10-20
2: dimension of an event in the irrigation planning: day of the month & amount of water in cm
This problem is too specific and hardly adaptable with the current code structure (if we add 1 event in the planning for irrigation, we will have to change the dimension of the problem from 8 to 10 everywhere in the code)
Context
The code for irrigation class lacks of cohesion.
Also there is a lot of magic numbers every where: 8 for the dimension of the problem which appears to be 2 * 4:
This problem is too specific and hardly adaptable with the current code structure (if we add 1 event in the planning for irrigation, we will have to change the dimension of the problem from 8 to 10 everywhere in the code)
Solution proposed
Refactor the code to