Skip to main content

7 posts tagged with "best-practices"

best-practices tag description

View All Tags

SOLVED - fatal: Not possible to fast-forward, aborting

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

This error is Git’s way of saying: "I can't just stack your new commits on top of the remote ones because the history has split."

In technical terms, your local history and the remote history have diverged. You have commits that the server doesn't, and the server has commits that you don't. Git is refusing to "Fast-Forward" (which essentially means "just move the pointer forward") because there is nowhere straightforward to move it to.

Here are 5 ways to solve this, ranked from "Standard Practice" to "Nuclear Option."

Reasons to use dataclass over pydantic basemodel

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

While Pydantic is the industry standard for external data (APIs, JSON parsing), Python's built-in dataclasses are often the better choice for internal data.

To answer your specific questions:

  1. Is it speed? YES. Dataclasses are significantly faster at creating objects (instantiation).
  2. Is it strict data type? NO. Pydantic is stricter. Dataclasses do not validate types at runtime; they blindly accept whatever you give them.

Here are the 4 most convincing reasons to use Dataclasses over Pydantic in a modern app, with examples for each.

if-else Fail Fast pattern in Python

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

The concept of "fail fast" is a fundamental principle in software engineering, rooted in the idea of handling erroneous conditions immediately at the entrance of a function or code block. From the perspective of a high-level Python developer, this technique, often applied using if/return patterns, is key to writing clean, readable, and maintainable code.

Here is an analysis of best practices, techniques to master, and patterns to strictly avoid when working with conditional logic.

Supabase Pitfalls: Avoid These Common Mistakes for a Robust Backend

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

Supabase Pitfalls: Avoid These Common Mistakes for a Robust Backend​

Supabase offers a powerful open-source alternative to Firebase, built around PostgreSQL. Its ease of use makes it a favorite for rapid development, but this very convenience can lead developers down paths that introduce technical debt, performance bottlenecks, and security vulnerabilities. Understanding and avoiding these common pitfalls is crucial for building a robust and scalable application.

How to Easily Write Docstrings in Python Without a Headache (Using VSCode)

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

Writing docstrings in Python can feel like a chore - especially with the odd formatting involving triple quotes, >>> signs, and parameter blocks. But clear, standardized docstrings are critical for both readability and maintainability.

If you’re using VSCode (Visual Studio Code), you’re in luck. With a few extensions and configurations, you can make writing professional, PEP 257-compliant docstrings painless.

Black - Auto-Format Your Python Code Like a Pro

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

Writing clean and consistent code is a mark of professionalism, and it also makes collaboration easier. But keeping formatting consistent manually is hard. That’s where Black, the Python code formatter, shines.

Black automatically formats your code according to PEP 8 (Python’s style guide), with minimal configuration and zero fuss. This guide will show you how to install it, use it, and why it's helpful - especially if you're new to Python programming.

Understanding Off-by-One Errors in JavaScript

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

Off-by-one errors (OBOEs) are among the most common logic bugs, even for seasoned developers. These bugs occur when a loop or operation goes one iteration too far or one iteration too short-leading to incorrect results, missed elements, or crashes.

They usually occur in:

  • Loops
  • Array indexing
  • Ranges
  • Substring operations