Giter VIP home page Giter VIP logo

coinhandler's Introduction

Hi, I'm Alex ๐Ÿ‘‹

I'm a software engineer based in Nottingham ๐Ÿน in the UK.

I've been in software for almost 8 years - originally coming from a background of call-center and customer service!

Currently, I am a software engineer at DeepSea. Previously, I've worked at Tessian and Oracle.

In my free time, you can find me either:

  • mountain biking
  • bouldering
  • making and playing video games
  • or spending time with my family.

You can find me online at https://alxwrd.co.uk/

coinhandler's People

Contributors

alxwrd avatar

Stargazers

 avatar

Watchers

 avatar  avatar

coinhandler's Issues

Extract out coins into their own file

Currently, the only valid coin set is GBP. It would be good to be able to use different currencies.

The file structure could become

coinhandler/
โ”œโ”€โ”€ __init__.py
โ”œโ”€โ”€ coinhandler.py
โ”œโ”€โ”€ collections.py
โ””โ”€โ”€ coins/
    โ”œโ”€โ”€ __init__.py
    โ”œโ”€โ”€ gbp.py
    โ”œโ”€โ”€ usd.py
    โ””โ”€โ”€ etc..

With usage being

import coinhandler
from coinhandler.coins import gbp  # Required, if not all coins will be `Coin`

__init__.py for coins/ will contain the base definition of Coin.

This is related to #2, with the added thought being it'd be nice to be able to remove a whole module.

coinhandler.Coin.remove_subcoins(gbp)

collections.py potential name collision

This library seems like a cool idea, looking good!

I jumped into the code and noticed there's a file called collections.py, but 'collections' is already a thing in Python:

py-collections

This might cause namespacey problems, and could slightly hinder readability - I saw collections was being imported in coinhandler.py and briefly thought it was referring to Python's own collections.

Might be worth renaming this to something more specific, although it's not really a problem if you want to keep the name the same

Don't allow invalid coins

From the README:

When using the Coin factory class, a valid coin value should be used. Not doing so can create undesirable Coin objects.

 >>> coin = Coin(23)
OnePence(23)

# Use a CoinCollection instead!

>>> CoinCollection.from_value(23)
CoinCollection(TwentyPence(1), TwoPence(1), OnePence(1))

Re-thinking this I think it should be invalid to enter a state where an undesirable coin is about to be created (OnePence(23)).

I feel the correct way to handle this is to either raise an InvalidCoin exception. If a Coin has an .amount greater than 1, it's invalid.

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.