Live data from Hacker News

Ask HN: What change in your programming technique has been most transformative?

news.ycombinator.com

101–110 of 215 posts

Re: Ask HN: What change in your programming technique has been most transformative?

#101
post #75

Earlier quoted context omitted.

What language? Is it a game? I've been wanting to try that ever since I saw a video of someone developing an FPS in Common Lisp while playing it at the same time. They would modify the bullets and the way they made collision, then fire after each change to see the effect.

It's an open world roguelike in Clojure. It was counter intuitive to me at first, but modifying real-time behavior like rendering is even easier because the feedback loop doesn't involve player interaction.

Game code doesn't need player interaction either to hotreload. See this section of a talk by Bret Victor for some inspiration: https://www.youtube.com/watch?v=PUv66718DII&t=10m42s

Re: Ask HN: What change in your programming technique has been most transformative?

#102
I wouldn’t be surprised if the majority here are doing this, but version control everything

Distributed version control is one of the greatest things to have gained popularity in the last ~20 years; if you’re not incorporating git, hg, fossil, ... start now.

You gain: concise annotated commits, ease of cloning/transporting, full history, easy branching for feature branches or other logically seperate work, tools like bisecting, blame/annotation, etc., etc.

Re: Ask HN: What change in your programming technique has been most transformative?

#103

You can come up w/ an algebra for a specific problem domain by thinking about the data models and repurposing some simple abstract algebra. E.g.: new(state, &args) => mutation apply(state, mutation) => state' Applied to finance: newPayment(balanceSheet, amount, date) => payment apply(balanceSheet, payment) => balanceSheet' newDiscount(balanceSheet', amount, date) => discount apply(balanceSheet', discount) => balanceS…

You'd like: https://blog.ploeh.dk/2017/10/04/from-design-patterns-to-cat...

Re: Ask HN: What change in your programming technique has been most transformative?

#104
post #90

Voraciously eliminating unnecessary whitespace, especially vertical whitespace, was a trick I learned early. Most monitors are wide, not tall. When you can see a whole function without scrolling it's much easier to understand. I'll collapse 'if' statements to a single line in most cases to make it readable left-right instead of up-down. 1TB bracketing is my default unless style guidelines prohibit it. End-of-line com…

I’d argue you’re better off just getting two vertical monitors. Keeps the code easy to read (can see a lot more of it) without the negatives from one liners.

Re: Ask HN: What change in your programming technique has been most transformative?

#105

Avoiding cleverness at all costs. Simple code that is easy to both read and write without strong efforts to follow senseless DYI or take on abstraction for the sake of abstraction.

Can anyone give a specific example of code they've worked with that was "too clever"?

Based on my experience, if a coworker wanted to "avoid cleverness" I imagine we'd end up arguing over something like a for-loop versus a map, but such small code decision matter very very little in comparison to overall architecture, and where you place the "seams" in your system.

So I ask, when you have felt that code is "too clever", was it because someone used a map, but you're more comfortable with for loops, or was it bigger than that?

My first job was maintaining some PHP. The author didn't know what a function was. The code was a 5,000 line script, top to bottom, with basic control and looping logic nested up to 17 deep (I counted). It was horrible. Yet surely, the author had avoided cleverness at all costs; he had built a working system with only the most basic tools, those being all he knew.

Re: Ask HN: What change in your programming technique has been most transformative?

#106
Writing a basic test before starting a task, and use that to verify that the task is correct. I use the word task because this can apply outside of writing code, for example making some large scale changes to data. Never underestimate your ability to overestimate your ability. Reality is hard so make the machine help you.

Re: Ask HN: What change in your programming technique has been most transformative?

#107

Earlier quoted context omitted.

This is certainly not true. Evolution of programming languages is circumstantial . There are many flaws in all of the ones you had listed. The marginal cost of deprecating something or breaking something is higher than the incremental cost of workarounds. This happens all the time from the laryngeal nerve in Giraffe to the evolution of a programming language, say JavaScript. Please don’t mix good design with populari…

Look close enough and everything is flawed. Evolution doesn’t ‘design’ anything, least of all anatomy. The ‘special power’ is that they have stuck around, for whatever reason or circumstance.

I never claimed that evolution “designs” something. In fact, I’m talking about the opposite - Evolution has no hindsight. Therefore, the marginal cost of undoing something is larger than incrementally adding or bolting on fixes.

Re: Ask HN: What change in your programming technique has been most transformative?

#108
post #4

Recognizing that there's a special power in resilient technologies. Those that keep chugging along decade after decade, and getting stronger, too. Not from inertia or monopolist effects or other kinds of random lock-in. But because they tackle a certain set of fundamental problems very, very well. Despite endless complaints about their fundamental limitations, conceptual flaws or alleged lack of scalability. SQL, Pyt…

This is certainly not true. Evolution of programming languages is circumstantial . There are many flaws in all of the ones you had listed. The marginal cost of deprecating something or breaking something is higher than the incremental cost of workarounds. This happens all the time from the laryngeal nerve in Giraffe to the evolution of a programming language, say JavaScript. Please don’t mix good design with populari…

> The marginal cost of deprecating something or breaking something is higher than the incremental cost of workarounds.

So why are we in this python 2 to 3 mess?

Re: Ask HN: What change in your programming technique has been most transformative?

#110
post #81

Learning different programming paradigms. For example, logic programming with Prolog makes you think about solving certain problems quickly and efficiently in a declarative style. Strongly-typed functional languages like SML and OCaml make it easy to use types and pattern matching to reduce errors and shift some cognitive burden from yourself to the compiler. Lisps allow you to quickly prototype functions in the REPL…

>shift some cognitive burden from yourself to the compiler

This is the best way I've seen the advantages of static type checking articulated.

Post reply on HN