0% found this document useful (0 votes)
7 views

Code Smells

Code Smells for coursera

Uploaded by

lagalas10102000
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Code Smells

Code Smells for coursera

Uploaded by

lagalas10102000
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Code Smells in SharingApp

1. Comment Clutter:
Location: saveContact() method in EditContactActivity class. Problem: Overly
detailed, multi-line comments even for clear code.
Explanation: Excessive comments don't effectively communicate design intent.
They become maintenance burdens, requiring updates with code changes. Outdated
comments can mislead future developers.
Solution: Use self-explanatory variable and method names. Reserve comments for
explaining why a specific approach is chosen, not just what is done.
2. Code Duplication:
Location: loadItems()/loadContacts() and saveItems()/saveContacts()
methods in ItemList and ContactList classes, respectively. Problem: Repetitive
code for reading and writing data to files with the only difference being the file name.
Impact: Changes to storage logic require modifying code throughout the project,
increasing effort and risk of errors.
Solution: Create a generic storage class accepting an object type and filename.
This class would handle file reading and writing functionalities, eliminating
duplication.
Overall:

These suggestions aim to improve code clarity, reduce maintenance effort, and
enhance code reusability.

Baimakhambetov Nurzhan IT2-2111

You might also like