SlideShare a Scribd company logo
1 of 7
Download to read offline
Innovative Systems Design and Engineering                                                 www.iiste.org
ISSN 2222-1727 (Paper) ISSN 2222-2871 (Online)
Vol 2, No 4, 2011


              Refactoring for Multi-Dimensional Reusability
                                                  Bashir Ahmad
                               Institute of Computing and Information Technology
                                          Gomal University, PAKISTAN
                                             bashahmad@gmail.com


                                                 Shakeel Ahmad
                               Institute of Computing and Information Technology
                                          Gomal University, PAKISTAN
                                           Shakeel_1965@yahoo.com


                                            Sheikh Muhammad Saqib
                               Institute of Computing and Information Technology
                                          Gomal University, PAKISTAN
                                           saqibsheikh4@hotmail.com


                                            Muhammad Zubair Asghar
                               Institute of Computing and Information Technology
                                          Gomal University, PAKISTAN
                                             Zubair_icit@yahoo.com


                                             Muhammad Ahmad Jan
                               Institute of Computing and Information Technology
                                          Gomal University, PAKISTAN
                                            mr_ahmadjan@yahoo.com
Abstract

Source code should be simpler, easy to read and easy to understand. This slogan is not only relates to
change the existing code for current service, but also has an association with reusability. Refactoring is a
best idea for above issues i.e. keeping the code simple and support the emergent design practice. Many
refactoring techniques have been produced related to code simplicity and understandability for
maintainability & extensibility. Here author enforced to make the method with the division of three sections
and each section should have an argument as a signal. Such technique will be the pillar of reusability from
many directions.
Keywords: Source Code, Reusability, Refactoring, maintainability and extensibility.
1. Introduction
Different opinion from different dimensions has been explored about refactoring as explained below:
“Changing the structure of a code with changing its function to make easier code”
“A change that alters the functionality of the code is not a Refactoring”
“Greatly reducing the chance of error is relate to Refactoring”

                                                     350
One possible definition (Sibylle Peter 2009) about code refactoring is that actually it is technique for
reconstructing an existing code, without changes in external behavior and altering the internal structure. It
is useful for easier to fix bugs and easy to read the source doe. Every bug leads too many new bugs and it
will be very hard to implement new features, here master plan is suggested which explores what should be
refactored. Also definition published in Xp Refactoring Faq, refactoring should not be fixed with only bugs
fixing but it is very close to reusability, at start technical staff may not understand what is to reuse and how
to reuse.
Alexandre Correa (2007) & Raimund Moser (2006) have argued that refactoring is not only supposed to
improve source code understandability & maintainability but has positive effects on reusability’s internal
measures of object oriented programming. It also promotes ad-hoc reuse in development environment.
Different techniques of refactoring can be applied over OCL (object constraint language) specification to
remove problematic constructions by using UML 2.0. Refactoring opportunities for extract method
Nikolaos Tsantalis (2011), where it is defined the different rules for program behavior and extraction of
meaningful refactoring opportunities. This leads to either complete computation of a variable or the
statements affecting the state of an object.
Bill Opdyke (1999) suggest a strategy about replacement of automated system over existing system which is
not just for limited time, but automated systems replace previous one with life time. Software for an
organization completely fulfills the currently running procedures, while organization requires new services
time to time. Due to different approaches related to software models and programming tools & schemes,
such new services can be easily accommodated. When organization requires some amendments in an
existing service, then major issue for such option is Refactoring. Refactoring should be applied more
generally due to different issues like platform selection; product evaluation and software reuse.
Changes in existing services are the common and burning issue from the start of organization automation.
Programmers feel very difficulties by changing the source code of existing service. Article published by
The-Software-Experts (2010), it is claimed that If code writers follow the principles of refactoring from the
beginning of source code, then updating can be easily understandable and changeable. OOP approaches
require a good architecture to integrate millions of lines of code programmed by various programming team
members.
 Soft Goals is very useful for refactoring, due to adding comments or regrouping functions into other
modules. Since refactoring has direct link with reusability so Object Oriented Approaches (OOA) are very
favorable. In OOA, class is a single entity with the combination of different methods (made up of code
refactoring principles) so effects of different coupling suggested by Shakeel Ahmad (2011) about common
coupling , external coupling & control coupling, they can be minimized while content coupling & data
coupling can be easily handled. By using such type of emerge, refactoring make its position in
programming zones.
Class is also the technique for refactoring means: extract class move part of code for an existing class into
new class. Class consists of different methods and refactoring can be easily applied over each method and it
can be reusable for other services or existing code can be changed. As for reusability and refactoring OOP
concept had been generated, because repeated executed code should be written in single piece i.e. method.
This can be easily changed for some other purpose. Method does not consist of single line of code; it is also
built up of many line of code and some other methods. Here author suggest a scheme for source code to
build the method or function with and without signal, where refactoring can be easily applied, if code of
source-code is so long. Then a method can be embedded in other class of same tool or other tool.
2. Refactoring in Class Method with a Signal
It is common known, that each service has different activities and each activity have operational parameters
and procedures. If service treats as a class then activities treat as methods. In broad vision, purpose of each
activity is same. This is solid matter and universal truth for each activity. Every body knows the purpose of
any activity in short words input, processing and out put. It is very clear that each function is the
combination of three sections. By such division changes can be easily made.




                                                     351
