New User Special Price Expires in

Let's log you in.

Sign in with Facebook


Don't have a StudySoup account? Create one here!


Create a StudySoup account

Be part of our community, it's free to join!

Sign up with Facebook


Create your account
By creating an account you agree to StudySoup's terms and conditions and privacy policy

Already have a StudySoup account? Login here

Software Engineering

by: Nick Rowe

Software Engineering CS 51000

Nick Rowe
GPA 3.68

Xiangyu Zhang

Almost Ready


These notes were just uploaded, and will be ready to view shortly.

Purchase these notes here, or revisit this page.

Either way, we'll remind you when they're ready :)

Preview These Notes for FREE

Get a free preview of these Notes, just enter your email below.

Unlock Preview
Unlock Preview

Preview these materials now for free

Why put in your email? Get access to more of this material and other relevant free materials for your school

View Preview

About this Document

Xiangyu Zhang
Class Notes
25 ?




Popular in Course

Popular in ComputerScienence

This 20 page Class Notes was uploaded by Nick Rowe on Saturday September 19, 2015. The Class Notes belongs to CS 51000 at Purdue University taught by Xiangyu Zhang in Fall. Since its upload, it has received 42 views. For similar materials see /class/208064/cs-51000-purdue-university in ComputerScienence at Purdue University.

Similar to CS 51000 at Purdue

Popular in ComputerScienence


Reviews for Software Engineering


Report this Material


What is Karma?


Karma is the currency of StudySoup.

You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!

