Jai’s Weblog – Tech, Security & Fun…

Tech, Security & Fun…

  • Jaibeer Malik

    Jaibeer Malik
  • View Jaibeer Malik's profile on LinkedIn
  • Subscribe

  • Feedburner

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 31 other followers

  • Archives

  • Categories

  • Stats

    • 406,404
  • Live Traffic

Posts Tagged ‘Code Quality’

Code Quality: Walk the Talk or Just the selling point?

Posted by Jai on February 3, 2010


Some of the mind boggling thoughts that must have come into your mind also like the times when as a developer you compromised on code quality because of tight dead lines etc. or as a team lead or manager you compromised on quality to speed up the delivery or because of risk management to reach the milestone. May be, as a team you started well but what it costs to keep up the pace for the code quality. There are many varied factors around it and we will have a brief look at it and will see how it works in the end.

To start with, we all know about the code quality significance and the long term benefits or implications (lets assume :)).

Code Quality as Selling point

If we put aside the players in the market to do the job in cheap way and deliver the crap, on broader way we have majorly two kind of players: Read the rest of this entry »

Advertisements

Posted in Quality | Tagged: , , | 2 Comments »

ActionScript/Flex/AIR Code Quality Measurement Tools

Posted by Jai on December 7, 2009


From a java developer perspective, you would love to have the similar code quality measurement tools for ActionScript/Flex/Air also but there is hardly any single comparable tool available for this. After a long search and analysis, this is what I have found and here we will have a look at what all these tools and different utilities offer.

In this post we will analyze what different code quality metrics on a general basis we would require for ActionScript/Flex/AIR and what are the different available tools to get such metrics.

Code Quality Metrics

We would like to have the metrics to display different information like:

  • Coding Styles: The metrics which tell us the different coding style violations inside the code.
  • Coding Standards: The metrics which tell us the different coding standards violations inside the code.
  • Project level: Total number of packages, interface, classes etc. , the dependencies between different packages and classes and their linking.
  • Class level: Total number of lines of code, number of functions, cyclomatic complexity, dependencies on other classes etc.
  • Function level: Total number of lines of code, cyclomatic complexity etc. and coverage tools stating if all the lines of code are fully tested on not.

(This is just on broader level, not covering all the metrics and information which similarly we have for java).

List of Available Tools

The available tools for AcrionScript/Flex/Air code quality measurement are: Read the rest of this entry »

Posted in Flex, Quality | Tagged: , , , , , , , | 7 Comments »

Presentation: Code Quality – Learn, Measure and Organize Awareness

Posted by Jai on September 25, 2009


This post share the presentation on Code Quality – Learn, Measure and Organize Awareness which is based on the series of posts published on this site.

posts: Code Quality – Learn, Measure and Organize Awareness

presentation: Code Quality – Learn, Measure and Organize Awareness

Feel free to share the feedback!!!

Posted in Presentation, Quality | Tagged: , | 1 Comment »

Code Quality – Learn, Measure and Organize Awareness

Posted by Jai on April 12, 2009


How many times it has happened to you that when you join a new project and start looking at the code first time or when some new member joins the project then people usually say that what the crap is this code and we need to improve this and that. As time passes you seldom get the chance to correct it and the same thing passes over and over.

I would like to start the discussion with the simple list of questions which sooner or later comes in the mind of every developer like:

  • What to learn to write good code?
  • How can I figure out the code in front of me is of good or bad quality?
  • What makes the piece of code fall under WTFs?
  • What are the good or bad code quality factors or criteria?
  • Is there any documents, books etc. which can help me here?
  • Can any tool help me to check my code for quality problems?
  • How to approach the code to solve the quality problem?
  • How to transform the bad code into good code?
  • How can I share the WTFs and solution with my team?

And many more similar questions which bother many developers a lot of times.

As very well put in words, the topics like:

Complaining about Other People’s Code

So, when we first encounter a new software system we are, in Dunning and Kruger’s terminology, incompetent compared to the programmers that wrote it.

How WTFs improve code quality awareness

Of course, a developer will never deliberately produce bad code. So in order to improve quality, the developers have to gain quality awareness.

Things You Should Never Do

The reason that they think the old code is a mess is because of a cardinal, fundamental law of programming:

It’s harder to read code than to write it.

On a general idea I would try to put some light on how you can approach to get better idea of the different quality standards and principles and to become more aware of the things so that at least you become aware of these WTFs and can find it out and can apply the right solution.There are many code quality measurement tools and how you can integrate those as part of the development process itself and how the team itself handles the quality awareness among the team members.

I am planning to cover this in details in separate blogs, each giving more insight of:

  • how to learn more about the code quality aspects
  • how you can measure the quality of code as part of regular development process
  • how to share and organize code quality awareness among the team.

How to learn about Code Quality Aspects:

Many a times, developers write bad code because they are not aware of it. Having better understanding of the followings is a good start:

  1. Focus on Fundamentals – OOPs and Design Patterns
  2. How to write clean code – Clean Code
  3. Figure out WTFs and improve code quality – Refactoring

Read Code Quality – Learn: OOPs, Desing Patterns, Clean Code and Refactoring fore more details.

What are different Code Quality Measurement Tools:

There are many open source tools available for static code analysis like PMD, Findbugs, CheckStyle, Simian, Cobertura etc. which you can integrate with in your project, may be part of your development process or application build process, to check the code quality.

Read Code Quality – Measurement (Static Code Analysis) Tools for more details.

How to organize quality awareness with in the team:

