Relative Content

Tag Archive for design

Pythonic design for controlling multiple devices through an I2C bus

I’m writing a piece of software in python that will communicate with a bunch of devices via an I2C bus. Each of these devices are going to need some sort of a module or class to handle the communication and data conversion in some sensible way. The operations that each of the device modules perform are drastically different.

Use global variables or methods in an API’s frontend

I am currently designing a graphics library in Java and now it’s come to making the frontend I am curious why I have never seen libraries using global variables for their settings/properties – in-fact some go out of their way to protect them such as JavaScript libraries, and of course choose to use getters and setters such as:

Handling login errors with User Class

We have a User class which handles all things related to users within a Content Management System. As you’d expect, the class contains a function login(). This function accepts three arguments: $username, $password and $remember (the latter defaulting to true).