Code Monkey home page Code Monkey logo

Comments (1)

meyfa avatar meyfa commented on August 16, 2024 1

Hey, thank you for your interest, it would certainly be very nice to see some more adapters for different things!

I agree that it might be impossible in some cases to implement all of the methods, and perhaps they should be optional. But then again, there are the following reasons against that:

  • Interfaces are contracts that guarantee specific methods to exist, independent of any implementation details. Take as an example my project GiantDB, for which this code was written initially. It wouldn't work given an adapter that doesn't implement all interface methods.
  • IMHO, having to test whether some method is implemented every time you want to use it is a bit cumbersome. In fact, if your code depends on a specific method, and that method does not exist, you can't really recover gracefully, with or without prior checking.

I see where you're coming from. If your code needs a subset of the methods in fs-adapters, or a different set of methods, it would probably be best to create a different interface, though. That way, all consumers of fs-adapters can be sure they get what they asked for, and your implementations don't have to deal with interface methods they can't possibly implement.

Obviously, what constitutes the "right" set of interface methods is hugely opinion-based and I don't claim that my choices here are universally correct. I'm simply saying that making methods optional will make using this code more difficult. Marking this as closed for now, but feel free to tell me if you think I'm wrong :)

from fs-adapters.

Related Issues (2)

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.