Date Created: 09/19/15
RefacToring o MarTin Fowler and KenlBeck Jam Bram William om k2 Dun Ruberls Refactarlng Improving the Design of Existing Code Addison Wesley 1999 o nefactoring noun L1 change made to the internal structure of software to make it easier to understand and cheaper to modi without changing its observable behavior a Refactor verb to restructure software by applying erie o actorinas JmmyZ 2cm 1 L1 RefacToring applied 0 STraighT from The book a program To calculaTe and prinT a sTaTemenT of a cusTomer s charges aT a video sTorequot price depends on how long The movie is renTed and The caTegory of The movie also compuTe frequenT renTer poinTs JammyZEl 2cm RefacToring Movie 0 Class diagram of The sTarTing poinT classes 8 immyzn 2cm 3 RefacToring Movie Class man class MW mm md Kmmcmmm an a public 5mm mm 72 Juneme 7 m mm sunq imam mm uug Pxxvate Sunny in u u ml Juneau 1 man Mmueisumq nus Int pxlcecndzl K 7 lug gunman pxlcecnde gt Pnhhc mi qnmucndeu l zetmn Juneau gt JammyZEl 2cm Refacfor ing Rental Class public class Rental I ylivate anie private int idayskented public namtalumwia mmvae i daystntedl l idayskenled e dayskenled public int yelDaysllenledH return idaysken public Movie qeulnvie n January zu 2m Refacfor ing Customer Class public class custamn l private string Jams private wactar ixenlals nzw wactaru public custammstrima namel I public void addllentallkental an ixenlals auuulamemt 1 aqu public Slxinq qeulamzll return namlr January zu 2m Refacfor ing39 Customer Class public class Customer public string statemento double totalnmount 0 int requentRenterPoints 0quot en irental elements string result Rental Recor f r getuameo n w o ntal eac Rental rentalsnextElement determine amounts for each line switch each getuovieo getPriceCode l e Mo i REG lsRIIDunt 2 if eachgetDaysRented gt 2 thismounteachgetnaysaeutedoez 4 break January zu 2m Refacfor ing39 Customer Class public class Customer public string statemento case Movie m iRELEBSE thismnount eachgetDaysRented 3 15 if eachqetDaysRented gt 3 thisnmounteac1agetnaysgentedoea it break add frequent renter points a two day new release rental ouie getPriCeCodeO Movie NEWiRELEBSE ampamp eachqetDaysRented gt 1 frequentRenterPoints M l H a m a January zu 2m Refactoring Customer Class puma alas Cuslmnzx mama scum slalemznlll Ismm ilq xes m Lms xenlal n eachqemnvxelLatthllelH Lquot Slxmqvallle flhlsllnmnll nquot LnlaJAmmml a mum a xesull l add fonts 11 xesulk Amman ned as Sllnqvalue filnlalmnmntl nquot xesulk You earned Sllnqvalue iixeq39n ltkznlell l lil v eq enl xenlex pnlnls zeuun xesulk January 2m 2m 9 Refactoring 0 Interaction diagram for the statement method gapneouue January 1mm l l 1U Refactoring problem statement Add a htmlStatment method which returns a customer statement string containing html tags and there will be some changes to the way movies are classified affecting frequent renter points and charging Januaryl 28 11 Refactoring step 1 0 Write a test suite l L O Refactoring should not affect the outcome of tests test suite must exercise the published interface of the classes 0 Obviously refactoring should not affect the published inter ace So avoid I ublishing inter aces too earl January 2mm 12 Refactor ing step 2 0 stateme nt is overly long apply the Extract Mefhod refactor39ing mm n um Quentin u wulanzth nquot zenlals mmmmm mm mm m 9mm 1m mm 1eachgedavamp1anll xlcecndz1H lt case mnemmm msmm e 2 n mummyanan gt 21 munmum eanhqmays znted04t 15 e eachqemaysnznud0 a bleak mum 15 mammedn gt at m mum deathqtmays znted rih 15 Januaryzu znua Refactoring step 2 public Sunq statement lt dunk mmm W e u an human enlalsamx lllemnuh nus um munll nueacm u quotqua r ante mm uwmmmnmm u eas la m mfmmsz b u n ixewnlnzntul nlnts rum eachqetnnnetLEELTIUEU Lquot sunmm w mummum L mm mm mun mum and n n Stllujmaluz lnlammunn nquot mm You eaulzd Slnlqmaluz f amenmznlexl nlnlsh leauan xenlex39 ynlanUIquot xeluxn mun 1 JmuzryZElZ8 14 Refactor ing step 2 public int amountForRental each int thism un switch eachqetMoviegetPriceCodeO 1 case MovieREGlJL ismaunt 2 if eachgetDaysRented 2 thismnounteachqetDaysRented 72 it 1 5 reek case MovieNEW t 39smngunt eachgetDaysRented it 3 break case Movie on t 1 5 if eachgetDaysRented gt 3 ismnounteachgetDaysRented 73 it 1 5 break 1 return thisnmount January zu 2m Refactor ing39 step 3 0 TEST January zu 2m w oops double gt int hug public dnuhle aumuut double t in case anie t hxe ease Movie cumulus tusnu xeunan Lhismnunl Januaryzu znua Lhismnunt K switch 1eanhqelnnvietLqetPXiceCndetH Refacfor ing step 4 For neutal each I n hismmml K 2 r eachqetDaysRenledH gt 2 lhisknnunllt1enchqeuayskenled1DrZD 15 reak xmwiuumsa hasnuuuut K enchqelDaysRenledH 3 uuut K 15 if leachqetbaysnenledl gt 3 tusnuuuutK1eaeuyetnaysueuteu1pea 15 hreak Refacforing step 5 0 Variable names nof helpful anx Renla each I aauu thesauuut e n switch 1enchqlunvi1LyelPxiceCndetH ease mm tuasuuauut K 2 as teaeuaetnaysreuteau gt 2 lhismnuan1eachqeuaysllenled1DrZD 15 rear ease Museumuueuse tuasuuauut K eaeuaetnaysreuuau 3 bleak case anieCNILDREIlS u39 knmlnl K 1 a if annihqelbayskenlem 1 uuutK 1 15 this each yelDaysRenledUrSI Inesk returu lhismnunl January zu 2m public double double resu switch aka 1 January zu 2m case Movie RE uL resul ease Movie quotmi result break case Movie canmuws result 1 Refacfor ing step 5 amountForRental aRental utal getuovle qetPriceCode I K I if aRentalgetDaysRented result axeutalgetnaysllteutedKz 139 15 break LEASE K aRentalgetDaysRented 139 3 K 1 aRentalqetDaysRamted gt 3 sult axeutalgetnaysaeutedKa 139 15 break return result Refacfor ing39 step 6 0 Moving amounf compufafion does not use info from Customer only kenfal c ass custuuer puIlic uuuule amnunu nl1Renlal aneutal dnuhle result K n switch Kale aluetnuneuetyr1eecuuem ase Movie result K 2 1 talenlalqetlayskanled gt z res t 1akenlalquayskented1DrZD 1 15 ease unviemz imLEAsE result K aRenLalyeLDaysRentadH a eakr case anieclrILDREIlS result K Me if alenlalqeuayskenled gt p t l tannualyelDaysRenledUrS 15 hxeak returu result January zu 2m Refactor ing step 6 class Rental public dnuhle yelchaxqe n e result n switch gemnvielyqelPxiceCndEU anieREG 1m result l lgetDaysRentEdU gt z gecnsysnenteuwl 15 reek case MDVlEJIEVLRELEASE getDaysRented l A 3 l lgetDaysRentedU l e gt 3 rlgetDaysRentEdU 3 15 xeulxn result January zu 2m Zl Refactor mg step 7 11th Sunny statement l W mm M W n Mm win zen s D uh I us m mu m m murmumu mu ms m m January ZU ZEUS 23 Refactoring step 6 class Customer public double amountFOrRental aRental return aRentalgetCharge January zu 2m Refactor ing step 7 class cus n 1 I and ute nues resun e mun ssrusu n sung an u I own 15 n SllluzJalue lnlaDmnunU w lesull meaneumsummmn 19mlan lancer pnnllsUlquot xeluxn xesull January zu 2m Refac l39or ing Refac l39or ing s l39ep 8 o Sfafz of classes a zr moving The charge mthod amountFor has been dzlzfz 0 Replace Temp wifh Query mum quotmam Wu gmth hm uwyumm 1 wmmmmms Wu what w x m mm m mmmm weng u hm Mm MN m 5 w an mnnmm w mm um um w gm wwqmm awmm MM mm mm JammyZElJE E JammyZEl 2cm Refac l39or ing s l39ep 9 O Exfracf Mefhod mmm was mum Refac l39or ing s l39ep 9 Mm axwm mmn 1 mum aw gum w wk mm Mmahmmm mm nsxvthmv gm as 7 mm mm man g u m mum mm m H m m m m m m m Rum gamma Magma W magnum A gem15V Wm gt 1 m W 7 h w MW m mm mm w W M mm M a H mm 7 m wwumn W322 hwz rmzwszzzx W 39 N gt g If mm WMMHWWW w 1 mm W mew mmm mm WW W lawman 27 WWW Refac ror39mg step 9 Refac ror39mg s RenLal 4 m m H qu m y public int getFrequentReuterPointsD 4 summer if qetuovieo getPriceCodeO Movie EwikELERSE amp retDarsRentedO gt 1 1 Emma return 2 else 9 T A L V return 1 aMEME llnrall rema sk i Januaryzu 2m 29 JanuaryZ 3n A H W 0 Replace Temp wufh Query uMmporaricsmakcthcmnhod comp and for cod duplication m cm mum s39imi ammm mummm m 1m new mum Y A ammnmnm mmemm u Bf M H W m V Stung sun Nantal Mcnxd in yamth nquot Wm w mmnmxmmum mm m z mm munmmmm mmmmmm mmmnmnmmmm um am in m um m1 u mmmmmgemum w smug nunueachqucnamun BWV EEWEO mmmm eunwlclmq u mm mm um um ummm suwmmmmm mm mm sumquotmaunmmmwmn mm pmmnnquot quotMum JanuaryZElZ 31 JmuaryZElZ8 32 Refacfor ing step 10 o Enumeration rentals irental elements t ing r Rental Recor for H getuaneo n h l tals hasuoreElenents t al each Rental rentalsnextElement0 39 e n show figures for this rental result HtH eachgetMoviegetTitle t stringvalueofeachgetcharge Hn add footer lines result Hmnount o wed is tstingvalueOquetTotalChargeO n e n o su Y ned H st inq valueof frequent RenterPoint s H frequent renter points n return result January zu 2m 33 Refacfor ing step 10 c s Customer private double get l otalcharqeo double result 7 o Enumeration rentals irentalselements hasMoreElementSO each ental rentalsnextElenent result eachqetcharge while rentals ntal El 1 return result January zu 2m 34 Refacfor ing step 11 0 Replace Temp with Query class cnstmner ie Slxinq sta an frequentnenterynint n Enumexalinn rentals e rentaielententsn Slximq resn Hnental Recnxd fnx H netuaneu n while 1rentalsnasunrealernents1n en each mentalp rentalsnextalenentu fxequentkenlexllninls K eaennetrrenuentuenterynints1p Ishw fiquxes fax this rental result Ht enduqetnnvietDyetTilleH Ht Slxinqmalue fleachgelchatqe1 n l add fnnter lines t s Slinyvalue ftqetTnlalchaxJet n Hn inn aluerfleqnenlkenlexl ninlsH ts H hagnun renter Pnln return result January zu znua 35 Refacfor ing39 step 11 0 Replace Temp wifh Query Class Customer public string statemento r n rn1 e 7rnl nn sult R al Rec for H s get ameQ a HnH while rentals hasMoreElementS 0 ntal each Rental rentalsnextElement enta H eachgetMoviegetTit1e t String valueofeachgetcharge n 39 add footer lines sult Hmnount owed is StingvalueOfLetTotalCharreO nquot result uyou u earned H Sting valueof getFrequentRenterPoint s 0 ent renter pomt s nH January zu 2m 36 RefacToring sTep 11 class Customer private double getErequentRenterPcintso Enumeration rentals rentalselenents while rentals hasMcreElenents 0 Rental each Rental rentalsnextElenent result each gethequentRentezPoints return result January 20 2008 37 RefacToring a Class dlagr am bzforz extraction of M2 Imzracnon diagram i gensnusonaso g getrxeque gmceonde oints 0 January 20 2 RefacToring 0 Class diagram after extraction of Th2 totals aterremo samscanso samsresnsmsemwms ost maiRamerPumo Thrall renalSIQElfrEuuemRenmnioith gElPriEEQme January 20 20 RefacToring 0 Remarks MosT refacToring reduce code size bLIT This is noT necessarily The case The poinT is To make code easier To modify and more readable Performance geTs a hiT by running The same loop Three Times or does iT Profile The program and find The answer January 20 2008 40 o The requested duplication Software extension class Customer public Stxinq h lalanenln Enumexatinn x Slximq us cut 5 n all Januaryzu znua method can be added with minimal code 7 Lale1ementsll lt lgtllental Recn 1 quotM1 xenlalsJ aanerlemenlSUi m gm mall tentalsnuxullmnenlll Ilshw mun m um rental 1 sun each emaviellqel39fitleli v n lxinqmalue fieachqelchaxqeiii lta1gtnquot add funtex lines xesull i ltPgt1hnnnl wed 3950 Slinqvalue f1yel39l39nlalchnqeiii ltEngtltPgtn xesull You can lt Slinqvalueriqeli xequenlkenlexl ninls1ii lt m an xen ex paintsltPgtn mm quotsun m in am yelllameil wlt2Mgtltii1gtltpgtn Refactoring step 12 O Replacing conditional logic on Price Code with polymorphism January zu 2m New functionality 0 Getting ready to change the classification of the movies in the store 0 Perhaps new classification perhaps modification to existing 0 Charging and frequent renting will be affected January zu 2m Refactoring step 1 2 0 Move getCharge m Mm W m switch gemnvieiLyelPxiceCndeHi u ull lqelnaysllented1i72i 15 m K Itiilll K A gt a m m January zu 2m Refacfor ing step 12 lass uuuic public dnuhle yelchazqetinl daysncutcup double cs suit ch qeLPxiceCnde m n cumin xesult if maysucutca gt 2D rcsult maysucutcaezy 15 daysncutcu 3 i 1 1 if maysucutcu gt at rcsult 1dayskenledrlh 15 bicak rcturu result January zu znua 45 Refacfor ing step 12 class ncutal public dnuhle cctcharccn xehnn unuiccctcharcctuaysncutcup January zu 2m 46 Refacfor ing step 13 0 Move geTFr equen f ReMerPoinTs class Rent al public int getFrequentRenterPoints i qetuovieogetlzricemdeo MovieNEW7RELEBSE gt 1 u getDaysRentedO else return 1 January zu znua 47 Refacfor ing39 step 13 class ovi public int getF requentRenterPointsUnt daysRented 39 vieNEW7RELEBSE ampamp daysRented gt 1 1f qetPriceCodeD retur 2 else return 1 class Rental public int getF req39uentRenterPoints o return imovie getF requentRenterPoints idaysRented January zu 2m 48 Refac ror ing 0 Class diaqr am before moving mafhods 1390 movie cusmmar gamma mummy0 gmmaFwemmer ums ammo ngmaJmaweO 1 mmmmmmmmn mmsmerremo gamma gato argeo garaqnamwamgmms garmqnamwamwms January zu znua 49 Refac ror ing 0 Inherifance lemme mwmwe NewReleaserE E E January Zn 2m 5 Refac l39or ing O Inherifance mimequotan 931013960 NEMRiwaSePVJDE EEGJEIEEU JanuaryZEIZ8 51 Refacfor ing step 14 0 Replace Type Code wifh STaTeSfr afegy class Movie pub 39c Moviemtring name int pricecode name name iprlcecode priceCode January zu znua sz Refactor ing step 14 class Movie public MovieString name int pricecode name name setPriceCodepriceCode Refactor ing step 14 abstract class Price stract int qetPriceCodeO class Childrenvric i e extends Price de t getPriceCo return vaEC ILDREN class NewRe 1 int getPriceCo e ur mVIENEW7RELEASE easevrice extends Price class RegularPrice extends Price 39 t qetPriceCodeO return wwwmcumm January zu 2m January ZU ZEUS 53 Refactor mg step 15 class Movie public int qetPricdtodeO 4 return pricec e 1 public void setPriceCodeUnt arg riceCode 39 1 private int ipricecode 55 January zu 2m Refactor ing39 step 15 class uuvie puhl39c int yeleiceCndeH turn 39 re Jricenetmicecnue public void selPticeCndMinl ax t ewit axqb case uncut Jrice e new neanlmricen hxeak case cuunmu pxice e new cnilurenyriceu new ewlleleaseriCM t default threw new Illegalmqmnlilxceplinn1 Incnxxect Pxice cuuenp pxivale Pxice ince January zu 2m Refactor ing step 16 0 Move Method Class M n 111111 dnuhle qrtchnqetint daysnmud 1 dmlhlz 1111 u not gelPticeCndeH 1 case 11mm mun 2 if yelbayskencedu gt 21 e 11 1gunays1xmudwzi 15 gelhayskenled n 3 111 1 1 1 1gnuaysnmua1 gt a quot1111 1qelnaysnenled n 15 luxeak xelnxn xesull Januaryzu znua Refactor ing step 16 public double getchargeunt daysRented return iprice getChargedaysRented January zu 2m Refactor ing step 16 9 Replace Conditional with Polymorphism Class Price 111111 many hymn 111111 quot11 1 switch qeu xicecndetn anIEREGuLu 2 1 Wmmmdn gt 2 1111 1qecDaysRentedHrZD 15 hxe case unvmmwium quot1111 yelDaysRenledH 3 bleak case unvmc11mzm15 s 1 7 1 1 yetbayskencedu gt 31 quot1115 1qetbayskenlednri 15 112311 mm xesull Januaryzu znua Refactor ing39 step 16 class 1199111321111 Iin lhle yelchnqetint aaysngnum i dnuhle xesull z if qelbaysxenle n gt 21 111 gelnayskznlzd rzi 15 class Ilewlleleaserice e gnchngum daysllentedi um daysllenled 1 3 111 chipmunk 11111111 gelchazqetimt daysRenledi 1 1111111 11111 15 1 yelnaysnenled gt 31 111111 1gunaysnmuawai 139 15 xetuzn quot1111 class Pzi skxanl dmlhle yelchnqetinl aaysnmudp January zu 2m Refactoring step 17 0 Replace Conditional with Polymorphism class Rental int qetF requentRenterPointsint daysReuted i 39f iqetpricecadeo 7 lbvieJlE wiasmnsia u daysRented gt 1 else return 1 January zu 2m Refactoring step 17 class Movie int getFrequentRenterPoints 39nt daysRented i return iprice getF requentRenterPoints daysRented V class Price int qetF requentRenterPointsint daysRented return 1 leasePrice int getsrequentaeatervojntsunt daysRented i return daysRented gt 1 a 21 Jonuory zu 2m Refactoring Principles 0 th do we refactor e To mprove the design of software 39 To make software easier to understand Tohelp you find bugs 39 To make you program faster When should we refactor kefactor when you add functionality 2 kefactor when you need to fix a bu 3 kefactor as you do code rev ews Refocfor when the code starts to smell 0 What about Eerformance39 Worry about performance only when you have identif ed a performance problem Januaryzu znua Bad Smells in Code I f I39 7 sfns change if quotGrandma Beck Am hidrear g Duplicated Code stench 10 If the same code structure is repeated Extract Method gather duplicated code Pull Up Field mon parent rorm Iemplate Method gather similar parts leaving holes Substitute Algorithm choose the clearer algorit m Extract class for unrelated classes create a new class with functionality 0 January zu 2m Bad Smells in Code Lang Mefhad sTench 7 If The body of a meThod is over a page choose your page size 6 ExTracT MeThod exTracT relaTed behavior Replace Temp wiTh uery remove Temporaries when They obscure meaning 39 InTroduce ParameTer ObjecT slim down parameTer lisTs by making Them inTo objecTs Replace MeThod wiTh MeThod ObjecT sTill Too many parame ers Decompose CondiTionals condiTional and loops can be moved To Their own meTho s o 0 January zu znua 65 Bad Smells in Code Large Class sTench 7 JT a class has eITher Too many variables or Too many meThods ExTracT Class To bundle variablesmeThods January zu 2m Bad Smells in Code Divergem Change sTench 5 If you find yourself repeaTedly changing The same class Then There is probably someThing wrong wiTh iT 39 ExTracT Class group funcTionaliTy commonly changed inTo a class January zu 2m 57 Bad Smells in Code Shotgun Surgery sTench 5 If you find yourself making a loT of small changes for each desired change 39 Move MeThodField pull all The changes inTo a single class Inline Class group a bunch of behaviors TogeTher January zu 2m Bad Smells in Code Feafure Envy sTench e If a meThod seems more inTeresTed in a class oTher Than The class iT acTually is in Move MeThod move The meThod To The desired class 39 ExTracT MeThod if only parT of The meThod shows The sympToms Januaryzu znua Bad Smells in Code Dafa Cumps sTench 4 DaTa iTems ThaT are frequenle TogeTher in meThod signaTures a classes belong To a class of Their own I ExTracT Class Turn relaTed fields inTo a class InTroduce ParameTer ObjecT for meThod signaTures January zu 2m Bad Smells in Code Primfive Obsession sTench 3 PrimiTive Types inhibiT change 5 Replace DaTa Value wiTh ObjecT on individual daTa values 39 Move MeThodField pull all The changes inTo a single class InTroduce ParameTer ObjecT for signaTures Replace Array wiTh ObjecT To geT rid of arrays January zu 2m Bad Smells in Code Swifch Sfafemenfs sTench 5 SwiTch sTaTemenTs lead To duplicaTion and inhibiT change 0 ExTracT meThod To remove The swiTch 39 Move meThod To geT The meThod where polymorphism can a l quot Replace Type Code wiTh STaTeSTraTegy seT up inheriTance 0 Replace CondiTional wiTh Polymorphism geT rid of The swiTch January zu 2m Bad Smells in Code Parallel I nlzer fance Hierarchies stench e If when ever you make a subclass In one corner of the hierarchy you must create another subclass in another corner 39 Move MethodField get one hierarchy to refer to the other January zu 2m 73 Bad Smells in Code Lazy Class stench 4 If a class eg after refactoring does not do much eliminate it Collapse Hierarchy for subclasses 39 Inline Class remove a single class January zu 2m 74 Bad Smells in Code SpecuafVe Genera y stench 4 If a class has features that are only used in test cases remove them Collapse Hierarchy for useless abstract classes 39 Inline Class for useless delegation 39 Rename Method methods with odd abstract names should be brought down to earth January zu znua 75 Bad Smells in Code Temporary Field stench 3 If a class has fields that are only set in special cases extract them 39 Extract Class for the special fields January zu 2m 76 Januaryzu znua Bad Smells in Code Message Chains sTench 3 Long chains of messages To geT To a value are briTTle as any change in The inTermiTTenT sTrucTure will break The code Hide DelegaTe remove one link in a chain I EXTracT MeThod change The behavior To avoid chains Januaryzu znua Bad Smells in Code Inapproprafe Infmacy sTench 5 Classes are Too inTimaTe and spend Too much Time delving in each oTher39s privaTe parTs 39 Move MeThodField To separaTe pieces in order To reduce inTimac I ExTracT Class make a common class of shared behaviordaTa 6 Replace InheriTance wiTh DelegaTion when a subclass is geTTing Too cozy Bad Smells in Code MiddleMan sTench 3 An inTermediary objecT is used Too ofTen To geT aT encapsulaTed values 39 Remove Middle Man To Talk direchy To The TargeT 4 Replace DelegaTion wiTh InheriTance Turns The middle man inTo a subclass of The real objecT January zu 2m Bad Smells in Code Comments sTench 2 CommenTs are ofTen a sign of unclear code consider refacToring January zu 2m 20


Buy Material

Are you sure you want to buy this material for

25 Karma

Buy Material

BOOM! Enjoy Your Free Notes!

We've added these Notes to your profile, click here to view them now.


You're already Subscribed!

Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'

Why people love StudySoup

Bentley McCaw University of Florida

"I was shooting for a perfect 4.0 GPA this semester. Having StudySoup as a study aid was critical to helping me achieve my goal...and I nailed it!"

Janice Dongeun University of Washington

"I used the money I made selling my notes & study guides to pay for spring break in Olympia, Washington...which was Sweet!"

Jim McGreen Ohio University

"Knowing I can count on the Elite Notetaker in my class allows me to focus on what the professor is saying instead of just scribbling notes the whole time and falling behind."


"Their 'Elite Notetakers' are making over $1,200/month in sales by creating high quality content that helps their classmates in a time of need."

Become an Elite Notetaker and start selling your notes online!

Refund Policy


All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email


StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here:

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to

Satisfaction Guarantee: If you’re not satisfied with your subscription, you can contact us for further help. Contact must be made within 3 business days of your subscription purchase and your refund request will be subject for review.

Please Note: Refunds can never be provided more than 30 days after the initial purchase date regardless of your activity on the site.