News for hackers. Stuff that matters.
Re:Mastering Programming: An Outline by bcbrown on Tuesday June 07, 2016 @08:12PM (#11859090)
> Call your shot. Before you run code, predict out loud exactly what will happen.

That's probably my favorite bit of advice. It really helps with understanding how much your assumptions diverge from reality.

Re:Mastering Programming: An Outline by sgentle on Tuesday June 07, 2016 @11:40PM (#11859831)
I agree. I actually think it's the single most important skill for beginner to intermediate programmers. Not structuring the code or managing complex abstraction, just having a reliable mental model of the program and the environment.

I've often seen beginners struggle because they get so used to the compiler or the (often manual) tests catching errors that they just try things "to see if they work" without understanding what they're trying. But they don't consider two important questions: "what do you want to happen?" and "what do you expect to happen?".

If you can answer both of those, you can figure out whether your code will work before you write it. In many cases when programmers struggle it's because they don't know the answer to one or both. They're left just trying stuff until something works, but there's a lot more things that don't work than things that do, and a lot more bad solutions than good ones.

Re:Mastering Programming: An Outline by dmolony on Tuesday June 07, 2016 @08:24PM (#11859151)
I do this with life in general. You soon realise how bad you are at estimating, but it helps you improve.
Re:Mastering Programming: An Outline by wallace_f on Wednesday June 08, 2016 @01:21AM (#11860199)
Sounds like a good idea and seems to be worth a shot. Actually, I am thinking about why I put so little effort into this, currently. I will take your suggestion and see how it goes :)
Re:Mastering Programming: An Outline by xufi on Tuesday June 07, 2016 @09:50PM (#11859472)
Agreed. Thats what i'm trying to improve on myself while relearning the technologies I want to learn . As the saying goes "trial and error" .
Re:Mastering Programming: An Outline by sargas on Wednesday June 08, 2016 @06:09PM (#11866094)
That's great from beginner to master levels. Although master programmers call shots that are correct almost always :)
Re:Mastering Programming: An Outline by mathattack on Wednesday June 08, 2016 @03:20AM (#11860584)
I like the intellectual honesty. "Write it down" takes this one further.
Re:Mastering Programming: An Outline by aphextron on Friday June 10, 2016 @06:46AM (#11875464)
Agreed. This is akin to "rubber duck" debugging. Highly effective.
Re:Mastering Programming: An Outline by PeCaN on Tuesday June 07, 2016 @11:20PM (#11859764)
A similar one when dealing with compiled languages with good type systems (Haskell, OCaml, Rust, Mercury) is to periodically build even when your code is broken and try to guess what error the compiler will give. This helped me a lot with those languages.
Re:Mastering Programming: An Outline by caconym_ on Wednesday June 08, 2016 @01:52AM (#11860295)
My process in these languages (Haskell I know pretty well, now in the process of learning Rust) is to sprinkle in `undefined`s and `unimplemented!()`s and whatnot so I can continuously use the compiler to check my work without actually running the code.

It's a good way to test assumptions and refine a mental model, and it's also just plain useful for catching boneheaded mistakes as you go. I'm not sure if I'd say I use it as a crutch, but I certainly miss it when I have to use languages like ruby and Python.