Why developers write bad code - Kevlin Henney - https://www.youtube.com/watch?v=VurciuaCQiA
When you ask somebody to write code badly, they can't do it. But if you give them a system, and this is the most important thing I want to get across here is people are not software developers, are not stupid or malicious by and large. What they do is they follow codes, they follow conventions, they don't even know. They pick them up and what happens is that what we often consider to be bad code is a product that is systematic. It is not coincidental or random. Actually, it turns out that if you say we're going to do log and throw, write that function as if you were doing log and throw. You'll be able to write that function if I give you a drop down menu of here. I like these style choices. So I basically took a number of these style choices and took a simple problem and then coded it in their style, or rather I coded it using those. And I was surprised at how close it came to their style. It was a revelation to me. It's like, yeah. What we often think of as poor code is systematically created. It is not created arbitrarily or with malice.
Why developers write bad code - Kevlin Henney - https://www.youtube.com/watch?v=VurciuaCQiA
누군가에게 코드를 나쁘게 작성하라고 하면 그들은 그렇게 할 수 없습니다. 하지만 시스템을 주면, 이것이 제가 여기서 가장 중요하게 전달하고 싶은 점인데, 소프트웨어 개발자가 아닌 사람들은 대체로 멍청하거나 악의적이지 않습니다. 그들은 코드를 따르고, 자신도 모르는 관행을 따릅니다. 그들은 그것들을 습득하고, 우리가 흔히 나쁜 코드라고 여기는 것은 사실 체계적인 산물입니다. 우연이나 무작위가 아닙니다. 실제로 로그를 남기고 예외를 던지는 함수를 작성하라고 하면, 그 함수를 작성할 수 있을 것입니다. 만약 제가 드롭다운 메뉴로 이런 스타일 선택지를 준다면, 여러분은 그 함수를 작성할 수 있을 것입니다. 저는 이런 스타일 선택지들을 가져와서 간단한 문제를 그들의 스타일로, 또는 그것들을 사용해서 코딩했습니다. 그리고 그 결과가 그들의 스타일과 얼마나 유사한지 보고 놀랐습니다. 이는 제게 큰 깨달음이었습니다. 그렇습니다. 우리가 흔히 나쁜 코드라고 생각하는 것은 체계적으로 만들어집니다. 임의로 또는 악의를 가지고 만들어지는 것이 아닙니다.