HN user

bitfield

335 karma
Posts98
Comments37
View on HN
www.construction-physics.com 1y ago

Building Apollo

bitfield
13pts1
blogsystem5.substack.com 1y ago

Code Reviews: A Success Story

bitfield
2pts0
jarosz.dev 1y ago

How to Handle Go Security Alerts

bitfield
15pts0
bitfieldconsulting.com 1y ago

A Career Ending Mistake

bitfield
2pts0
bitfieldconsulting.com 1y ago

Will Write for Food

bitfield
1pts0
bitfieldconsulting.com 1y ago

Rust error handling

bitfield
47pts61
github.com 3y ago

A ChatGPT client with audit logging

bitfield
2pts0
bitfieldconsulting.com 3y ago

Declaring/Initializing Golang Maps

bitfield
1pts0
www.apimatic.io 3y ago

Golang’s Simplicity Brings Complexity

bitfield
5pts2
www.zackproser.com 3y ago

Setting up passwordless sudo with Yubikey

bitfield
2pts2
www.gq.com 3y ago

A man who spent 10k days alone in the woods

bitfield
3pts0
thebulletin.org 3y ago

Our climate may already have reached an irreversible tipping point

bitfield
30pts7
inference-review.com 3y ago

The next giant leap backwards for physics (2020)

bitfield
3pts1
bitfieldconsulting.com 3y ago

Why does code review suck so badly? What can we do?

bitfield
1pts0
github.com 3y ago

Morningpost: A simple RSS feed reader in Go

bitfield
1pts0
bitfieldconsulting.com 3y ago

Optimizing code for performance is usually a waste of time

bitfield
2pts0
inference-review.com 3y ago

'The nightmare scenario': where does physics go from here? (2017)

bitfield
3pts0
aeon.co 3y ago

Radioactive deer still roam Long Island decades after US 'doomsday' experiment

bitfield
3pts0
bitfieldconsulting.com 3y ago

Go has a shell-like DSL for writing tests

bitfield
11pts0
github.com 3y ago

'script' is for writing shell-like pipelines in Go

bitfield
1pts0
bitfieldconsulting.com 3y ago

Thy code shalt be boring

bitfield
26pts9
www.zackproser.com 3y ago

The Bubbletea (TUI) State Machine Pattern

bitfield
2pts0
bigthink.com 3y ago

A “theory of everything” may never be found

bitfield
3pts0
bitfieldconsulting.com 3y ago

Programming with Kindness

bitfield
2pts0
theconversation.com 3y ago

Historically, ideological purity spirals rarely end well

bitfield
5pts0
www.wired.com 3y ago

The first open-plan office was a hellscape (1999)

bitfield
4pts0
bitfieldconsulting.com 3y ago

If you don’t take control of your time, someone else will

bitfield
2pts0
medium.com 3y ago

Surviving my first week as a new developer

bitfield
1pts0
zackproser.com 3y ago

Terminal Velocity: how to get faster as a developer

bitfield
2pts0
bitfieldconsulting.com 3y ago

Don't write clean code, write CRISP code

bitfield
157pts167

"While we could usually write the specific code we needed for a particular program, before Go generics it wasn’t easy to write functions on arbitrary container types, such as slices.

For example, we couldn’t write a function that takes a slice of arbitrary type and determines whether the slice contains a given element. Instead, we had to write a function that takes some specific type, such as []int, or []string.

But this is dull, because the logic is exactly the same, whatever the type of the slice element. And now we can write that function just once, for all types. Let’s try."

What problem does 'defer' solve? When should we use it? How does it interact with named results? What's the use of deferring a closure? Is it okay to write naked returns?

Tests communicate a lot of information, to readers, other developers, and even our future selves. Well-written tests focus on a single unit of behaviour that can be described in a brief sentence, and we can use that sentence as the name of the test.

“If you get fired as a result of applying the advice in this book, then that’s probably for the best, all things considered. But if it happens, I’ll make it my personal mission to get you a job with a better company: one where people are rewarded, not punished, for producing software that actually works.”

"First, it's really important to say that both Go and Rust are absolutely excellent programming languages. They're modern, powerful, widely-adopted, and offer excellent performance. You may have read articles and blog posts aiming to convince you that Go is better than Rust, or vice versa. But that really makes no sense; every programming language represents a set of trade-offs. Each language is optimised for different things, so your choice of language should be determined by what suits you and the problems you want to solve with it.

In this article, I'll try to give a brief overview of where I think Go is the ideal choice, and where I think Rust is a better alternative. I'll also try to give a flavour of the essential nature of both languages (the Tao of Go and Rust, if you like)."

https://bitfieldconsulting.com/golang/rust-vs-go

‘For the Love of Go’ is a book introducing the Go programming language, suitable for complete beginners, as well as those with experience programming in other languages.

This completely revised and updated edition includes the four mini-books previously released as ‘Fundamentals’, ‘Data’, ‘Behaviour’, and ‘Control’, plus for the first time complete solutions (with tests) to all the coding challenges in the book.

Throughout the book we'll be working together to develop a fun and useful project in Go: an online bookstore called Happy Fun Books!

Each chapter introduces a new feature or concept, and sets you some goals to achieve, with complete, step-by-step explanations of how to solve them, and full code listings with accompanying tests.

There are 24 chapters, and 215 pages (depending on the screen size of your ebook reader).

By reading this book and working through all the challenges and exercises, you'll learn:

How to write tests in Go and how to develop projects test-first

How to manage data in Go using built-in types, user-defined struct types, and collections such as maps and slices

How to use objects to model problems in Go, and how to add behaviour to objects using methods

How to use pointers to write methods for objects, and how to use types and validation to make your Go packages a delight to use

How to build powerful, flexible programs using control structures like loops and functions

Even more importantly, you’ll learn a simple, fun, and effective way to approach software engineering projects in Go. Even though the material is beginner-friendly, you’ll be mastering intermediate and advanced techniques such as test-driven development (TDD) and learning to design modules, packages, and APIs. These are essential skills in any modern software engineering role.

Interview by Bill Kennedy of Ardan Labs, for the Ardan podcast:

"John Arundel is a software consultant, mentor, and author of the book “For the Love of Go”. We talk about his early fascination with computers, the role his mother played in planting these seeds, and the steps he took in his younger years to follow his passion. We then explore John’s indirect job path, having to settle for work as a technical writer out of college and stumbling into IT and system administration. But the major lesson that comes out of this is that these 'detours' actually served John's later work, developing parts of his expertise that would aid him in his writing and mentoring."

What Is Time? 5 years ago

It's tempting to think that 'speed' (actually acceleration) causes time to flow at different rates for observers in different frames, but this isn't really the case. Time flows at the same rate for everybody: one second per second. However, if I meet you at an agreed rendezvous next week and one of us has accelerated in the meantime, we'll find our clocks no longer agree. We took different trajectories through spacetime to reach the same event, so our histories are of different lengths.

Rust vs. Go 6 years ago

Go is more likely to get the job done, Rust is more likely to do the job well

That's surprisingly close to what one of my contributors wrote in the piece:

My take: Go for the code that has to ship tomorrow, Rust for the code that has to keep running untouched for the next five years.

Rust vs. Go 6 years ago

Not sure what you mean by 'folklore' in this context. There's a lot of discussion in the piece about memory safety, garbage collection, build performance, and so forth. Don't you think that's engineering, or at least engineering-adjacent?

Rust vs. Go 6 years ago

Me too! You'll have noticed that that's exactly the structure of my article: which problems is Rust a better choice for, and which problems suit Go. It's intended to help people just like you, who want to pick a tool based on the problem they're trying to solve, rather than tribalism.

Rust vs. Go 6 years ago

Well, no one is claiming that it's impossible to write Rust or Go programs that have security vulnerabilities—that would be a very silly thing to claim, wouldn't it?

A more useful way to think about it might be to ask whether such languages make vulnerabilities less likely, and for certain types of vulnerability (buffer overflows, for example), they absolutely do.

Rust vs. Go 6 years ago

Well, the problem with that is that not everyone would agree on that way of classifying languages _either_! And people do want to know what the differences are between Go and Rust, as they're so often mentioned in the same breath. I think the comparison is valid (whether you agree with it is another question).

Rust vs. Go 6 years ago

Well, the point is that which language you choose depends on what you want to do with it, and it's impossible to say objectively that one language is "better" than another. If you ask me which one I _like_ more, that's a totally different question, but no one cares what the answer is.

This depends on the context, though. In my open source projects, I have many contributors, so it's important to maintain a consistent style throughout (for example, naming conventions, so that the same data is always called the same thing).

A commercial software project will also have a 'house style' which all contributors are required to follow. It's okay to withhold approval on this basis.

What I think you're saying, and I agree with it, is "don't withhold approval just because this isn't your style".