Tag: Refactoring
-
FOR vs WHILE: How to choose?

When I started learning computer programming in C in my software engineering school, for loop was forbidden. Using it would result in a -42 grade. Why? To teach me the logic behind for loops. But now that I can choose, when do I use for loops?
-
Make simple things simpler?

I often encounter juniors during training sessions or when I join a new team. They all have in common a simple, naive way to code. Is that bad in itself? I don’t think so. I prefer the simplicity and efficiency of FastAPI over the convoluted 100% DRY design of DjangoRestFramework. I prefer the naive and…
-
“Range len”, the anti-pattern

One step further on the way of Python: don’t count to get, just get. A common anti-pattern used by Python beginners is the “range len” pattern. I’m pretty sure you already encountered this anti-pattern in the past, and there is even a high probability that you have done it yourself. I did too ! Anti-pattern…
-
“Hidden and”, the anti-pattern

One step further on the way of Python: don’t hide “and” with “if” nesting. It’s very common to see nested “if” statements in code bases. And if the possibility to nest “if” statement make sense and can be very useful, there is a common anti-pattern easy to recognize and easy to fix. I call this…