Skip to content
This repository has been archived by the owner on Mar 14, 2021. It is now read-only.

Antipattern: Not implemented exceptions #62

Open
AlexS12 opened this issue May 4, 2020 · 1 comment
Open

Antipattern: Not implemented exceptions #62

AlexS12 opened this issue May 4, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@AlexS12
Copy link
Owner

AlexS12 commented May 4, 2020

Current situation
After reading https://white.ucc.asn.au/2020/04/19/Julia-Antipatterns.html, I realised that, currently, this situation occurs for some types in the code:
https://github.com/AlexS12/FlightMechanics.jl/blob/master/src/models/aerodynamics.jl#L24
https://github.com/AlexS12/FlightMechanics.jl/blob/master/src/models/dynamic_systems.jl#L10
https://github.com/AlexS12/FlightMechanics.jl/blob/master/src/models/propulsion.jl#L5

More may be found...

Objective
Adopt language paradigms and really obtain helpful error messages

Solution proposal
As suggested in: https://white.ucc.asn.au/2020/04/19/Julia-Antipatterns.html

MethodError indicates this quite well and as shown gives a more informative error message than you will write. An often overlooked feature is that you can declare a function without providing any methods.

When one is in this situation, defining a interface that another package would implement, one can provide a test-suite for testing it was implemented correctly. This is a function they can call in their tests to at least check they have the basics right. This can take the place of a formal interface (which Julia doesn’t have), in ensuring that a contract is being met.

@AlexS12 AlexS12 added the enhancement New feature or request label May 4, 2020
@zsunberg
Copy link

zsunberg commented May 9, 2020

Yes, you should definitely avoid this anti-pattern!! Just create functions without any methods!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants