Posts by Maksym Shalenyi

Gilded Rose Refactoring Kata

Not too long ago I tried “Gilded Rose Refactoring Kata”. It is an excellent exercise, and I highly recommend to try it. I’ve also seen many people sharing great solutions on GitHub and in personal blogs. However, almost all of the solutions I’ve seen did not reflect the reasoning about “why?” and “how?”. Why the current code needs to be refactored? How do I want to change code? How do I want to go about changing code? Why I refactored the code in this way and not another? So this post is my reflections on the “why?” and “how?” which I hope you will find useful and/or entertaining.

The kata and its test is kindly provided by Emily Bache and can be found on emilybache/GildedRose-Refactoring-Kata. I highly encourage to give it a go, as I had a lot of fun working on it. The kata goes like this:

Read more ...


My blog is back

It has been a while! But my blog is back and on a new engine!

After a mishap with a cloud provider, I’m bringing my blog back. This time I’ve decided to try static blog engine, and even more, the one that is based on Sphinx. Thanks to https://ablog.readthedocs.io/en/stable/ for awesome software.

Read more ...


pytest: dealing with halting tests

Besides using –durations option, which does not seem to show the interrupted halted tests, one possible way to deal with halting tests is to use pytest-timeout. However, it does not work with pytest-xdist, which a large issue when you are refactoring a large codebase with lots of tests and not ready to wait 5x times longer.

Fortunately, pytest is an excellent rich framework and provides a concept of hooks. And so to deal with this problem it is possible to use pytest_runtest_call hook to write to a file a time when a test started and when it ended. With this, it should be easy to figure out most of the halting tests in one go.

Read more ...


Pdb Driven Development

The most important command of pdb module that you should know is set_trace method, it enters the debugger at the calling stack frame at a given point in a program, and so far it’s the only piece of code that you should not be ashamed to copy-paste:

When you are in debugger there is a set of command that will help you investigate the scope:

Read more ...