These guys hit it big during the .com boom with software.com --> openWave.
Now they already have a billion a year in sales. Nice.
Also get in on Spotify. Scandinavians never disappoint. Ja?
Hard-to-find tips on otherwise easy-to-do tasks involving everyday technology, with some advanced insight on history and culture thrown in. Brought to you by a master dabbler. T-S T-S's mission is to boost your competitiveness with every visit. This blog is committed to the elimination of the rat from the tree of evolution and the crust of the earth.
This post helps you spot bad software patterns—specifically, violations of the SOLID principles in Python code.
One class should do one thing, and do it well.
class Report:
def generate(self):
return "Report content"
def save_to_file(self, filename):
with open(filename, 'w') as f:
f.write(self.generate())
Software should be extendable, not modifiable, for new behavior.
class DiscountCalculator:
def calculate(self, customer_type, total):
if customer_type == "Regular":
return total * 0.9
elif customer_type == "VIP":
return total * 0.8
Subtypes must be substitutable without breaking the program.
class Bird:
def fly(self):
print("Flying high!")
class Ostrich(Bird):
def fly(self):
raise Exception("Ostriches can't fly!")
Don't force classes to implement unused methods or interfaces.
class Worker:
def work(self):
pass
def eat(self):
pass
class Robot(Worker):
def work(self):
print("Robot working")
def eat(self):
pass # makes no sense for a robot
Depend on abstractions, not on concrete implementations.
class LightBulb:
def turn_on(self):
print("Bulb on")
def turn_off(self):
print("Bulb off")
class Switch:
def __init__(self, bulb: LightBulb):
self.bulb = bulb
def operate(self):
self.bulb.turn_on()