Skip to content

Pseudo Kata para practicar los atajos de IntelliJ

Notifications You must be signed in to change notification settings

APA42/APA_Prueba_Java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Practicando con IntelliJ

Extract

Extract Method

Extraer a un método toda la parte del switch llamarlo updateWithWeather

MacOS: ALT CMD M

Extract Constant

Extraer a una constante los días del año para la tierra llamarla NUMBER_OF_DAYS_IN_A_YEAR

MacOS: ALT CMD C

Extract Field

Extraer de la función updateWithWeather toda la parte que se repite The weather is

Sólo seleccionar la primera frase, aparece una nueva ventana:

seleccionar Initialize in Current method

llamarla theWeatherIs

seleccionar Replace all occurrences

Nota, me crea un atributo en la clase, quiero el scope en la función (gente java qué opina?)

MacOS: ALT CMD F

Extract Variable

De la función printPlanetFacts Línea 16, planet.getName().length() vamos a dar semántica Extraer a una variable, llamarla planetNameLength

MacOS: ALT CMD V

Extra, mover la sentencia de la nueva variable al comienzo de la función

Extract Parameter

De la función updateWithWeather vamos a extraer UK como parámetro de la función

MacOS: ALT CMD P

Make Inline

Vamos ha hacer inline la función updateWithWeather

MacOS: ALT CMD N

Change signature

Ir a la clase Planeta al constructor

Nuevo parámetro String realSeason Seleccionar Default value: "Summer"

Cambiar public String getCountryWeather() {

public String getCountryWeather() {
        return realSeason;
    }

Ver que me cambia los tests al meter un nuevo parámetro

OJO que ahora están en rojo salvo 1, cambiar en los test el valor de realSeason

MacOS: CMD F6

Replace constructor with builder

Ir a la clase Planet señalar el primer parámetro

MacOS: ALT Enter

Seleccionar Replace constructor with builder

cambiar Target Destination Directory a los test

Otros ejemplos

Del vídeo Refactoring Intro y Live Coding Kata Gilded Rose https://www.youtube.com/watch?v=CIfBC56tPEI

Ejemplo de Builder 44:10

GoldenMasterApprovalTest 48:00

Feature Envy Wrapper =>Introduce Parameter Object 01:02:41

Me he basado en

https://blog.jetbrains.com/idea/2020/12/3-ways-to-refactor-your-code-in-intellij-idea/ https://www.youtube.com/watch?v=_Y1y8k-OTCQ

About

Pseudo Kata para practicar los atajos de IntelliJ

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages