Code Monkey home page Code Monkey logo

Comments (1)

LordMike avatar LordMike commented on August 13, 2024

Ok, I know you'll just say it should be in the docs. But here's the reason.

The Movie DB is built for a variable set of image sizes. They can add or remove sizes as they see fit. So to avoid updating the library every time they do so, I made it so that the library needs to download the config first.

http://docs.themoviedb.apiary.io/#configuration

But because this is a network activity, it's bad behaviour to do this in the constructor. Imagine if you had no network (or other errors), then you'd need to code like this:

Client client;
try {
client = new Client(..);
}
catch {
// Bad network ...
}

I persoanlly prefer not doing work in constructors, and leave it to the individual methods. Then to combat requesting the config at every instantiation, I allowed importing the config from elsewhere (say, a cached save file).

Also, imagine what would happen if you had threads (say, a server processing clients), that all needed to do stuff with TMDb. I haven't designed or tested the library for threadsafe-ness, so you may need to instantiate a new client pr. server connection. Should those also request configs? :P

But that should go in the docs. True.
I'll refer to issue #21 on this.

from tmdblib.

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.