Skip to main content

Breadcrumbs Collector

  • About author
  • Cookie Policy
  • Privacy Policy

Category: good practices

Where to put all your utils in Python projects?

May 23, 2021May 23, 2021 Sebastian Leave a comment

This is a follow-up post to Stop naming your Python modules “utils”. This time, let’s see different options on organizing utility code. What is utility code? It is code that is created as a side effect when working on features but does not belong to where they are implemented. It still is necessary or convenient […]

Read More

Modular monolith in Python

December 8, 2020December 7, 2020 Sebastian 7 Comments

Microservices are not the only way I remember when the microservices boom started. Truth to be told, it still echoes strongly to this day. You could see conferences agendas packed with talks about microservices, articles galore, finally books and frameworks. At some point, I was afraid to open my fridge. Everyone and their dog wanted […]

Read More

@staticmethod considered a code smell

May 1, 2020April 30, 2020 Sebastian 5 Comments

Python offers quite a few built-in decorators that can be used to give methods of classes certain superpowers. @property turning method into a read-only field-like attribute is a classic example. Or @classmethod – a method that receives a class as a first argument, not an instance. Fun fact, this kind of method is usually called […]

Read More

Encapsulation is your friend, also in Python

April 24, 2020April 26, 2020 Sebastian 1 Comment

What is encapsulation? Encapsulation is an act of deliberate limiting access to certain software components. The most common usage is to hide certain attributes of objects from other objects that use it. The most vivid example is the usage of so-called access modifiers, private and protected in languages that support it, for example, PHP: Running […]

Read More

Beware of chicken testing! (or mocks overuse)

April 17, 2020April 20, 2020 Sebastian Leave a comment

Need for mocking Dealing with problematic dependencies is an indispensable part of software testing. Often, we cannot or do not want to rely on 3rd party service/network communication/hard drive etc., especially in unit-tests. The reasons vary; external dependencies are usually slow, fallible and difficult to put into the expected state before the actual test. Consider […]

Read More

Stop naming your python modules “utils”

April 13, 2020May 23, 2021 Sebastian 8 Comments

Imagine the following situation: there is a software developer that is either adding new code or refactoring existing one by extracting a class/function. They have to place code somewhere, but it does not seem to fit anywhere. So what does a developer do? They create a new module – utils.py. Why utils is a terrible […]

Read More

Top Posts

  • How to use code coverage in Python with pytest?
  • How to implement a service layer in Django + Rest Framework
  • The Clean Architecture in Python. How to write testable and flexible code
  • Where to put all your utils in Python projects?
  • Python & the Clean Architecture in 2021
  • What is asyncio's ensure_future?
  • Meet python-mockito and leave built-in mock & patch behind
  • Stop naming your python modules "utils"
  • How to mock in Python? - (almost) definitive guide
  • How to patch in Python?

Archives

RSS Feed

  • RSS - Posts

Categories

  • python 39
  • dajsiepoznac2017 22
  • software engineering 11
  • extjs-pathfinder 9
  • clean architecture 7
  • GitHub
  • LinkedIn
  • Twitter
sparkling Theme by Colorlib Powered by WordPress
This site uses cookies: Find out more.