#269 closed defect (fixed)
code duplication on clients site
Reported by: | olhsha | Owned by: | g.georgovassilis@mpi.nl |
---|---|---|---|
Priority: | major | Milestone: | ComponentRegistry-1.14 |
Component: | ComponentRegistry | Version: | 1.0 |
Keywords: | refactor | Cc: |
Description
there are a few code blocks in client-site (flex) that are met in two or more copies in different places. It should be refactored.
Change History (9)
comment:1 Changed 11 years ago by
comment:2 Changed 11 years ago by
Milestone: | → ComponentRegistry-1.13 |
---|
comment:3 Changed 11 years ago by
Milestone: | ComponentRegistry-1.13 → ComponentRegistry-1.14 |
---|
comment:4 Changed 11 years ago by
There are different action-script classes that contain methods with "almost the same code".
In particular, this is the case for the classes that perform work over/for Components and the classes that perform work over/for Profiles. Compare, for instance, ComponentInfoService?.as and ProfileInfoService?.as, or ComponentListService?.as and ProfileListService?.as.
Accurate code parsing will give you other examples.
The aim is to get rid (when reasonable) from code repetition, e.g. by using inheritance.
comment:5 Changed 11 years ago by
Owner: | changed from olhsha to g.georgovassilis@mpi.nl |
---|---|
Status: | new → assigned |
comment:6 Changed 11 years ago by
Also check the following pairs in ComponentEdit?.as, if they can be refactored:
private function addComponentAddButton():void
private function addElementAddButton():void
addComponent(component:CMDComponent)
addElement(element:CMDComponentElement)
private function removeComponent(event:Event)
private function removeElement(event:Event)
comment:7 Changed 11 years ago by
Status: | assigned → accepted |
---|
comment:8 Changed 11 years ago by
Resolution: | → fixed |
---|---|
Status: | accepted → closed |
Introduced BaseRemoteService? to handle http/xml communication with the backend. Provides URL management, error handling, extracting XML. Also introduced HttpServiceFactory? and to allow for mocking http communication in unit tests (see ComponentInfoServiceTest? for an example).
comment:9 Changed 11 years ago by
Also, to check for refactoring:
CMDComponentElementBrowser.as and ComponentBrowse?.as
handleElements(elements:ArrayCollection)
handleComponents(components:ArrayCollection)
ComponentBrowse?.as and ElementBrowse?.as.:
addLine, addChild
public function getProfileColumns()
public function getComponentColumns()
getInitialSortForProfiles()
getInitialSortForComponents()
---------------------------------
CMDcomponent.as:
removeComponent vs removeElement
moveDownElement vs moveDownElement
moveUpComponent vs moveUpElement
fixed but need more testing on the developer's machine