mohd-faraz

_blogs

// blogs / 20260609.md

Dev Log: June 09 Wrap-up

2026-06-09
#java#refactoring#crm#debugging

Overview

Today was one of those days where you start by fixing a small bug and end up rewiring how an entire module processes data. Most of my time went into untangling some messy filter logic in the CRM service and making sure our frontend doesn't break when we add new ways to search for leads.

What I Worked On

Refining the Query Logic

I spent a good chunk of the morning inside our utility classes, specifically working on how we extract filters from incoming requests. We had a few edge cases where negating a value (using the ! prefix) wasn't behaving correctly, especially with empty strings.

I also added some much-needed support for date range parsing. Previously, the system was a bit rigid, but now it can detect a range pattern—like timestamp1_timestamp2—and automatically convert it into a proper query expression. It's a small change that makes the API significantly more flexible for the frontend guys.

Here’s a sanitized look at how I handled the negation logic for empty fields:

// If the value is negated and empty, we actually want to find 
// records where the field exists but isn't just an empty string.
if (negate && newVal.equals("")) {
    return Expression.and(
        new Expression(field, OPERATOR.EXISTS, true),
        new Expression(field, OPERATOR.NOT_EQUAL, "")
    );
}

Refactoring and "The Semicolon Incident"

I realized that my lead management and customer decorators were repeating the same normalization logic over and over. DRY (Don't Repeat Yourself) is a principle for a reason, so I moved that logic into a centralized helper. It makes the decorators much thinner and easier to read.

Of course, it wouldn't be a real dev day without a silly mistake. I managed to break the build by forgetting a single semicolon while registering a new decorator in the application runner. A quick fix, but a reminder that even after years of doing this, the compiler will still humble you over a single character.

Making the UI More Dynamic

On the frontend side, I noticed our data grid was hardcoding the keys it used for filtering. That’s a maintenance nightmare waiting to happen. I updated the component to look at the configuration provided by the backend first. If the config defines specific fields, it uses those; otherwise, it falls back to the defaults. It makes the whole grid way more resilient to schema changes.

Wrapping Up

Today felt productive, even if a lot of it was 'under the hood' work. The query engine is much more robust now, and the refactoring should save us some headaches down the line. Tomorrow, I’ll probably dive back into the e-commerce schema I started yesterday.

Catch you later.