Git Product home page Git Product logo

Comments (8)

notaphplover avatar notaphplover commented on July 30, 2024

@abvg9 Try to reference code with GitHub references in base of a certain commit. For example, the line you are referencing is this one

from catan-heroes.

notaphplover avatar notaphplover commented on July 30, 2024

@abvg9 Mhmm I think maybe the code should allow that.

In the actual scenario there are no chances to get an structure with no owner since TerrainType.NONE is banned, but what if we implement a terrain with no owner, such an obstacle? we shouldn't code in base of the current scenario, we should code keeping in mind the desired behavior we want to implement. And the desired behavior is a calculus of the structures with owner.

What do you think about this?

from catan-heroes.

abvg9 avatar abvg9 commented on July 30, 2024

So why did we have an if that checked that? If it was an unnecessary case then of course it would not be necessary to develop the exception, however, if the revision did make sense, it is recommended to treat it as an exception. Perhaps with a RuntimeException since it allows to avoid the treatment with a try catch.

from catan-heroes.

notaphplover avatar notaphplover commented on July 30, 2024

So why did we have an if that checked that? If it was an unnecessary case then of course it would not be necessary to develop the exception, however, if the revision did make sense, it is recommended to treat it as an exception. Perhaps with a RuntimeException since it allows to avoid the treatment with a try catch.

As I said previously:

  • what if we implement a terrain with no owner, such an obstacle?

  • we shouldn't code in base of the current scenario, we should code keeping in mind the desired behavior

Those are the reason to place the if block. It's not an unnecessary case, but an exception does not make sense because it's a valid case.

from catan-heroes.

abvg9 avatar abvg9 commented on July 30, 2024

So ... how do you know what happened if the function exits for that return? Is it a function that if you call it, it has no effect?

from catan-heroes.

notaphplover avatar notaphplover commented on July 30, 2024

how do you know what happened if the function exits for that return?

Who is "you" in that context? Probably that "you" has nothing to take care about that. Having said that, that "you" probably could realize that no production increment was performed.

Is it a function that if you call it, it has no effect?

Sometimes yes as you can figure looking at the code

from catan-heroes.

abvg9 avatar abvg9 commented on July 30, 2024

That you refer to those who review the code at runtime to analyze what has happened. In the event that a behavior occurs and one does not know how to differentiate between what has occurred, it generates uncertainty and causes the traceability of the code to be lost. In general, it is malpractice.

from catan-heroes.

notaphplover avatar notaphplover commented on July 30, 2024

That you refer to those who review the code at runtime to analyze what has happened. In the event that a behavior occurs and one does not know how to differentiate between what has occurred, it generates uncertainty and causes the traceability of the code to be lost. In general, it is malpractice.

It would be a bad practice if that was an unexpected behavior, if you say that components should not fail silently, I agree with you. But this is not a sillent error, its the desired behavior.

it generates uncertainty and causes the traceability of the code to be lost. In general, it is malpractice.

As said previously:

Having said that, that "you" probably could realize that no production increment was performed.

from catan-heroes.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.