← All posts

Software Engineering Practices That Survive a Real Team

On this page
Presentation UI, controllers Service business rules Data access repositories Database Mongo / SQL Dependencies point one way. Swap the database or the UI without touching business rules.

Software Engineering at KFUPM gave me plenty of theory. Our senior project, InfoMagnet, gave me the reality check. It was a location-aware media platform built by six of us: a Sails.js dashboard, native iOS and Android apps, and a MongoDB/Firebase backend. With six people pushing to the same repository every day, you find out very quickly which practices earn their place and which ones only look good in a slide.

What follows is the short list that survived, in the order a feature actually travels: from the first requirement to the moment we could honestly call it “done”.

Requirements: if you can’t test it, it isn’t one

Requirements come first, because everything else depends on them. The most common problem is a requirement that sounds good but cannot be tested:

❌ Vague ✅ Testable
“The app should be fast” “Feed loads in less than 2 seconds on 4G for 50 items”
“Users can find nearby content” “Content within 500 m of the user’s GPS position appears, sorted by distance”
“The system is secure” “Passwords stored with bcrypt; 5 failed logins lock the account for 15 minutes”

We wrote every feature as a user story with acceptance criteria:

As a  content creator
I want to pin a video to my current location
So that people walking past can discover it

Given I'm logged in and location is enabled
When I upload a video under 100 MB
Then it appears on the map at my position within 10 seconds

Notice that the “Given / When / Then” lines are already test cases. You don’t have to invent tests later — they are written together with the requirement.

Design: draw the boxes before writing the code

The diagram at the top of this article is the one rule of architecture I always follow: layers, and dependencies only point one way. The presentation layer calls the service layer, the service layer calls the data layer, and never the other way around.

Why does it matter? Because business logic that doesn’t import UI or database code can be tested without either of them. It is also what allowed our team to build the web dashboard and both mobile apps against one shared API, without copying business rules into three places.

Git workflow that doesn’t fight you

Here is the simplest workflow I know that still keeps main safe. One branch per story, small commits, and a pull request at the end:

git switch -c feature/geo-feed main          # one branch per story
# ...small commits...
git commit -m "feat(feed): sort content by distance from user"
git fetch origin && git rebase origin/main   # stay current, resolve conflicts early
git push -u origin feature/geo-feed          # then open a pull request

These are the rules we agreed on:

Rule Why
main is always deployable Anyone can ship at any time
Short-lived branches (2–3 days max) Merge conflicts grow with the age of the branch
Conventional commits (feat:, fix:, docs:) Readable history and automatic changelogs
Never commit secrets Add .env to .gitignore on day one — Git history is forever

Tip: If you are using Azure DevOps, you can enforce some of these rules with branch policies, like a minimum number of reviewers before a pull request can be completed. I showed how to set this up in my Azure DevOps article.

The testing pyramid

Once code is merged often, tests are the only thing protecting main. The question is which tests to write. This is the shape that works:

E2E Integration Unit ~10% slow, brittle, high confidence ~20% API + DB together ~70% ms each

Most tests should be fast unit tests at the bottom, some integration tests in the middle (API and database together), and only a few slow end-to-end tests at the top. If you invert it — mostly UI tests and few unit tests — the test suite becomes slow and flaky, people stop running it, and a test that nobody runs protects nothing.

A good unit test checks one behaviour, needs no network and no database, and has a name that explains itself:

def test_nearby_content_excludes_items_beyond_radius():
    user = (26.30, 50.15)
    items = [Item("near", 26.301, 50.151), Item("far", 26.40, 50.30)]
    assert [i.name for i in nearby(items, user, radius_m=500)] == ["near"]

Code review: rules for both sides

Code review is where a team either learns together or argues together. These rules helped us stay on the first side.

For the author:

  1. Keep pull requests under ~400 lines. Review quality drops a lot above that.
  2. Write a description: what changed, why, and how you tested it.
  3. Review your own diff first — you will catch around a third of the comments yourself.

For the reviewer:

  1. Focus on correctness and design first. Style is the job of the linter, not yours.
  2. Ask questions instead of giving orders: “What happens if location is null here?”
  3. Approve when the change makes main better, not when it is perfect.

Definition of done

The last step is agreeing on what “done” means. A story is not done when the code compiles. For us it was done when:

  • Acceptance criteria pass
  • Unit tests are added and the full suite is green in CI
  • At least one other person reviewed and approved it
  • No new linter or security scanner warnings
  • The README or docs are updated if the behaviour changed
  • It is deployed to staging and smoke-tested

Agree on this list in the first week. Most of the “it’s done, but…” discussions in a team are really disagreements about this list.

The habits that stuck

None of these practices is complicated: requirements you can test, dependencies that point one way, short-lived branches, a test suite shaped like a pyramid, small pull requests and a written definition of done. The power comes from doing all of them, every time, as a team. If you want to go further, the Conventional Commits specification and Martin Fowler’s practical test pyramid are where I would continue.