Different teams plan it different way to put a check on the quality standards and organize it in different way to share the knowledge and making people aware of quality standards and learning. We will be looking more into some of the ways like pair programming, share knowledge etc. that you can plan in Agile teams to make it more effective.

Read Code Quality – Organizing awareness with in the team for more details.

Like the technology thing in the software world is evolving and changing thing, so as these standards and principles. There is no single pill which can help you to get ready with it and can make you perfect or great programmer but definitely keeping these few things would definitely help you to be a good programmer.

Posted in Agile, Java, Quality | Tagged: , , | 4 Comments »

Code Quality – Learn: OOPs, Desing Patterns, Clean Code and Refactoring

Posted by Jai on April 12, 2009


This article covers the second part of the series of articles Code Quality – Learn, Measure and Organize Awareness which is about the Code Quality – Learning code quality aspects, Using different code quality Measurement Tools and How to organize the awareness with in the team . Here we will discuss about the learning the fundamentals like OOPs concepts and Design Patterns, writing the clean code and how to approach to remove the bad smells from the code.

1. Focus on Fundamentals – OOPs and Design Patterns

2. How to write clean code – Clean Code

3. Figure out WTFs and improve code quality – Refactoring

1. Focus on Fundamentals – OOPs and Design Patterns

Looking at the history of Object Oriented Programming, it has come a long way and now a days, hopefully no one will neglect the importance and vast usage of these concepts in every system.

Importance:

Well in a way, Object-Oriented Design is a science and an art at the same time. Becoming a master of object-oriented technology would require experience and time. To give it a start have a look at the classic design patterns that have laid the foundation of object-oriented design, Design Patterns: Elements of Reusable Object-Oriented Software.

Material:

Lot of times many of the developer wonder that why to use these patterns, when to use and how to use them. Look for something which helps you to understand the patterns with the help of aids, models, examples, and discussions. Something like Head First Design Patterns.

Games:

Understanding the patterns in a way of conversation, discussion and solution for a problem would help you more to remember the idea behind it. There are people who plan it different way to help you with it in different ways, may be reading out the content like a lecture or to make it more interesting and learning friendly, you can also try it in the form of games. Like the Design Patterns Playing Cards using which you can try the learning part in the form of games, like Patterns Poker, Name That Pattern etc. which will help you to understand, learn and remember it in better way.

Use:

The responsibility now lies on you that how do you use these in the software development. Every software system has it own problem and solution they are trying to solve.

2. How to write clean code – Clean Code

In general terms we can say that the quality lies in the eyes of the beholder. It depends a lot on the individual perspective that how do you perceive the code quality. But think of it if someone else is reading or working on your code. There are some standards and principles which states whether the piece of code is of good or bad quality in context of the problem. That is what we will discuss here that how you can improve the awareness about these.

What is the main reason that developers write bad code? It varies from case to case like tight deadlines, motivation or may be lack of awareness. Many a times developers are not aware that what is the best way to put the solution in terms of lines of code.

The topic has been talked about many a times and by different people like Writing Clean Code or 7 tips on writing clean code

The one book which can give you more insight and explaining the real problems and context based solutions which I personally like is the Clean Code. For review please feel free to have a look at this Book Review and also very interesting comparison Clean Code vs. Implementation Pattern. And certainly few more enthusiastic who even say  Get it. Read it. Learn it. Then live it!.

The well illustrated examples, solutions in the context of the problems and the Heuristic Smells chapter can give you enough insight and can definitely help you to be a good if not great programmer.

3. Figure out WTFs and improve code quality – Refactoring

WTFs (Bad Smells)

Funny and irritating at the same time, what does it mean WTFs in the code.

The WTFs are the “Bad Smells” in the code which helps us recognize when we have a problem.

measurement-of-code-quality

Few questions that may come into your mind:

  • Why to put WTF?
  • How to find out WTFs?
  • What to do with WTFs?

As I stated it earlier also that no developer introducing these bad smells intentionally. Either you are not aware about the right approach or may be ignorance or time pressure.

To figure out these bad smells, either to take care when you are writing the code first time or when you revisit the code second time, may be during fixing bugs or adding new functionality.

Well remove the WTFs. Figure out what is the better  solution, if not the best. Refactoring is the solution for it.

Refactoring

A change made to the internal structure of software to make it easier to understand and cheaper to modify without changing its observable behavior.

Refactoring improves the design of your softwares, make it easy to read and modify and help you to find bugs.

There are plenty of books and documents available to help you to understand refactoring and to understand why, when and how to do it.

The one book I liked reading very much and would like to recommend is Refactoring: Improving the Design of Existing Code.

The starting chapter itself explains the common problems you must have seen in the code many a times and then refactoring the code step by step to reach a solution where in the end you can say it is good code. The common Bad Smells chapter will give you enough idea to figure out the WTFs in your existing code or the next time you are going to code. The different refactoring techniques will give you hold on the topics like the design patterns.

Refactoring Catalog

As in the case of patterns, refactorings  also have names  in order to crystallize  the idea and help us remember it.

For the latest and updated catalog look at the online Refactoring Catalog.

Refactoring Tools

The commonly used IDE like Eclipse and IntelliJ comes with inbuilt refactoring capabilities. These days most of the development tools come with some sort of refactoring support. For more, have a look at Refactoring Java Tools.

There is no single book which can make you master of it but certainly can help you to have better understanding of the concepts and ideas behind it so that next time you put few lines of code you know the pros and cons.

Posted in Agile, Java, Quality | Tagged: , , , , | 1 Comment »

 
%d bloggers like this: