You are on page 1of 3

TOPIC 2 (Refactoring in IntelliJ IDEA)

What is Refactoring?
Refactoring is a way or procedure of improving and reorganizing the design and the
health of the existing code base that doesnt change the behavior or how the program outputs
and runs externally, rather modifying the structure of the code internally. It is the technique
which will help you clarify and understand your code much easier to use and more readable
than before. It is also defined as a series of better and cleaner changes in the existing code but
still making the behavior of the program works and functions in the same manner and order. It
will also not let you re code or rewrite the program that youve made because that will impact
and affect the production of developers and its time.

When to Refactor?
Refactoring prioritize the qualities of a
code. It is necessary to refactor if your code or
the code that youre working on is longer than
how it should be and the performance you desire
to be. Also, it is a need to apply refactoring if you
dont understand the code or the code is a mess
and looks very untidy. One thing to consider is to
apply complete coverage before doing
refactoring on your code. When implementing
refactoring, you need to understand and consider
when reviewing your code is that if therere some
bugs, pitfalls and code smells.

How is Refactoring in IntelliJ IDEA


IntelliJ IDEA has a lot of features of
automatic refactoring that is built-in and enables
developer to reorganize or restructure the codes
that aims to reduce, change, modify, remove,
simplify and improve the design and readability
of the existing code.

There are at least 3 fundamental kinds of


refactoring in IntelliJ IDEA and those are
Renaming, Deleting and Extracting.

Press Refactor above (between Analyze


and Build)
Renaming
This is the simplest kind of refactoring that will
impact your code to be clear and can avoid confusions and
redundancy in terms of reading the existing code.
Renaming provides you to make your methods, variables
and class to be relevant and specific depending on the
code that youre working on.
Refactor Refactor This (Ctrl + Alt + Shift + T)
Rename (Shift+F6)

Deleting
This kind of refactoring aims to make your code
simplify by deleting codes that arent used. Deleting in
IntelliJ IDEA helps to determine where the unused lines of
code is located and a lightbulb icon which will help to
know what to delete.
Refactor Refactor This (Ctrl + Alt + Shift + T)
Safe Delete (Alt+Del)

Extracting
This kind of refactoring helps the developers to
reorganize their code to be understandable and readable.
Extracting will classify and group a fragment of codes into
a single method. Press Refactor This or (Ctrl + Alt +
Refactor Refactor This (Ctrl + Alt + Shift + T) Shift + T)
Extract (There you will see options of extract
refactoring)

Bibliography
Catalog of Refactoring. (n.d.). Retrieved November 05, 2017, from
https://refactoring.guru/refactoring/catalog
Fowler, M. (2000). Refactoring. Retrieved November 05, 2017, from
https://www.refactoring.com/
Shvets, A. (2006). Design Patterns and Refactoring (G. Frey & M. Pavlova, Eds.). Retrieved
November 05, 2017, from https://sourcemaking.com/refactoring
Top 5 Reasons Why You Should Refactor Your Code. (2017, November 05). Retrieved November
05, 2017, from https://www.telerik.com/blogs/top-5-reasons-why-you-should-refactor-your-
code
Code Refactoring in Agile Programming. (2002). Retrieved November 05, 2017, from
https://www.versionone.com/agile-101/agile-software-programming-best-
practices/refactoring/
Introduction to Refactoring. (n.d.). Retrieved November 05, 2017, from
https://www.jetbrains.com/help/idea/introduction-to-refactoring.html

You might also like