Youans Ezzat

Code quality, is to write code with the ultimate goal in mind; which is customer satisfaction. Thus, anything you write with high quality will make that goal easy to reach.


So, what are the rules of writing high-quality code?

  1. Agile perspective


  1. Other Rules

Although Agile defines its own code quality rules, some other rules are defined and known by community. It may meet the Agile definition or may not and here are these rules:

1.   Re-usability

The power of using code more than once, e.g., Utility class is a very good example of code reusability.

class Uploader{

public static void uploadImage(String src,String dist)

{……// common image uploading code}



I won’t write code every time to upload image.


To increase code reusability you have to use good frameworks, design patterns or even libraries.

2.   Testability
This section is covered by Agile and gives it a very high rank of importance, which consequently helps in:
- Making sure that the code is acting correctly.
- Making the code easier to update
Examples of unit testing for platforms we use:
Java : JUnit :
PHP  : PHPUnit :
C#   :  Microsoft unit test framework :

3.   Reliability
Reliability is to make a failure-free software. Yes, you got it, try&catch!
So to write high-quality code, you strongly need to know about handling failures.
try{// connect to internet}
catch(NoElectricityException | HardwareException | ISPException | DonotHaveInternet x){}

4.   Performance
Performance is the backbone of the code quality. Imagine the following
for(int i=0; i<5;i++){


Seems good? Let’s make it wonderful:

for(int i=0; i<5 && i!=3 ;i++){



See the difference? Fewer lines, same output with enhanced performance by omitting "if & else".

Since most of us are web developers, you should concentrate on the performance.

Heavy code on the server side is like feeding a duck too much that makes it hard for it to move.

5.   Readability

As the title tells, simply Readability is: How readable your code is to others? Increasing readability is done in two ways:

First, the hard way: you finished your wonderful code and BAM you have to document the code.

What ?!

Yes document the code. Extra heavy work, but it increases your own readability and helping people understanding your brilliant code.

Feelin smarter that’s the spirit ;)



 * The HelloWorldApp class implements an application that

 * simply displays "Hello World!" to the standard output.


class HelloWorldApp {

    public static void main(String[] args) {

        System.out.println("Hello World!"); //Display the string.



Second, naming convention: How can I understand the variable, object, class or method benefit without good indicators?


String photoPath; // good

String profilePhotoPath;// Perfect


Code Quality: is so important, but at the time it depends mainly on the one writing it and somewhat argumentative - you can’t find some book telling you not to use 10 variables and use array instead. However, as a developer you know the language and this is your crystal ball that you need to handle skillfully. In short, focusing on code quality daily and continuously will help you become the PROFESSIONAL developer you aspire to be.


Single Responsibility Principle states that a class should have one and only one reason to change. That means, if we have two reasons for a class to change, we should split this class into two different classes instead of one, and each of which will be concerned only with one responsibility.

To explain this more, let’s have a look at the following class diagram:

Description: SRP-1.jpg

From the first look at the above class diagram, you will know that it is a real-world bank account representation, but with two extra responsibilities (other than modeling); which are saving and printing the bank account. Now the BankAccount class will have three reasons to change:

  • Updates in the BankAccount class structure itself (properties, and methods).
  • Updates in the way the BankAccount is saved (to database, to files …etc).
  • Updates in the way the BankAccount is printed (to the screen, to a printer …etc).

Now, in order to maintain the Single Responsibility Principle in the above example; we are going to divide the BankAccount class into three different classes, and each of which will have only one responsibility to take care of, and accordingly one reason to change.

See the class diagram below after applying the Single Responsibility Principle to it.

Description: SRP-2.jpg


Description: C:\Users\John Sameh\Documents\jrebel.jpg

What jrebel?

JRebel is the java Web development tool that helps us to save our time consumed in application deployment by reloading changes made in your workspace into a running JVM, without restarts or redeploys, maintaining the state of the application while you’re coding. When developers make a change to any class or resource in their IDE, the change is immediately reflected in the deployed application, skipping the build and redeploy phases and preventing an average of 5.25 work weeks per year in redeploys.

JRebel is available as IDE Plugin or as a bundled with jar file.

Why jrebel?

Reload Java classes

See all changes to Java code instantly in the browser. Save and refresh! The same is true for your other project files. Description: C:\Users\John Sameh\Documents\jr-key-features.png

Compile from the IDE

Compiling Java code in modern IDEs is blazingly quick. It’s the other phases of the build that make it last forever.

With JRebel all classes and resources are loaded directly from the workspace. No more time spent on building WAR/EAR archives, resolving dependencies, etc. 

Description: C:\Users\John Sameh\Documents\jr-skip-the-build.png

Reload webapp changes remotely

Used to working with a remote development server? Then you know how painful it can be. With JRebel, run your application locally, remotely or in the cloud and see code and configuration changes instantly.

Supported IDE

Description: C:\Users\John Sameh\Documents\Eclipse-Color.pngDescription: C:\Users\John Sameh\Documents\RAD-Color.pngDescription: C:\Users\John Sameh\Documents\IDEA-Color.pngDescription: C:\Users\John Sameh\Documents\JDeveloper-Color.pngDescription: C:\Users\John Sameh\Documents\MyEclipse-Color.pngDescription: C:\Users\John Sameh\Documents\NetBeans-Color.png