thibtrip / thib Goto Github PK
View Code? Open in Web Editor NEWThis repository contains some simplified examples of my work with individual-related data at port-neo-Freiburg GmbH, an E-Mail Marketing company in Freiburg, Germany
This repository contains some simplified examples of my work with individual-related data at port-neo-Freiburg GmbH, an E-Mail Marketing company in Freiburg, Germany
Some feedback about the class splitting, as requested ๐
thib/2020/lightning_talks/split_class/human.py
Lines 22 to 25 in db1d961
This reaching through objects is considered a bit of an anti-pattern in some circles (Law of Demeter). The reasoning goes something like this: Say you change the signature of Legs.move
to have a required required argument, like an integer steps
. Then you would have to change all the code which uses human.legs.move
. Instead you could hide the legs as implementation detail and only have to change the one place inside the facade.
class Human():
...
def move_legs(self):
self._legs.move(3)
thib/2020/lightning_talks/split_class/human.py
Lines 33 to 34 in db1d961
Here you are assigning a global variable, why would you need to do that? If you want to use it as global then you can just import it? I would pass a singleton as parameter to __init__
, since there might be humans which do not belong to the same community ๐.
thib/2020/lightning_talks/split_class/human.py
Lines 38 to 41 in db1d961
If avoidable I would not construct objects in __init__
but rather inject the dependencies.
Maybe something like this?
class Brain():
def __init__(arms, legs, ...):
self._arms = arms
self._legs = legs
def move_legs():
self._legs.move()
...
class Human():
def __init__(brain):
self._brain = brain
def move_legs(self):
self._brain.move_legs()
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.