News for hackers. Stuff that matters.
Re:Do something different for a week by _benj on Sunday November 14, 2021 @09:24AM (#29217328)
> Implement twice; pick the better version.

This! I like most of the ideas and it sounds like a fun exercise to try a few for 1-2 weeks, but I think that implementing something twice could yield so much value!

In my role I prioritize code maintenance, probably because I hate work with painful codebases, probably because I’ve seen 5 years+millions of dollar projects fail as the tech debt piles up and the codebase grows too fragile to implement new features needed to go to market, probably because I’m lazy and don’t like to read much to know what the code is doing.

But one of the best architectures I’ve ever built was one that I had to implement 3 times. Now, this wasn’t because of my vast wisdom but because I literally coded myself in a corner the first two! (Go rigidity around circular dependencies is a double edged sword)

Re:Do something different for a week by leetrout on Sunday November 14, 2021 @09:37AM (#29217414)
Mythical Man Month: Build one to throw away

https://wiki.c2.com/?PlanToThrowOneAway or for iphone users https://archive.md/zdfXh (no idea why they are blocking iphone)

Quotes about Joe Armstrong say he solved the same problem in multiple iterations to refine the solution.

Some of his opinions: https://joearms.github.io/published/2014-02-07-why-programmi...

Re:Do something different for a week by burke on Sunday November 14, 2021 @10:09AM (#29217585)
I’ll frequently do this when I start large refactors or implementations. I’ll build a big ugly branch that kind of works, then, when I have a better idea of where I’m headed, start from master again, building a chain of sometimes a dozen or more PRs, mostly from scratch, that build to the same point as that big ugly branch. Along the way, the code and architecture tend to improve dramatically.
Re:Do something different for a week by MontagFTB on Sunday November 14, 2021 @10:20AM (#29217686)
I’ve followed a similar pattern before in large features as well. During each iteration my mental model improves dramatically, and I have no qualms about deleting everything and starting over, because I _know_ the next iteration will be that much more correct, performant, and/or maintainable.
Re:Do something different for a week by mslate on Sunday November 14, 2021 @12:23PM (#29218681)
Reminds me of this great tweet from @AlmightyGod:

> EXPERIMENT: If you prayed to a god last week, try praying to a different one this week and see if you notice a difference

https://twitter.com/almightygod/status/1452430762347843586

Re:Do something different for a week by psyc on Sunday November 14, 2021 @12:41PM (#29218832)
It reminds me a little of Brian Eno’s Oblique Strategies, just a bit more concrete.
Re:Do something different for a week by bt1a on Sunday November 14, 2021 @10:09AM (#29217588)
> Pretend to be streaming. Talk while you program as if you were doing recording a screencast for other people.

So, no different than from when I am actually streaming?

Re:Do something different for a week by realitysballs on Sunday November 14, 2021 @09:31AM (#29217381)
I find I take some of these meta-approaches in my own code work but it’s a nice article to spell them out so explicitly.
Re:Do something different for a week by timdaub on Sunday November 14, 2021 @12:57PM (#29218995)
For a while, I embraced entering extra randomness in my life. Actually it has nothing to do with the programming methods described in the article but goes along the same category of reasoning.

I ended up subscribing to a bunch of random calls on https://dialup.com/ and had some pretty amazing conversations.

Re:Do something different for a week by Cicero22 on Sunday November 14, 2021 @12:43PM (#29218848)
> Avoid the debugger.

People who don't use the debugger, do you generally have more/better logging? What other advantages would there be to not using a debugger. Perhaps simpler code, so that you don't need to use a debugger to debug?

Re:Do something different for a week by MarkSweep on Sunday November 14, 2021 @02:03PM (#29219590)
To motivate why learning how to solve problems without a debugger is a useful skill, there are times when using a debugger is not feasible.

Sometimes you might simply mot have a debugger. I had an old WinCE 6 system whose debugger I never got working. An even older 80186 system with a custom RTOS. I have no idea how you would debug that. (The 286 added some pins for in-circuit emulation, so I’m guessing such a system would be easier to build a debugger for)

Sometimes having a debugger attached slows down the system so much it is no longer functional. Specifically hooking a debugger to HHVM seems to slow down execution by quite a bit.

If you are debugging a real time motion control, you get one shot per move to capture what is going on. This is because your motor control software stops executing while the debugger is pause by the physical motor is still moving. So when you resume execution your physical motor is not where it should be and your controller either tries to compensate or error out.

Sometimes the act of attaching a debugger prevents the problem from occurring. For example it can change the interleaving of multiple threads of execution and cause your race condition to go away. Or on some microcontrollers if your debugger reads a hardware register it can cause the value of the register to change.

Sometimes your debugger can cause the problem to happen more reliably. I had an intermittent corruption in a floating point calculation. Stepping through with the debugger made it 100% reproducible, as the data-corrupting interior handler had plenty of time to run while single-stepping the main thread.

Re:Do something different for a week by drran on Sunday November 14, 2021 @01:18PM (#29219170)
After a while, your code will be easier to reason about, you will learn how to use asserts and proper logs, and you will write much better error messages. Why I need to launch a debugger, when I can detect an error condition with assert and put relevant information into the error message?
Re:Do something different for a week by mdoms on Sunday November 14, 2021 @12:55PM (#29218978)
I try to avoid the debugger. I know what my code is doing because I have unit tests and yeah I'd like to think simpler code. If my code is doing something unexpected I try to reproduce the issue with more unit tests. Sometimes the debugger is unavoidable, especially if a third party dependency is doing something weird.
Re:Do something different for a week by shoto_io on Sunday November 14, 2021 @11:28AM (#29218164)
I think this it's generally a good idea to try these "anti-patterns". Doing things very differently for a short amount of time might work miraculously. (and of course it might not work at all...)
Re:Do something different for a week by nuclearnice1 on Sunday November 14, 2021 @09:33AM (#29217397)
How do you manage consistency with these experiments?

If I do 5 of these micro experiments in a year, do I have 10 weeks of code that idiomatically doesn’t match the rest of the codebase?

Re:Do something different for a week by pseudoramble on Sunday November 14, 2021 @09:37AM (#29217418)
They do mention that it probably should not be applied to production code bases. I imagine it's intended to avoid that situation.

> Some of these should probably not be tried for the first time in a professional context where you work with other people in the same code repository, while others can. Use your judgment.

I could see the testing example still being of use in a prod code base though. If you find a useful technique and make useful tests, you can keep them. If they're not, remove them at the end of the experiment.

Re:Do something different for a week by leetrout on Sunday November 14, 2021 @09:32AM (#29217391)
I almost have to always draw everything before building it.

I sort out thoughts, see relationships and plan naming and params ahead of time.

Re:Do something different for a week by agumonkey on Sunday November 14, 2021 @02:42PM (#29219951)
same.. my first reflex is to dig for a pencil and a piece of paper.. i tried other ways but my brain is stuck on this.
Re:Do something different for a week by 32gbsd on Sunday November 14, 2021 @09:54AM (#29217492)
Sounds like this guy just needs to finish what he is doing and stop. instead of devising new ways to dick around inside the sandbox.
Re:Do something different for a week by uwagar on Sunday November 14, 2021 @10:06AM (#29217561)
how about do nothing. u are perfect already!