Daily Shaarli
August 20, 2020
About impl Trait
So there is four stages of quality for each name :
- Nonsense : For example, we might extract a method from a larger one and quickly rename it
somethingWhatever()
to get the refactor done and the tests passing. - Accurate : We rename the nonsense method to what it actually does, such as
processPayroll()
- Precise : Once we realise what the method really does, we might refine the accurate name and give it more precision, such as
loopThroughEmployeesAndPayThem()
. - Meaningful : At this point, we’ve revealed the complexity of the method, and can look to split it up into two methods:
forEachEmployee()
and perhaps apayWages()
method on a separate interface.
I always use at least accurate names, because it helps me even during the development process. Something I tend to is to use meaningful names and thus creating a lot of functions 😅
I dislike the precise one as it looks as a function that need to be changed, because of doing to much things. At least, this reveals the complexity behind the name.
Rule: If a type parameter only appears in one location, strongly reconsider if you actually need it.
A website that regroup all 88x31 gifs
The problem of centralized services : when they are down, everything is down
Le code python écrit :
def LetsFaceIt(gender, ethnicity):
try:
if (gender != "Male")
chanceOfSTEMJob = "24%"
if (ethnicity != "White" and ethnicity != "Asian"):
chanceOfSTEMJob = "5%"
except:
logging.error("This is the STEM gap")
return chanceOfSTENJob