9
Code Smells Prasad Narasimhan – Technical Architect

Code how it matures in syste

Embed Size (px)

DESCRIPTION

How the code matures when the system expands and transforms. This creates redundancy and code duplication.

Citation preview

Page 1: Code how it matures in syste

Code SmellsPrasad Narasimhan – Technical Architect

Page 2: Code how it matures in syste

System starts

All the business & technical stakeholders brainstorm a lot.

They want to start somewhere rather than getting into more of design paralysis.

Core level classes gets created, Utility classes, Exception classes…

Page 3: Code how it matures in syste

System grows

System grows based on the usage , features gets added either by extending or changing current code.

Structure is maintained, silos and monolithic code gets created.

With minimal documentation and fear of touching core & utility its duplicated.

Page 4: Code how it matures in syste

System expands

Now more features are needed in short time.

No time to take stock of what is already available how the design could be extended.

If it works don’t touch it syndrome.Some piece of code which lies dead , Silos in

method and class level.Duplicates at class level and variables level

Page 5: Code how it matures in syste

System explodes

Now the business wants maximum use of system , invites users through campaigns and various launch pads.

Application is perfectly scalable to optimum level no issues. The Variables – scope, life time.

Collection handling – creation of collection based on items, customer details which was small now its rapidly increasing.

Loop which process the collection becomes bottleneck.

Page 6: Code how it matures in syste

Explosion handled

Giga bytes of processor, clustered system.Failover mechanism, Caching large

amount of data with latest caching mechanism.

Persist the data when failure happens.Predictive recovery approach.

Page 7: Code how it matures in syste

Code Smells patterns

Particular main functionality gets enhanced without proper refactoring of the base classes and dependent classes

Class & methods violating SRP – Single Responsibility principle.

Open & Closed principle – Base class should be open for extension and closed for changes.

Page 8: Code how it matures in syste

Some thoughts

Refactoring when needed.Test Driven development.Inline Documentation for proper piece.SQALE based cost remediation and code

correction at periodic intervals.Code and design audit at periodic

intervals

Page 9: Code how it matures in syste

Thanks