Fig-1: Method of a Class with three Sections and Signal for Refactoring
Water pump service is the good example for mapping the above diagram. Such service consists of electric
machine consider as an input, water tank consider as a processing and tap consider as an out put. At any
time, service consumer can change any item.
User can set any item separately, when there is a fault. If user wants to replace old thing with new one, he
can change any thing with out disturbing other one i.e. if user wants to change the tap, he can easily replace
it without disturbing water tanks or machine. Applying this logic on any method of a class, interface for
each option can be easily fit in frame of user demand.




                             Fig-2: Change of any Item in Water Pump Service




                                                    352
Suppose a method, which is used to add two numbers then it should be divided in to three sections.




                            Fig-3: Method of a class consists of three Sections
In above diagram, changes can be done separately by disturbing other one. Such changes may type
changing, space setting for variables or some functionality not behavior. Suppose if requirement is changed
from addition of two numbers to three numbers. Then only changes will be done in input section and
procession section as shown in following figure.




                         Fig-4: Method easily changed According to User Needs
According user requirements, programmer will easily locate the location where changes will be done. Fig-4
shows that only source code of 1st and 2nd method is changed from previous requirements to new
requirements. In 1st method only line-4 is added for input of third number and in 2nd method only line-2 is
changed from addition of two numbers to three numbers.
As different language provide different graphical user interface or command line interface. Adaptation of
such technique, interface can be easily interchanged. User interface depend on input and out put, not on


                                                   353
processing. Now here separate identification has assigned to input and out put sections, so changes over
here can be easily done.




                  Fig-5: Graphical Interface easily changed from GUI to Command Line
From above figure it is clear that only changing the Graphical User Interface GUI-statements from 1st and
3rd methods to command line statements. There is no need to change the processing statements.
Since we have changed input or out put interfaces but in same place some users require graphical interfaces
and some require command line interface. Similarly some require addition of two numbers and some
requires of addition of three numbers. Then make the habit to pass a signal to each method as a parameter
then requirements of everyone can be completed.




                              Fig-6: Method with Signal for Code Execution


                                                   354
By above setting of a method with signal, any type of code can be appended with function. Any user who
want to add to two numbers, he will pass signal as 1 and for addition of three numbers, signal as 2 will be
passed.
Some users use to add two numbers only with the desired inputs, then this class method will be easily
reused with the little bit refactoring. Suppose some users wants to add two numbers which are even then
only input section of a method can include a new method for checking the input constraints.




                           Fig-7: Adding New Requirements with Previous One
It is clear that by adding the some portion of a new method with previous one, previous method will be
useable for new queries.
It is true that, we have taken simple example, but we are seeing the refactoring of a method from an angle
of reusability by optimizing the code. Where we have suggested that division of each method for an activity
should be in three sections and strongly recommending for passing signal through each section.
3. Conclusion
If a method has long body, then it may have a duplicate code with nearby method. Such problem can be
recognized by refactoring i.e. transforming the routine in to new structure that behaves the same as before.
Besides the maintainability (easy to fix the bugs) and extensibility (easier to expand the capabilities of the
function), refactoring should be useful for reusability. Here author suggest a refactoring scheme for altering
the code of a method of a class. By adopting such technique, a method with signal can be refactored easily
for current facilities as well as future reusability. Here authors take a simple example, but purpose of
proposed research is not relate to such example, but relates to technique adopting in research. Proposed
research enforces each programmer to divide each method in to three sections with a passing argument as a
signal. Then on any time such code can be easily transferred from graphical user interface to command line
interface. And also single method can fulfill the requirements of many users.



                                                    355
References
Bill Opdyke , (1999), Refactoring, Reuse & Reality, Lucent Technologies/ Bell Labs. http://st-
www.cs.illinois.edu/users/opdyke/wfo.990201.refac.html
Shakeel Ahmad, (2011), “Reusable Code for CSOA-Services: Handling Data Coupling and Content
Coupling”, (IJCSIS) International Journal of Computer Science and Information Security, Vol. 9, No. 5,
196-199.
Alexandre Correa, (2007) “Refactoring object constraint language specifications”, Software System Model,
Springer, Vol 6:113–138
Principles of Code Refactoring, (2010), The-Software-Experts, http://www.the-software-experts.de/e_dta-
sw-refact-principles.htm
Sibylle Peter, 2009,“Refactoring Large Software Systems”, ISSN1661-402X Methods & Tools , Vol 17, no 4
Raimund Moser, (2006), “Does Refactoring Improve Reusability?”, Springer-Verlag Berlin
Heidelberg.,ICSR, LNCS 4039, pp. 287 – 297
Nikolaos Tsantalis, ( 2011) “Identification of extract method refactoring opportunities for the
decomposition of methods”, Journal of Systems and Software, ELSEVIER, Volume 84, Issue 10, Pages
1757-1782




                                                   356

