Contents
Small Team, Big Miracles: The Story (Part 1)

Small Team, Big Miracles: A Story of Refactoring, Leadership and Survival

Disclaimer: This story is based on real events. No developers were physically harmed in the writing of this article. The legacy code was not so lucky.

Prologue: Welcome to the jungle

When I joined the project as a Solution Architect, I felt as if I had entered an Indiana Jones movie. Except instead of searching for lost treasures, I was looking for lost console.log statements and trying to decipher hieroglyphics in the form of uncommented code.

The situation on day one:

// The real state of the project (names changed to protect the innocent)
Status: 🔥 Dumpster fire
Team morale: 📉 Existential crisis
Code quality: 💀 "It works on my machine"
Manager: 🏖️ On a month-long holiday
Architect (me): 🤔 "Do I really need this job?"

If you have ever asked yourself “How much worse can it get?”, the answer is: it can always get worse.

Chapter 1: Meeting the “inventory”

Every project has an inventory developer. This is the colleague who:

  • Has worked at the company for 15+ years ✅
  • Knows every line of the legacy code ✅
  • Holds the keys to every system ✅
  • Uses copy-paste as a primary design pattern ⚠️

Theory: Years of experience = expert

Reality: Not always

The case of the multiplying tables

// Original requirement:
"We need 12 tables in the application"

// Expected result:
12 tables = 12 components

// Actual result:
144 tables = 1 original + 11 × (copy + adjustments) + 132 variations

// How?
// "I need this table without the Email column"
// *Ctrl+C, Ctrl+V, delete column*
// Done! 🎉

// "I need this table with sorting"
// *Ctrl+C, Ctrl+V, add sorting*
// Done! 🎉

// ... repeat 142 times

Plot twist: This was not my first time.

Flashback: the pure JavaScript architect

I once encountered a project where:

  • The whole application: one file, 15,000 lines
  • Functions: 0
  • Comments: // TODO: refactor this
  • Author: an architect with 27 years of experience
  • Me: a junior developer who could not change anything

Me at the time: “Why is everything in one file?”
Architect: “Because it works that way.”
Me: “But…”
Architect: “It works!”

Lesson learned: Years ≠ experience. Sometimes years mean repeating the same mistakes.

Chapter 2: Refactoring as a rescue mission

Priority #1: Stop the bleeding and prevent the pattern from spreading.

typescript
// ❌ BAD: Copy-paste pattern
class UsersTable extends BaseTable { /* 500 lines */ }
class UsersTableWithoutEmail extends BaseTable { /* 498 lines */ }
class UsersTableWithSorting extends BaseTable { /* 520 lines */ }
class UsersTableWithFilters extends BaseTable { /* 540 lines */ }
// ... × 140 more variations

// ✅ GOOD: Configuration pattern
class ConfigurableTable extends BaseTable {
  @Input() columns: ColumnConfig[];
  @Input() enableSorting: boolean = false;
  @Input() enableFilters: boolean = false;
}

// Usage
<configurable-table
  [columns]="userColumns"
  [enableSorting]="true"
  [enableFilters]="true">
</configurable-table>

Phase 1: First aid—I created 12 reusable tables.

12 tables instead of 144
Reduction: 132 components
Maintenance: 12× simpler
Time to fix a bug: once instead of 12 times

Phase 2: The ultimate solution—one configurable table.

typescript
// settings/users-table.config.ts
export const UsersTableConfig: TableConfig = {
  columns: [
    { field: 'name', header: 'Name', sortable: true },
    { field: 'email', header: 'Email', sortable: true },
    { field: 'role', header: 'Role', filterable: true }
  ],
  actions: ['edit', 'delete'],
  pagination: true
};

// Component
<dynamic-table [config]="UsersTableConfig"></dynamic-table>

The result:

Before: 144 table components
After: 1 dynamic component + 12 config files

Code reduction: 99.3%
Maintainability: 📈 Through the roof
Developer sanity: 🧘 Restored

The Lego approach

Imagine building a house.

Copy-paste approach:

Need a three-room house → Build the whole house
Need a two-room house → Build a new house
Need a house with a garage → Build yet another house

Result: 50 houses for 50 variations

Component approach:

Components: Walls, doors, windows, roofs
Configuration: JSON describing the house

Result: Endless combinations from 10 components

Chapter 3: The eye of Sauron (or: when micromanagement kills)

After the manager returned from holiday:

Week 1:

Daily standups: 1× (OK)
Check-in calls: 2× (tolerable)
"Quick questions": 5× (hmm...)

Week 2:

Daily standups: 1×
Check-in calls: 4×
"Quick questions": 10×
"Why is this taking so long?": ∞×

Week 3:

*Developer is afraid to open Slack*
*Every commit requires an explanation*
*"Can you show me what you're doing?" = 8 times a day*

Team morale: 💀
Productivity: 📉
Call centre PTSD: 📞📞📞

A real conversation

Manager: "Why is this task taking three days?"
Me: "Because I'm dealing with technical debt from the last two years."
Manager: "But why can't it be faster?"
Me: "Imagine cleaning a ten-year-old garage full of stuff."
Manager: "You're just making excuses."
Me: "..."

Developer: "I need two hours of focus time to debug."
Manager: *calls after 15 minutes* "Have you solved it yet?"
Developer: "..."

Team: "We can't work like this."
Manager: "Why is the atmosphere so negative?"

Decision point: Either I leave, or this situation has to change.

Escalation and resolution

bash
# Complaints about the manager escalated
git log --grep="stress" | wc -l
> 47 incidents

# Team turnover rate
echo "3 developers quit in 2 months"

# HR's final decision
> The manager had to leave

Lesson learned: A good manager empowers; a bad manager controls every move.


In the next part, we will look at the great downsizing, the team's transformation and lessons learned.

All articles