Artwork

A tartalmat a iteration podcast, John Jacob, and JP Sio - Web Developers biztosítja. Az összes podcast-tartalmat, beleértve az epizódokat, grafikákat és podcast-leírásokat, közvetlenül a iteration podcast, John Jacob, and JP Sio - Web Developers vagy a podcast platform partnere tölti fel és biztosítja. Ha úgy gondolja, hogy valaki az Ön engedélye nélkül használja fel a szerzői joggal védett művét, kövesse az itt leírt folyamatot https://hu.player.fm/legal.
Player FM - Podcast alkalmazás
Lépjen offline állapotba az Player FM alkalmazással!

Refactoring - In Practice

34:53
 
Megosztás
 

Manage episode 229976776 series 1900125
A tartalmat a iteration podcast, John Jacob, and JP Sio - Web Developers biztosítja. Az összes podcast-tartalmat, beleértve az epizódokat, grafikákat és podcast-leírásokat, közvetlenül a iteration podcast, John Jacob, and JP Sio - Web Developers vagy a podcast platform partnere tölti fel és biztosítja. Ha úgy gondolja, hogy valaki az Ön engedélye nélkül használja fel a szerzői joggal védett művét, kövesse az itt leírt folyamatot https://hu.player.fm/legal.

In this episode we dive deep into some specific refactors from Refactoring 's Chapter 1. We talk about renaming things, extracting functions, functions, replacing a temp with query and some other hot tips and tricks you can put into your code today.

This episode walks through specific code examples from Chapter 1 of Martin Fowler's Refactoring...

Some of the refactors

Change Function Declaration

  • Rename things
  • Names are hard
  • A few general categories of things you can name
    • predicate? - Should only return true / false - Javascript start with is - ruby question mark - so isValidPhone(number)
    • In Ruby - ! For destructive / dangerous actions - update_recent_activity! - name destructive actions or actions with side effects really well.
    • Formatting? - use - as - number_as_phone(number) or to to_bmi(user.weight, user.height)

Extract Function

Replace temp w/ query

  • Extending this example:

Instead of:

accounts = get_accounts(user)
transactions = get_transactions(accounts)

we can just do:

transactions = get_transactions(get_accounts(user))

Replace conditional with polymorphism

Notification.deliver! example

Picks

  continue reading

78 epizódok

Artwork

Refactoring - In Practice

iteration

113 subscribers

published

iconMegosztás
 
Manage episode 229976776 series 1900125
A tartalmat a iteration podcast, John Jacob, and JP Sio - Web Developers biztosítja. Az összes podcast-tartalmat, beleértve az epizódokat, grafikákat és podcast-leírásokat, közvetlenül a iteration podcast, John Jacob, and JP Sio - Web Developers vagy a podcast platform partnere tölti fel és biztosítja. Ha úgy gondolja, hogy valaki az Ön engedélye nélkül használja fel a szerzői joggal védett művét, kövesse az itt leírt folyamatot https://hu.player.fm/legal.

In this episode we dive deep into some specific refactors from Refactoring 's Chapter 1. We talk about renaming things, extracting functions, functions, replacing a temp with query and some other hot tips and tricks you can put into your code today.

This episode walks through specific code examples from Chapter 1 of Martin Fowler's Refactoring...

Some of the refactors

Change Function Declaration

  • Rename things
  • Names are hard
  • A few general categories of things you can name
    • predicate? - Should only return true / false - Javascript start with is - ruby question mark - so isValidPhone(number)
    • In Ruby - ! For destructive / dangerous actions - update_recent_activity! - name destructive actions or actions with side effects really well.
    • Formatting? - use - as - number_as_phone(number) or to to_bmi(user.weight, user.height)

Extract Function

Replace temp w/ query

  • Extending this example:

Instead of:

accounts = get_accounts(user)
transactions = get_transactions(accounts)

we can just do:

transactions = get_transactions(get_accounts(user))

Replace conditional with polymorphism

Notification.deliver! example

Picks

  continue reading

78 epizódok

Minden epizód

×
 
Loading …

Üdvözlünk a Player FM-nél!

A Player FM lejátszó az internetet böngészi a kiváló minőségű podcastok után, hogy ön élvezhesse azokat. Ez a legjobb podcast-alkalmazás, Androidon, iPhone-on és a weben is működik. Jelentkezzen be az feliratkozások szinkronizálásához az eszközök között.

 

Gyors referencia kézikönyv