More Related Content

Viewers also liked

Viewers also liked (20)

สถิติ
สถิติสถิติ
สถิติ
 
What i do
What i doWhat i do
What i do
 
Desenvolvimento orientado a Testes
Desenvolvimento orientado a TestesDesenvolvimento orientado a Testes
Desenvolvimento orientado a Testes
 
Mensa
MensaMensa
Mensa
 
7д бэлчээрийн ургамал
7д бэлчээрийн ургамал7д бэлчээрийн ургамал
7д бэлчээрийн ургамал
 
Aula 8 principios_programacao - Programação 1
Aula 8 principios_programacao - Programação 1Aula 8 principios_programacao - Programação 1
Aula 8 principios_programacao - Programação 1
 
Mbaptscv ijuly2009 s
Mbaptscv ijuly2009 sMbaptscv ijuly2009 s
Mbaptscv ijuly2009 s
 
Dia's h1 marktverkenning cca 7
Dia's h1 marktverkenning cca 7Dia's h1 marktverkenning cca 7
Dia's h1 marktverkenning cca 7
 
삼성 바다 앱개발 실패 노하우 2부
삼성 바다 앱개발 실패 노하우 2부삼성 바다 앱개발 실패 노하우 2부
삼성 바다 앱개발 실패 노하우 2부
 
Facebook timeline para empresas
Facebook timeline para empresasFacebook timeline para empresas
Facebook timeline para empresas
 
En characteristics of_the_successful_believers
En characteristics of_the_successful_believersEn characteristics of_the_successful_believers
En characteristics of_the_successful_believers
 
Alternate Model Of Ppp
Alternate Model Of PppAlternate Model Of Ppp
Alternate Model Of Ppp
 
Olympic sports 1
Olympic sports 1Olympic sports 1
Olympic sports 1
 
Painted Gray
Painted GrayPainted Gray
Painted Gray
 
Tuukh 7grade
Tuukh 7gradeTuukh 7grade
Tuukh 7grade
 
Enhancing presentations
Enhancing presentationsEnhancing presentations
Enhancing presentations
 
FLA 2010 Presentation
FLA 2010 Presentation FLA 2010 Presentation
FLA 2010 Presentation
 
Código Limpo Dual
Código Limpo DualCódigo Limpo Dual
Código Limpo Dual
 
abh Sales Analyser
abh Sales Analyserabh Sales Analyser
abh Sales Analyser
 
Hc123
Hc123Hc123
Hc123
 

Similar to 33 sheikh muhammadsaqib_350-356

6.[39 43]cloud based dedicated application for multiple organizations--cloud ...
6.[39 43]cloud based dedicated application for multiple organizations--cloud ...6.[39 43]cloud based dedicated application for multiple organizations--cloud ...
6.[39 43]cloud based dedicated application for multiple organizations--cloud ...Alexander Decker
 
6.[39 43]cloud based dedicated application for multiple organizations--cloud ...
6.[39 43]cloud based dedicated application for multiple organizations--cloud ...6.[39 43]cloud based dedicated application for multiple organizations--cloud ...
6.[39 43]cloud based dedicated application for multiple organizations--cloud ...Alexander Decker
 
A Review On Chatbot Design And Implementation Techniques
A Review On Chatbot Design And Implementation TechniquesA Review On Chatbot Design And Implementation Techniques
A Review On Chatbot Design And Implementation TechniquesJoe Osborn
 
An Adjacent Analysis of the Parallel Programming Model Perspective: A Survey
 An Adjacent Analysis of the Parallel Programming Model Perspective: A Survey An Adjacent Analysis of the Parallel Programming Model Perspective: A Survey
An Adjacent Analysis of the Parallel Programming Model Perspective: A SurveyIRJET Journal
 
Performance Evaluation using Blackboard Technique in Software Architecture
Performance Evaluation using Blackboard Technique in Software ArchitecturePerformance Evaluation using Blackboard Technique in Software Architecture
Performance Evaluation using Blackboard Technique in Software ArchitectureEditor IJCATR
 
Final Year Project Report Example
Final Year Project Report ExampleFinal Year Project Report Example
Final Year Project Report ExampleMuhd Mu'izuddin
 
A FRAMEWORK STUDIO FOR COMPONENT REUSABILITY
A FRAMEWORK STUDIO FOR COMPONENT REUSABILITYA FRAMEWORK STUDIO FOR COMPONENT REUSABILITY
A FRAMEWORK STUDIO FOR COMPONENT REUSABILITYcscpconf
 
