Jonathan Blow on Refactoring

preview_player
Показать описание
If you have questions, you can come to one of Jon's streams:

Рекомендации по теме
Комментарии
Автор

I smiled when he mentioned refactoring by letting the compilation breakages tell you what to fix. I do that quite a bit....even major refactors that cause 500+ errors. There's something satisfying about just walking down the error list fixing what the compiler points you to, and watching that error count drop 20 or so at a time.

keithpatrick
Автор

Static typing is indeed very useful for refactoring. This is why all the (successful) dynamic languages are adding ways to add static typing optionally

tassaron
Автор

Compile By Fire is one of my favourite tricks as well. Some years ago, I was working on a codebase that transmitted certain variables over the air in a particular byte order that was not the same as the host byte order, and that meant that any maths operations on it needed to flip the bytes properly before and after doing the operations. There was a missing byteswap *somewhere* in the system. By changing the name of the variable, the compiler told me all usages of that variable everywhere in any context and let me audit each instance, silence the good ones by fixing the name locally, and eventually find the missing byteswap.

MatthewChaplain
Автор

Wow, using the compiler as an extra-safe alternative for find and replace is so meta, I love that tip

dorobokino
Автор

3:50 "Every place we use C is gonna be a disaster, right?" Ah... I love that this could be taken out of context. lol

Spirrwell
Автор

Really good montage, thanks for sharing.

IamMrSlimy
Автор

The power of lexical scopes and strong types :) Great refactoring tool, I gotta use that.

takumicrary
Автор

there are similar methods in all languages to encapsulate and alter code in isolation. It does take time to get good at it. There is no better method than just keep programming. I would also say that there is no bound to getting good at the process.

mikevidzdev
Автор

When I do refactoring I like to make big jumps and not fearing to destroy my system, I avoid trying to keep feeling safe. I use to refactor a lot and include that in my daily routine, I'm always refactoring as soon as I feel the code is ugly. I feel I make much more progress since I started taking this habit. First because you stress the system you designed so you become more familiar with it, and second because it's by taking risks that you become stronger. It's a good way to develop your abstraction skills.
You solve problems easier in general.

unchartouille
Автор

Just because your statically typed program compiles after a refactoring it doesn't mean that it works again.

kyoai
Автор

Love the "Ancient Aliens"-like thumbnail.

MuradBeybalaev
Автор

this is my first time hearing, "no troll" (1:02)...i'm definitely stealing this

jearsh
Автор

amazing thats taught me a real meaning of refactoring .

Sahilbc-wjqk
Автор

congrats on the awesome efficient development of your skills. :)

shitheadjohnson
Автор

The problem with python is polymorphic functions. In strongly typed languages like Java you are returning a type or subtype or strongly typed implementation, so their are pretty good guard rails. In python, people can write functions that can return a variety of completely incompatible types, and this is common. Python's type hinting system allows this to be accounted for to some degree.

purdysanchez
Автор

He did algebra in grade school? In which state did he grow up?

totheknee
Автор

3:40 is absolutely genius. I am certainly using this trick next time I refactor.

okal
Автор

Powershell has one of the easiest to use optional typing systems, and I badly wish Javascript could inherit or borrow it somehow.

StephenGillie
Автор

I would love to see J Blow works with John Carmack

nXqd
Автор

Does optional types in Python prevent this? I have mainly worked with statically typed languages, and my go to refactoring safety net is using compiler to make sure I didn't break anything. But am doing some more python work and miss that safety net.

samharris