Blog: Working with Large Codebases > Agile & Development Methodologies, Design Patterns & Architecture, Developer Tools, UML & Diagramming

Design Patterns & Architecture

Code Visibility: one factor of code quality that you shouldn’t forget

Posted in Agile & Development Methodologies, Design Patterns & Architecture, Developer Tools, UML & Diagramming on July 13th, 2011 by xin Zhou2 Comments

Every developer cares about code quality. But how do you maintain code quality throughout the software development cycle? Readability, modularity, and efficiency all are important factors of writing good code but there isn’t much agreement on the best way to maintain a high level of code quality.

One factor which is often missed in discussions is code visibility, or making sure your code has a clear structure so that others can easily understand it. (Take a look at the diagram above for some of the difficulties encountered when there is a lack of code visibility).
read more »

 

A simple intro to creating a MVC framework: Using GEF

Posted in Design Patterns & Architecture, Developer Tools, Eclipse, Java on March 10th, 2011 by Seth RosenBe the first to comment

When creating a rich graphical editor the Model View Controller (MVC) design pattern makes life a lot easier. But it is often difficult to decide which libraries/frameworks to use. On the Eclipse platform GEF (Graphical Editing Framework) is a great solution but it can be challenging to figure out how to integrate with the parts you need. Since GEF is built on top of the Draw2d/SWT graphical libraries and is able to provide a powerful and consistent UI. However there are many considerations and pitfalls to take into account when getting started with GEF.

Some of my first large scale Java coding involved using and modifying GEF code. Luckily the GEF team provides many helpful examples showcasing the different features GEF offers. I will attempt to provide a concise introduction to the points that I found best helped me understand GEF.
read more »

 

REST Architecture – Simplified

Posted in Agile & Development Methodologies, Design Patterns & Architecture, Java on November 14th, 2010 by Abhishek Rakshit7 Comments

Recently, while working on some collaboration functionality for our suite I got a chance to work on a REST (Representational State Transfer) based web server. There are many great resources about REST out there but most of them are quite technical and it took a me a while to get it. So, in this post I am trying to explain in some simple terms what I have understood about REST. read more »

 

Wasting Time With Test Driven Development?

Posted in Agile & Development Methodologies, Design Patterns & Architecture on August 5th, 2010 by Vineet Sinha13 Comments

Many teams are moving to test driven development and very often this a good thing. In a drive towards increased code stability and maintainability, good test cases can be very helpful. But this is not always the case; while working with development teams, most teams seem to have one or more critical problems. It seems that it is easy to do Test Driven Development (TDD) badly – below are five situations that I have seen multiple times.
read more »

 

Commands and the MVC architecture

Posted in Design Patterns & Architecture on June 12th, 2010 by Abhishek RakshitBe the first to comment

Most of us agree to the benefits of using commands to provide the undo-redo functionality in an MVC based application. Working on one such highly interactive application, the question which often arises is where in the code base do the commands belong: in the model, in the controller or as a separate entity. This issue has been discussed before and people seem to have quite disparate views implying a vague understanding of this problem. In my view commands should be considered separate from both the model as well as the controller. This becomes really important while organizing your code to have clear abstraction boundaries and conform with the principles of cohesion and couplingread more »

 

Cohesion and Coupling in Large Projects

Posted in Design Patterns & Architecture on June 1st, 2010 by Abhishek Rakshit5 Comments

Cohesion and Coupling are commonly used metrics to gauge the design quality of a software project with regards to maintainability, reuse and understandability. These issues are commonly faced by developers working with large codebases. The mantra for these issues is to have a highly cohesive and loosely coupled codebase.

Simply stating, Cohesion means placing related code in one particular unit and Coupling is the degree of dependency between two or more units. If the code is highly coupled i.e. different units depend a lot on each other and modifying one feature can cause unwanted side effects. To avoid these the developer has to understand each of the related classes to update the behavior safely. Loosely coupled code is easier to reuse and on modification does not have undesired ripple effects in the code base. Adding to the benefits highly cohesive code promotes easy code understandability as everything is placed closely together. These aspects are not restricted to classes but apply to everything from methods in a class to packages in a project.

read more »

 

Dependency Injection, Frameworks, and You

Posted in Design Patterns & Architecture on May 6th, 2010 by Abhishek Rakshit2 Comments

3D Character and Question Mark
I have previously tried explaining Dependency Injection and how it can be beneficial to any project. This leads us to an important question about whether to use a framework or to do injection manually. Using a framework all the time may not provide you with additional control, rather at times it may further complicate the code. On the other hand implementing dependency injection manually can sometimes become more time consuming and painful. So how do we actually choose?
read more »

 

No, You are not Dumb! Programmers do spend a lot of time Understanding Code…

Posted in Design Patterns & Architecture, Documentation & Communication on May 5th, 2010 by Vineet Sinha37 Comments

While working on a codebase, developers spend a lot of time understanding code. We might be unwilling to admit it for fear of sounding dumb but the huge amount of time spent on making sense of code is staggering. In fact a conference is held every year just to tackle this problem. The good news is that with the emergence of online communities more and more people are discussing the challenges of working with large codebases openly.

read more »

 

Types of Dependency Injection

Posted in Design Patterns & Architecture on May 4th, 2010 by Abhishek Rakshit1 Comment
In continuation with my effort of trying to simplify Dependency Injection, I want to elaborate on the different types of injection. Dependency Injection is decoupling an application and service so that the application does not need to know anything about the service implementation. Dependency injection can be broadly classified in three categories: Constructor, Setter and Interface.

Object dependencies when passed as parameters to a constructor is termed as Constructor Injection.

public class Account {
  public User user;
  public Account (User user) {
   this.user = user;
  }
}

Pico Container is a framework which prefers constructor injection. Constructor injection ensures that the application object is created with all its service dependencies satisfied. read more »

 

Simplifying Dependency Injection

Posted in Design Patterns & Architecture on April 14th, 2010 by Abhishek Rakshit4 Comments


A lot has been written about Dependency Injection (DI) however, it still remains a complicated topic. The main articles on this topic are quite thorough and provide really good information but in the process, the basic principle behind DI becomes hard to comprehend. DI is in fact fairly simple – its main goal is removal of a class dependency on some code. This class dependency is then ‘injected’ into the code where it is needed. Using dependency injection helps in code maintenance, re-usability, testability, and improves code readability.

An Explanatory Example
In one of my projects, we needed to use DI to inject different implementations into a core service. Our project needed to be deployed to multiple types of servers while we wanted to share large portions of the core code and at the same time have different functionality for users.

read more »

 

[ bbPress synchronization by bobrik ]