Skip to main content

5 posts tagged with "tdd"

View All Tags

Testing hello world function in python with doctests

· 5 min read
Serhii Hrekov
software engineer, creator, artist, programmer, projects founder

Sometimes even the simplest programs deserve solid testing—especially when you're working in a team or trying to set strong standards for code quality. In this note, we'll take the most basic example—"Hello, World!"—and build out everything around it to demonstrate how doctests can be used effectively, even for something so trivial. The goal is to build intuition for testing, not just solve a toy problem.

Various Ways for Executing Doctests in Python

· 8 min read
Serhii Hrekov
software engineer, creator, artist, programmer, projects founder

Executing Doctests in Python: A Comprehensive Guide

Doctest is a module in the Python Standard Library that enables you to write tests within the documentation of your code—typically inside docstrings. These tests look like interactive Python sessions (as if they were run in a Python shell), and the doctest module verifies that the output matches the expected result. While doctests are generally simpler than unit tests written with unittest or pytest, they are powerful for checking that code examples in documentation remain correct over time.

This guide explores the various ways to execute doctests in Python, from running them via the command line to embedding them in code and running them programmatically.

Test-Driven Development (TDD) - Writing Code That's Correct by Design

· 10 min read
Serhii Hrekov
software engineer, creator, artist, programmer, projects founder

Not only Shift-Left mantra matters

The mantra of "Shift Left" has echoed through the halls of software development for years now, and for good reason. The core idea is simple yet powerful: move testing, quality, and security considerations as early as possible in the development lifecycle. It's about catching problems when they're small and cheap to fix, not when they're gargantuan headaches in production. But as a lead engineer who's seen a few projects through the trenches, I've come to realize that "Shift Left" isn't the destination; it's the starting point.

To truly build robust, maintainable, and high-quality software, especially in a dynamic language like Python, we need to embrace a set of development paradigms that not only support but enhance the "Shift Left" philosophy. These aren't just buzzwords; they are methodologies that, when adopted, fundamentally change how we approach writing code for the better.

Beyond Shift Left. Development Paradigms Every Programmer Should Know

· 5 min read
Serhii Hrekov
software engineer, creator, artist, programmer, projects founder

I'm continuing the paradigms circle. The Shift Left paradigm is well-known in the DevOps and QA communities for its philosophy of catching bugs, security issues, and integration problems early in the development lifecycle. But Shift Left is not the only valuable philosophy out there. In fact, in some contexts, other paradigms can be even more effective.

This article introduces several software development paradigms that complement or enhance Shift Left—and may even be more impactful depending on your context.

Paradigms Every Beginner Should Know Before Learning Shift Left

· 5 min read
serhii_hrekov

Before diving into Shift Left, which emphasizes catching bugs, performance, and security issues early in the software development lifecycle, it’s important for new programmers to learn the foundational paradigms that support this philosophy.

These paradigms teach early thinking, good code hygiene, and automation — all of which are building blocks of effective software engineering.