Concurrent Matrix Multiplication on Multi-core Processors
Concurrent Matrix Multiplication on Multi-core ProcessorsConcurrent Matrix Multiplication on Multi-core Processors
Concurrent Matrix Multiplication on Multi-core ProcessorsCSCJournals
 
Getting relational database from legacy data mdre approach
Getting relational database from legacy data mdre approachGetting relational database from legacy data mdre approach
Getting relational database from legacy data mdre approachAlexander Decker
 
IRJET- Analysis of Software Cost Estimation Techniques
IRJET- Analysis of Software Cost Estimation TechniquesIRJET- Analysis of Software Cost Estimation Techniques
IRJET- Analysis of Software Cost Estimation TechniquesIRJET Journal
 
PHP modernization approach generating KDM models from PHP legacy code
PHP modernization approach generating KDM models from PHP legacy codePHP modernization approach generating KDM models from PHP legacy code
PHP modernization approach generating KDM models from PHP legacy codejournalBEEI
 
RSDC (Reliable Scheduling Distributed in Cloud Computing)
RSDC (Reliable Scheduling Distributed in Cloud Computing)RSDC (Reliable Scheduling Distributed in Cloud Computing)
RSDC (Reliable Scheduling Distributed in Cloud Computing)IJCSEA Journal
 
A Comparative Study of Forward and Reverse Engineering
A Comparative Study of Forward and Reverse EngineeringA Comparative Study of Forward and Reverse Engineering
A Comparative Study of Forward and Reverse Engineeringijsrd.com
 
IRJET - Pseudocode to Python Translation using Machine Learning
IRJET - Pseudocode to Python Translation using Machine LearningIRJET - Pseudocode to Python Translation using Machine Learning
IRJET - Pseudocode to Python Translation using Machine LearningIRJET Journal
 
Simple Mail Transfer Protocol
Simple Mail Transfer ProtocolSimple Mail Transfer Protocol
Simple Mail Transfer ProtocolVinod Gurram
 
Application of cloud computing based on e learning teaching tool
Application of cloud computing based on e learning teaching toolApplication of cloud computing based on e learning teaching tool
Application of cloud computing based on e learning teaching tooleSAT Journals
 
Deepcoder to Self-Code with Machine Learning
Deepcoder to Self-Code with Machine LearningDeepcoder to Self-Code with Machine Learning
Deepcoder to Self-Code with Machine LearningIRJET Journal
 

Similar to 33 sheikh muhammadsaqib_350-356 (20)

6.[39 43]cloud based dedicated application for multiple organizations--cloud ...
6.[39 43]cloud based dedicated application for multiple organizations--cloud ...6.[39 43]cloud based dedicated application for multiple organizations--cloud ...
6.[39 43]cloud based dedicated application for multiple organizations--cloud ...
 
6.[39 43]cloud based dedicated application for multiple organizations--cloud ...
6.[39 43]cloud based dedicated application for multiple organizations--cloud ...6.[39 43]cloud based dedicated application for multiple organizations--cloud ...
6.[39 43]cloud based dedicated application for multiple organizations--cloud ...
 
A Review On Chatbot Design And Implementation Techniques
A Review On Chatbot Design And Implementation TechniquesA Review On Chatbot Design And Implementation Techniques
A Review On Chatbot Design And Implementation Techniques
 
An Adjacent Analysis of the Parallel Programming Model Perspective: A Survey
 An Adjacent Analysis of the Parallel Programming Model Perspective: A Survey An Adjacent Analysis of the Parallel Programming Model Perspective: A Survey
An Adjacent Analysis of the Parallel Programming Model Perspective: A Survey
 
Performance Evaluation using Blackboard Technique in Software Architecture
Performance Evaluation using Blackboard Technique in Software ArchitecturePerformance Evaluation using Blackboard Technique in Software Architecture
Performance Evaluation using Blackboard Technique in Software Architecture
 
Final Year Project Report Example
Final Year Project Report ExampleFinal Year Project Report Example
Final Year Project Report Example
 
A FRAMEWORK STUDIO FOR COMPONENT REUSABILITY
A FRAMEWORK STUDIO FOR COMPONENT REUSABILITYA FRAMEWORK STUDIO FOR COMPONENT REUSABILITY
A FRAMEWORK STUDIO FOR COMPONENT REUSABILITY
 
Concurrent Matrix Multiplication on Multi-core Processors
Concurrent Matrix Multiplication on Multi-core ProcessorsConcurrent Matrix Multiplication on Multi-core Processors
Concurrent Matrix Multiplication on Multi-core Processors
 
Getting relational database from legacy data mdre approach
Getting relational database from legacy data mdre approachGetting relational database from legacy data mdre approach
Getting relational database from legacy data mdre approach
 
IRJET- Analysis of Software Cost Estimation Techniques
IRJET- Analysis of Software Cost Estimation TechniquesIRJET- Analysis of Software Cost Estimation Techniques
IRJET- Analysis of Software Cost Estimation Techniques
 
PHP modernization approach generating KDM models from PHP legacy code
PHP modernization approach generating KDM models from PHP legacy codePHP modernization approach generating KDM models from PHP legacy code
PHP modernization approach generating KDM models from PHP legacy code
 
RSDC (Reliable Scheduling Distributed in Cloud Computing)
RSDC (Reliable Scheduling Distributed in Cloud Computing)RSDC (Reliable Scheduling Distributed in Cloud Computing)
RSDC (Reliable Scheduling Distributed in Cloud Computing)
 
A Comparative Study of Forward and Reverse Engineering
A Comparative Study of Forward and Reverse EngineeringA Comparative Study of Forward and Reverse Engineering
A Comparative Study of Forward and Reverse Engineering
 
IRJET - Pseudocode to Python Translation using Machine Learning
IRJET - Pseudocode to Python Translation using Machine LearningIRJET - Pseudocode to Python Translation using Machine Learning
IRJET - Pseudocode to Python Translation using Machine Learning
 
Simple Mail Transfer Protocol
Simple Mail Transfer ProtocolSimple Mail Transfer Protocol
Simple Mail Transfer Protocol
 
Aq4301224227
Aq4301224227Aq4301224227
Aq4301224227
 
G213538
G213538G213538
G213538
 
Ijebea14 287
Ijebea14 287Ijebea14 287
Ijebea14 287
 
Application of cloud computing based on e learning teaching tool
Application of cloud computing based on e learning teaching toolApplication of cloud computing based on e learning teaching tool
Application of cloud computing based on e learning teaching tool
 
Deepcoder to Self-Code with Machine Learning
Deepcoder to Self-Code with Machine LearningDeepcoder to Self-Code with Machine Learning
Deepcoder to Self-Code with Machine Learning
 

More from Alexander Decker

Abnormalities of hormones and inflammatory cytokines in women affected with p...
Abnormalities of hormones and inflammatory cytokines in women affected with p...Abnormalities of hormones and inflammatory cytokines in women affected with p...
Abnormalities of hormones and inflammatory cytokines in women affected with p...Alexander Decker
 
A validation of the adverse childhood experiences scale in
A validation of the adverse childhood experiences scale inA validation of the adverse childhood experiences scale in
A validation of the adverse childhood experiences scale inAlexander Decker
 
A usability evaluation framework for b2 c e commerce websites
A usability evaluation framework for b2 c e commerce websitesA usability evaluation framework for b2 c e commerce websites
A usability evaluation framework for b2 c e commerce websitesAlexander Decker
 
A universal model for managing the marketing executives in nigerian banks
A universal model for managing the marketing executives in nigerian banksA universal model for managing the marketing executives in nigerian banks
A universal model for managing the marketing executives in nigerian banksAlexander Decker
 
A unique common fixed point theorems in generalized d
A unique common fixed point theorems in generalized dA unique common fixed point theorems in generalized d
A unique common fixed point theorems in generalized dAlexander Decker
 
A trends of salmonella and antibiotic resistance
A trends of salmonella and antibiotic resistanceA trends of salmonella and antibiotic resistance
A trends of salmonella and antibiotic resistanceAlexander Decker
 
A transformational generative approach towards understanding al-istifham
A transformational  generative approach towards understanding al-istifhamA transformational  generative approach towards understanding al-istifham
A transformational generative approach towards understanding al-istifhamAlexander Decker
 
A time series analysis of the determinants of savings in namibia
A time series analysis of the determinants of savings in namibiaA time series analysis of the determinants of savings in namibia
A time series analysis of the determinants of savings in namibiaAlexander Decker
 
A therapy for physical and mental fitness of school children
A therapy for physical and mental fitness of school childrenA therapy for physical and mental fitness of school children
A therapy for physical and mental fitness of school childrenAlexander Decker
 
A theory of efficiency for managing the marketing executives in nigerian banks
A theory of efficiency for managing the marketing executives in nigerian banksA theory of efficiency for managing the marketing executives in nigerian banks
A theory of efficiency for managing the marketing executives in nigerian banksAlexander Decker
 
A systematic evaluation of link budget for
A systematic evaluation of link budget forA systematic evaluation of link budget for
A systematic evaluation of link budget forAlexander Decker
 
A synthetic review of contraceptive supplies in punjab
A synthetic review of contraceptive supplies in punjabA synthetic review of contraceptive supplies in punjab
A synthetic review of contraceptive supplies in punjabAlexander Decker
 
A synthesis of taylor’s and fayol’s management approaches for managing market...
A synthesis of taylor’s and fayol’s management approaches for managing market...A synthesis of taylor’s and fayol’s management approaches for managing market...
A synthesis of taylor’s and fayol’s management approaches for managing market...Alexander Decker
 
A survey paper on sequence pattern mining with incremental
A survey paper on sequence pattern mining with incrementalA survey paper on sequence pattern mining with incremental
A survey paper on sequence pattern mining with incrementalAlexander Decker
 
A survey on live virtual machine migrations and its techniques
A survey on live virtual machine migrations and its techniquesA survey on live virtual machine migrations and its techniques
A survey on live virtual machine migrations and its techniquesAlexander Decker
 
A survey on data mining and analysis in hadoop and mongo db
A survey on data mining and analysis in hadoop and mongo dbA survey on data mining and analysis in hadoop and mongo db
A survey on data mining and analysis in hadoop and mongo dbAlexander Decker
 
A survey on challenges to the media cloud
A survey on challenges to the media cloudA survey on challenges to the media cloud
A survey on challenges to the media cloudAlexander Decker
 
A survey of provenance leveraged
A survey of provenance leveragedA survey of provenance leveraged
A survey of provenance leveragedAlexander Decker
 
A survey of private equity investments in kenya
A survey of private equity investments in kenyaA survey of private equity investments in kenya
A survey of private equity investments in kenyaAlexander Decker
 
A study to measures the financial health of
A study to measures the financial health ofA study to measures the financial health of
A study to measures the financial health ofAlexander Decker
 

More from Alexander Decker (20)

Abnormalities of hormones and inflammatory cytokines in women affected with p...
Abnormalities of hormones and inflammatory cytokines in women affected with p...Abnormalities of hormones and inflammatory cytokines in women affected with p...
Abnormalities of hormones and inflammatory cytokines in women affected with p...
 
A validation of the adverse childhood experiences scale in
A validation of the adverse childhood experiences scale inA validation of the adverse childhood experiences scale in
A validation of the adverse childhood experiences scale in
 
A usability evaluation framework for b2 c e commerce websites
A usability evaluation framework for b2 c e commerce websitesA usability evaluation framework for b2 c e commerce websites
A usability evaluation framework for b2 c e commerce websites
 
A universal model for managing the marketing executives in nigerian banks
A universal model for managing the marketing executives in nigerian banksA universal model for managing the marketing executives in nigerian banks
A universal model for managing the marketing executives in nigerian banks
 
A unique common fixed point theorems in generalized d
A unique common fixed point theorems in generalized dA unique common fixed point theorems in generalized d
A unique common fixed point theorems in generalized d
 
A trends of salmonella and antibiotic resistance
A trends of salmonella and antibiotic resistanceA trends of salmonella and antibiotic resistance
A trends of salmonella and antibiotic resistance
 
A transformational generative approach towards understanding al-istifham
A transformational  generative approach towards understanding al-istifhamA transformational  generative approach towards understanding al-istifham
A transformational generative approach towards understanding al-istifham
 
A time series analysis of the determinants of savings in namibia
A time series analysis of the determinants of savings in namibiaA time series analysis of the determinants of savings in namibia
A time series analysis of the determinants of savings in namibia
 
A therapy for physical and mental fitness of school children
A therapy for physical and mental fitness of school childrenA therapy for physical and mental fitness of school children
A therapy for physical and mental fitness of school children
 
A theory of efficiency for managing the marketing executives in nigerian banks
A theory of efficiency for managing the marketing executives in nigerian banksA theory of efficiency for managing the marketing executives in nigerian banks
A theory of efficiency for managing the marketing executives in nigerian banks
 
A systematic evaluation of link budget for
A systematic evaluation of link budget forA systematic evaluation of link budget for
A systematic evaluation of link budget for
 
A synthetic review of contraceptive supplies in punjab
A synthetic review of contraceptive supplies in punjabA synthetic review of contraceptive supplies in punjab
A synthetic review of contraceptive supplies in punjab
 
A synthesis of taylor’s and fayol’s management approaches for managing market...
A synthesis of taylor’s and fayol’s management approaches for managing market...A synthesis of taylor’s and fayol’s management approaches for managing market...
A synthesis of taylor’s and fayol’s management approaches for managing market...
 
A survey paper on sequence pattern mining with incremental
A survey paper on sequence pattern mining with incrementalA survey paper on sequence pattern mining with incremental
A survey paper on sequence pattern mining with incremental
 
A survey on live virtual machine migrations and its techniques
A survey on live virtual machine migrations and its techniquesA survey on live virtual machine migrations and its techniques
A survey on live virtual machine migrations and its techniques
 
A survey on data mining and analysis in hadoop and mongo db
A survey on data mining and analysis in hadoop and mongo dbA survey on data mining and analysis in hadoop and mongo db
A survey on data mining and analysis in hadoop and mongo db
 
A survey on challenges to the media cloud
A survey on challenges to the media cloudA survey on challenges to the media cloud
A survey on challenges to the media cloud
 
A survey of provenance leveraged
A survey of provenance leveragedA survey of provenance leveraged
A survey of provenance leveraged
 
A survey of private equity investments in kenya
A survey of private equity investments in kenyaA survey of private equity investments in kenya
A survey of private equity investments in kenya
 
A study to measures the financial health of
A study to measures the financial health ofA study to measures the financial health of
A study to measures the financial health of
 

Recently uploaded

Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 

Recently uploaded (20)

Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 

33 sheikh muhammadsaqib_350-356

  • 1. Innovative Systems Design and Engineering www.iiste.org ISSN 2222-1727 (Paper) ISSN 2222-2871 (Online) Vol 2, No 4, 2011 Refactoring for Multi-Dimensional Reusability Bashir Ahmad Institute of Computing and Information Technology Gomal University, PAKISTAN bashahmad@gmail.com Shakeel Ahmad Institute of Computing and Information Technology Gomal University, PAKISTAN Shakeel_1965@yahoo.com Sheikh Muhammad Saqib Institute of Computing and Information Technology Gomal University, PAKISTAN saqibsheikh4@hotmail.com Muhammad Zubair Asghar Institute of Computing and Information Technology Gomal University, PAKISTAN Zubair_icit@yahoo.com Muhammad Ahmad Jan Institute of Computing and Information Technology Gomal University, PAKISTAN mr_ahmadjan@yahoo.com Abstract Source code should be simpler, easy to read and easy to understand. This slogan is not only relates to change the existing code for current service, but also has an association with reusability. Refactoring is a best idea for above issues i.e. keeping the code simple and support the emergent design practice. Many refactoring techniques have been produced related to code simplicity and understandability for maintainability & extensibility. Here author enforced to make the method with the division of three sections and each section should have an argument as a signal. Such technique will be the pillar of reusability from many directions. Keywords: Source Code, Reusability, Refactoring, maintainability and extensibility. 1. Introduction Different opinion from different dimensions has been explored about refactoring as explained below: “Changing the structure of a code with changing its function to make easier code” “A change that alters the functionality of the code is not a Refactoring” “Greatly reducing the chance of error is relate to Refactoring” 350
  • 2. One possible definition (Sibylle Peter 2009) about code refactoring is that actually it is technique for reconstructing an existing code, without changes in external behavior and altering the internal structure. It is useful for easier to fix bugs and easy to read the source doe. Every bug leads too many new bugs and it will be very hard to implement new features, here master plan is suggested which explores what should be refactored. Also definition published in Xp Refactoring Faq, refactoring should not be fixed with only bugs fixing but it is very close to reusability, at start technical staff may not understand what is to reuse and how to reuse. Alexandre Correa (2007) & Raimund Moser (2006) have argued that refactoring is not only supposed to improve source code understandability & maintainability but has positive effects on reusability’s internal measures of object oriented programming. It also promotes ad-hoc reuse in development environment. Different techniques of refactoring can be applied over OCL (object constraint language) specification to remove problematic constructions by using UML 2.0. Refactoring opportunities for extract method Nikolaos Tsantalis (2011), where it is defined the different rules for program behavior and extraction of meaningful refactoring opportunities. This leads to either complete computation of a variable or the statements affecting the state of an object. Bill Opdyke (1999) suggest a strategy about replacement of automated system over existing system which is not just for limited time, but automated systems replace previous one with life time. Software for an organization completely fulfills the currently running procedures, while organization requires new services time to time. Due to different approaches related to software models and programming tools & schemes, such new services can be easily accommodated. When organization requires some amendments in an existing service, then major issue for such option is Refactoring. Refactoring should be applied more generally due to different issues like platform selection; product evaluation and software reuse. Changes in existing services are the common and burning issue from the start of organization automation. Programmers feel very difficulties by changing the source code of existing service. Article published by The-Software-Experts (2010), it is claimed that If code writers follow the principles of refactoring from the beginning of source code, then updating can be easily understandable and changeable. OOP approaches require a good architecture to integrate millions of lines of code programmed by various programming team members. Soft Goals is very useful for refactoring, due to adding comments or regrouping functions into other modules. Since refactoring has direct link with reusability so Object Oriented Approaches (OOA) are very favorable. In OOA, class is a single entity with the combination of different methods (made up of code refactoring principles) so effects of different coupling suggested by Shakeel Ahmad (2011) about common coupling , external coupling & control coupling, they can be minimized while content coupling & data coupling can be easily handled. By using such type of emerge, refactoring make its position in programming zones. Class is also the technique for refactoring means: extract class move part of code for an existing class into new class. Class consists of different methods and refactoring can be easily applied over each method and it can be reusable for other services or existing code can be changed. As for reusability and refactoring OOP concept had been generated, because repeated executed code should be written in single piece i.e. method. This can be easily changed for some other purpose. Method does not consist of single line of code; it is also built up of many line of code and some other methods. Here author suggest a scheme for source code to build the method or function with and without signal, where refactoring can be easily applied, if code of source-code is so long. Then a method can be embedded in other class of same tool or other tool. 2. Refactoring in Class Method with a Signal It is common known, that each service has different activities and each activity have operational parameters and procedures. If service treats as a class then activities treat as methods. In broad vision, purpose of each activity is same. This is solid matter and universal truth for each activity. Every body knows the purpose of any activity in short words input, processing and out put. It is very clear that each function is the combination of three sections. By such division changes can be easily made. 351
  • 3. Fig-1: Method of a Class with three Sections and Signal for Refactoring Water pump service is the good example for mapping the above diagram. Such service consists of electric machine consider as an input, water tank consider as a processing and tap consider as an out put. At any time, service consumer can change any item. User can set any item separately, when there is a fault. If user wants to replace old thing with new one, he can change any thing with out disturbing other one i.e. if user wants to change the tap, he can easily replace it without disturbing water tanks or machine. Applying this logic on any method of a class, interface for each option can be easily fit in frame of user demand. Fig-2: Change of any Item in Water Pump Service 352
  • 4. Suppose a method, which is used to add two numbers then it should be divided in to three sections. Fig-3: Method of a class consists of three Sections In above diagram, changes can be done separately by disturbing other one. Such changes may type changing, space setting for variables or some functionality not behavior. Suppose if requirement is changed from addition of two numbers to three numbers. Then only changes will be done in input section and procession section as shown in following figure. Fig-4: Method easily changed According to User Needs According user requirements, programmer will easily locate the location where changes will be done. Fig-4 shows that only source code of 1st and 2nd method is changed from previous requirements to new requirements. In 1st method only line-4 is added for input of third number and in 2nd method only line-2 is changed from addition of two numbers to three numbers. As different language provide different graphical user interface or command line interface. Adaptation of such technique, interface can be easily interchanged. User interface depend on input and out put, not on 353
  • 5. processing. Now here separate identification has assigned to input and out put sections, so changes over here can be easily done. Fig-5: Graphical Interface easily changed from GUI to Command Line From above figure it is clear that only changing the Graphical User Interface GUI-statements from 1st and 3rd methods to command line statements. There is no need to change the processing statements. Since we have changed input or out put interfaces but in same place some users require graphical interfaces and some require command line interface. Similarly some require addition of two numbers and some requires of addition of three numbers. Then make the habit to pass a signal to each method as a parameter then requirements of everyone can be completed. Fig-6: Method with Signal for Code Execution 354
  • 6. By above setting of a method with signal, any type of code can be appended with function. Any user who want to add to two numbers, he will pass signal as 1 and for addition of three numbers, signal as 2 will be passed. Some users use to add two numbers only with the desired inputs, then this class method will be easily reused with the little bit refactoring. Suppose some users wants to add two numbers which are even then only input section of a method can include a new method for checking the input constraints. Fig-7: Adding New Requirements with Previous One It is clear that by adding the some portion of a new method with previous one, previous method will be useable for new queries. It is true that, we have taken simple example, but we are seeing the refactoring of a method from an angle of reusability by optimizing the code. Where we have suggested that division of each method for an activity should be in three sections and strongly recommending for passing signal through each section. 3. Conclusion If a method has long body, then it may have a duplicate code with nearby method. Such problem can be recognized by refactoring i.e. transforming the routine in to new structure that behaves the same as before. Besides the maintainability (easy to fix the bugs) and extensibility (easier to expand the capabilities of the function), refactoring should be useful for reusability. Here author suggest a refactoring scheme for altering the code of a method of a class. By adopting such technique, a method with signal can be refactored easily for current facilities as well as future reusability. Here authors take a simple example, but purpose of proposed research is not relate to such example, but relates to technique adopting in research. Proposed research enforces each programmer to divide each method in to three sections with a passing argument as a signal. Then on any time such code can be easily transferred from graphical user interface to command line interface. And also single method can fulfill the requirements of many users. 355
  • 7. References Bill Opdyke , (1999), Refactoring, Reuse & Reality, Lucent Technologies/ Bell Labs. http://st- www.cs.illinois.edu/users/opdyke/wfo.990201.refac.html Shakeel Ahmad, (2011), “Reusable Code for CSOA-Services: Handling Data Coupling and Content Coupling”, (IJCSIS) International Journal of Computer Science and Information Security, Vol. 9, No. 5, 196-199. Alexandre Correa, (2007) “Refactoring object constraint language specifications”, Software System Model, Springer, Vol 6:113–138 Principles of Code Refactoring, (2010), The-Software-Experts, http://www.the-software-experts.de/e_dta- sw-refact-principles.htm Sibylle Peter, 2009,“Refactoring Large Software Systems”, ISSN1661-402X Methods & Tools , Vol 17, no 4 Raimund Moser, (2006), “Does Refactoring Improve Reusability?”, Springer-Verlag Berlin Heidelberg.,ICSR, LNCS 4039, pp. 287 – 297 Nikolaos Tsantalis, ( 2011) “Identification of extract method refactoring opportunities for the decomposition of methods”, Journal of Systems and Software, ELSEVIER, Volume 84, Issue 10, Pages 1757-1782 356