Tag «Design»

Code That Embraces Changes

Developers write code. They write code for specific functionalities, with requirements from clients (customers, bosses, leaders,…). When requirements come, they know what to do; know what code to write. In the world of business applications, the implementation is not a big deal. The story might be different if we write code for embedded systems using …

Implement Audit Log for Legacy Code

Given a legacy project, the code has been developed for 6 years, the requirement is to log all the changes in the system. For example, if a user changes his street name, that must be logged so that the administrator can know the old and new values. The project is a typical codebase where there is …

Code Duplication is a Myth

I know that code duplication is not good. We try to avoid code duplication. In a perfect world, you do not have code duplication. What annoys me is that we seem to forget to ask some critical questions to ourselves. Is it really that bad in all circumstances? What might be worst if we try …

Infrastructure and Application Code – Keep Loose Dependencies

When talking about dependency, many will think of Dependency Injection, think of Interface, think of Container, … Things go like if you have a Controller, that controller consumes a Repository, then you should inject them with dependency injection, most of the time via the constructor. And we just stop at that level, at that thinking. Not …

Refactor a 6K Line of Code Domain Class

I have been working on a legacy project. It is a complex and big system. Throughout the codebase, there is a big domain object class. How big is it, man? Not much dude. It is just 6k (6.000) line of C# code. One day, I found out a way to improve it. So the story …

Design and implement a template engine–part 2

In the Design and implement a template engine – part 1 I mentioned about a better solution: Reuse Razor Engine. In the post, I go in detail of how to implement it. But, first, we need to know some concepts: Concepts Template Engine: Use to render a template into string Template Model Builder: Build the …

Design and implement a template engine – part 1

Recently, I got a task which is typical in many systems: Template with merge fields. The common usage is for email. Given that an employee is created, the system will notify the manager by email with template: Dear Manager, New employee {Name} has been created on {DateTime.Now}. From the above statement, we have template with …

Consideration before building a program

Having looked for Rhino Queues articles and examples, i stopped by this article:Building Distributed Apps with NHibernate and Rhino Service Bus. I read it before but i could not remember anything. I decided to read it again even though it is not much related to the topic i was looking for: Rhino Queues. It is …

Do we need code review?

What is the code review? Simple as its name: Do the review after coding done of a project, feature or just a task. At my company, Catglobe Vietnam, we usually do that, and it is a MUST. PM or TL will do that job. I was surprised once i asked my friends: How was that …

%d bloggers like this: