☕️JAVA Language Community
2.91K subscribers
144 photos
7 videos
31 files
42 links
☕️ Software, IT, Java, news
💻 IT highlights
🎯 AI update
🖥⌨️🖱
Download Telegram
#Refactoring

Lesson 2:

Bloaters

Bloaters are code, methods and classes that have increased to such gargantuan proportions that they are hard to work with. Usually these smells do not crop up right away, rather they accumulate over time as the program evolves (and especially when nobody makes an effort to eradicate them).

1. Long Method
2. Large Class
3. Primitive Obsession
4. Long Parameter List
5. Data Clumps


@javaCode☕️
#Refactoring

Lesson 3:

Long Method

📌Signs and Symptoms📌

A method contains too many lines of code. Generally, any method longer than ten lines should make you start asking questions.


📌Reasons for the Problem📌

Like the Hotel California, something is always being added to a method but nothing is ever taken out. Since it is easier to write code than to read it, this "smell" remains unnoticed until the method turns into an ugly, oversized beast.

Mentally, it is often harder to create a new method than to add to an existing one: "But it's just two lines, there's no use in creating a whole method just for that..." Which means that another line is added and then yet another, giving birth to a tangle of spaghetti code.

@javaCode☕️