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

Part 3 template - NotePad++Example

Uploaded by

Sanket Waghmare
Copyright
© © All Rights Reserved
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views

Part 3 template - NotePad++Example

Uploaded by

Sanket Waghmare
Copyright
© © All Rights Reserved
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Refactorings

ExtractClass(PoweEditor.src.Parameters.h, PoweEditor.src.NppGUI)
MoveMethod(PoweEditor.src.Notepad_plus::command(int id):void, PoweEditor.src.NppGUI)
MoveMethod(PoweEditor.src.Notepad_plus::changeMenuShortcut(unsigned long cmdID, const char *shortcutStr):void,
MoveMethod(scintilla.src.LexUser::isInList(WordList & list, const char *s, bool specialMode, bool ignoreCase), scintilla.inclu
InlineClass(scintilla.src.Editor, scintilla.src.Style)
ExtractClass(scintilla.src.Editor, scintilla.src.Text)
MoveMethod(scintilla.src.Editor::CopyRangeToClipboard(int start, int end):void, scintilla.src.Text)
MoveMethod(scintilla.src.Editor::CopyText(int length, const char *text):void, scintilla.src.Text)
MoveAttribute(scintilla.src.Editor::characterSet, scintilla.src.Text)
MoveAttribute(scintilla.src.Editor::font, scintilla.gtk.FontCached)
MoveAttribute(scintilla.src.Editor::lineHeight, scintilla.gtk.FontCached)
MoveAttribute(scintilla.src.Editor::ascent, scintilla.gtk.FontCached)
MoveAttribute(scintilla.src.Editor::descent, scintilla.gtk.FontCached)
MoveAttribute(scintilla.src.Editor::externalLeading, scintilla.gtk.FontCached)
MoveAttribute(scintilla.src.Editor::aveCharWidth, scintilla.gtk.FontCached)
MoveAttribute(scintilla.src.Editor::spaceWidth, scintilla.gtk.FontCached)
Justifications
NppGUI is a data strcuture located in Parameters.h. This data structure is heavily used by
the methods command() and changeMenuShortcut(), for that reason I have decided to
merge these two methods with that data structure. To do so, I have firstly applied the
'extract class' refactioring (refactoring #2) to extract the NppGUI out of the Parameters.h
file so it becomes a seperate class called NppGUI and then I have moved the two methods
command() (refactoring #3) and changeMenuShortcut() (refactoring #4) into the newly
created class. This helps in removing the data class defect that was triggered by NppGUI's
lack of functions and also those operations help in reducing the coupling between the
Notepad_Plus and Parameters.h.

Style is a data class that all its attributes are heavily used by another class called Editor, so I
have decided to merge these two classes (refactoring #6) into one class to reduce the
coupling between them and also to remove the data class defect.

BY merging Style into Editor, Editor has become a large class with blob behavior, and it may
potentially become a god class. For that reason I have decided to split it by extracting a
subset of methods and attributes that can constitute an independent class. In this
purpose, I have extracted a class called Text (refactoring #7) and moved the two methods
and one attribute that are mainly dealing with the text functionality ( refactoring #8 #9
and #10).

Also, I have noticed that Editor is strongly coupled to FontCached because of font-related
attributes that initially belong to Editor so I have decided to move them to the FontCached
class (refactoring #11 - 17).

You might also like