UrbanPro
true

Learn Advanced Java coaching from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

Code Smell and Shotgun Surgery

Shamik Mitra
02/10/2016 0 0

The Code Smells are similar in concept to Development-level Anti-patterns. Sometimes in our code, we introduce code smell unintentionally those makes our design fragile.

 

Definition of Code smell

Code smell, also known as a bad smell, in computer programming code, refers to any symptom in the source code of a program that possibly indicates a deeper problem.

 

Martin fowler says:

 "a code smell is a surface indication that usually corresponds to a deeper problem in the system"

Code smell creates lot of problems while introducing new feature or maintains the codebase,

Often developer has to write repeatable code, breaking encapsulation, breaking abstraction etc.

If code smells are not corrected.

So always refactor code smell while developing.

 

In this article, we discuss one of the popular code smell “SHOTGUN SURGERY”

Shotgun surgery says, to introduce a small new change, a developer has to change many classes and methods, most of the time has to write duplicate codes which violate “Don’tRepeatYourself” principle.

Cause of Shotgun surgery smell:

1.    Due to poor separation of concern.

2.    Fail to understand the responsibility. Often due to misunderstanding (Single responsibility principle)

3.    Not identifying the common behavior or behavior with a slight change.

4.    Fail to introduce proper design pattern.

 

Consequences of Shotgun Surgery:

1.    Lots of duplicates code

2.    Taking more time to develop a small feature.

3.    Unmaintainable code base.

 

 

 

0 Dislike
Follow 0

Please Enter a comment

Submit

Other Lessons for You

Tips for Entry Level Java Job Seeker
3 steps you should take to make a break as a Java developer: Step 1: Invest in improving your job hunting skills encompassing interviewing, networking, and resume writing skills. Step 2: Keep applying...
A

Akshay Shende

1 0
0


What are the JSP implicit objects ?
JSP provides Nine implicit objects by default. They are as follows with corresponding Object Type: i) out --> JspWriter ii) request -->HttpServletRequest iii) response --> HttpServletResponse iv)...

Advance Java
1) Servlet • Basics of Servlet • Servlet Request • Servlet Collaboration • Servlet Config • Servlet Context • Attribute • Session Tracking • Event and Listener •...
A

X

Looking for Advanced Java coaching Classes?

The best tutors for Advanced Java coaching Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn Advanced Java coaching with the Best Tutors

The best Tutors for Advanced Java coaching Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more