Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blé Mardel Airport Challenge #196

Open
wants to merge 41 commits into
base: main
Choose a base branch
from

Conversation

mardeldev
Copy link

No description provided.

class Instruction {

}
export default Instruction;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What went well:

  • I think that I have done a good job of following TDD principles, by first writing failing tests, then writing production code to pass the tests.
  • With the use of the Instruction class, I was able to loosely couple my code and maintain high cohesiveness. This was done by using the instruction class that took in an airport, and plane object...and only having the relevant methods written in the relevant classes. For example, the instruction class simply calls on the airport's landPlane() method. It doesn't handle the landing of the planes itself.

expect(() => { testInstruction.landPlane() }).toThrowError('Too stormy to land / take-off');
})
})
})
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What went well:

  • With the use of Jasmine as my testing framework, I was able to advance from simple assertion tests. I was also able to test whether the correct methods were called, and also test my error-handling procedures.

this.#airport.landPlane(this.#plane);
}

takeOffPlane() {
if (this.#plane.isLanded() === false) {
throw this.#takeOffError;
}
if (this.#airport.checkWeather() === 'stormy') {
throw this.#weatherError;
}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even Better If:

  • I could have used a method to handle the logic of checking for errors, instead of having them within the methods that should only be doing one thing e.g. landing or take-off a plane. This would make my code look cleaner, and it would be easier to maintain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant