Code Monkey home page Code Monkey logo

Comments (6)

mahilleb-msft avatar mahilleb-msft commented on May 24, 2024

Yes, this would be better. Contributions would certainly be welcome :)

from cntk.

elfring avatar elfring commented on May 24, 2024

I suggest to avoid ignorance of return values a bit more.

Are you interested to apply aspect-oriented software development?
How do you think about to encapsulate error detection and corresponding exception handling as a reusable aspect in your software?

from cntk.

frankseide avatar frankseide commented on May 24, 2024

Thanks for the suggestion. However, my hunch is that might be too much for our needs. Minimizing dependencies is also a property to strive for.

In my view, the built-in mechanism of C++ exceptions is perfectly fine for us. CNTK does not really have recoverable errors, with one exception of delay-loading of optional components (e.g. if no CUDA driver is present, we fall back to CPU mode), and the other being simple retry loops for network I/O. All other errors should simply log and fail fast due to our command-line tool nature. In such context, the only reason we ever catch exceptions is to add to their error message and rethrow, and log it at one centralized place.

One problem is how to deal with APIs that don’t throw, like fprintf(). If we need to replace those APIs, I would opt for replacing them with throwing ones. E.g. we already have an fprintf() variant that throws (fprintfOrDie()).

PrintBuiltInfo() is sort of a special case though, since its output is not critical. We could replace all fprintf() calls by fprintfOrDie(), but I am not sure whether the added code complexity (readers may not know what fprintfOrDie() means) is worth it in this particular place, because all we can do is catch an error that means “cannot write to stderr/log” and write that to stderr/log, which we won’t be able to do either.

Thanks!

Frank

From: Markus Elfring [mailto:[email protected]]
Sent: Friday, February 12, 2016 0:46
To: Microsoft/CNTK [email protected]
Subject: Re: [CNTK] Completion of error handling (#34)

I suggest to avoid ignorance of return valueshttps://na01.safelinks.protection.outlook.com/?url=https%3a%2f%2fcwe.mitre.org%2fdata%2fdefinitions%2f252.html&data=01%7c01%7cfseide%40microsoft.com%7c102fe54619024a54e40a08d33388dec5%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=VFRyM%2fXcoYqlG6l6tEiFc0P8wKlFTnosXWCz1XpgEak%3d a bit more.

Are you interested to apply aspect-oriented software developmenthttps://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2faspectc.org%2f&data=01%7c01%7cfseide%40microsoft.com%7c102fe54619024a54e40a08d33388dec5%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=%2fF%2bP86Ew1ksRvVY7%2bscK7e7eFtTef5Vg9FhiynEBnB4%3d?
How do you think about to encapsulate error detection and corresponding exception handling as a reusable aspecthttps://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2fen.wikipedia.org%2fwiki%2fAspect_%2528computer_programming%2529&data=01%7c01%7cfseide%40microsoft.com%7c102fe54619024a54e40a08d33388dec5%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=j7RSL0OsvXpcYdm%2b%2f6l1AeNOu97R%2fkYjK8A7shOT%2bCo%3d in your software?


Reply to this email directly or view it on GitHubhttps://github.com//issues/34#issuecomment-183230653.

from cntk.

elfring avatar elfring commented on May 24, 2024

If we need to replace those APIs, I would opt for replacing them with throwing ones.

Would you like to delegate such a software maintenance task to any dedicated development tool?

from cntk.

frankseide avatar frankseide commented on May 24, 2024

There is a trade-off between dependencies (=effort of getting all dependencies in place, learning curve, version management, IDE integration, and doing so in both Linux and Windows) vs. added value.

My 2 cents would be that probably that trade-off favors simplicity in our case (where most non-throwing APIs are already encapsulated).

From: Markus Elfring [mailto:[email protected]]
Sent: Friday, February 12, 2016 8:43
To: Microsoft/CNTK [email protected]
Cc: Frank Seide [email protected]
Subject: Re: [CNTK] Completion of error handling (#34)

If we need to replace those APIs, I would opt for replacing them with throwing ones.

Would you like to delegate such a software maintenance task to any dedicated development tool?


Reply to this email directly or view it on GitHubhttps://github.com//issues/34#issuecomment-183402062.

from cntk.

wolfma61 avatar wolfma61 commented on May 24, 2024

there is ongoing work in this area, but we will not do a complete redesign

from cntk.

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.