News for hackers. Stuff that matters.
Re:Starbucks CEO will work a shift at the company’s cafes on... by WalterBright on Thursday March 23, 2023 @02:28PM (#35279183)
The CEO can easily see problems that the line workers don't see as problems.

For example, I happily programmed in C for many years while not even noticing severe problems with the language. Later broader experience with other languages led me to wonder why I didn't see the problems with C before, even though they were negatively affecting my work.

Re:Starbucks CEO will work a shift at the company’s cafes on... by WalterBright on Thursday March 23, 2023 @03:00PM (#35279664)
For a small example:

    S s;
    S *p;
To read a field:

    s.field
    p->field
It turns out that there's no ambiguity in using `.` for both `.` and `->`. Both can be:

    s.field
    p.field
But what's the problem with `->`? It's when you want to refactor the code to switch between a value to a reference. If `.` is used for both, just change the typedef and maybe a couple places. With `.` and `->`, there are maybe thousands of tedious changes to make in the code base. The inevitable result of this is you're not going to attempt such a refactor, as it's too much work. The code stays in the way it was originally designed.

I was able to see this only via broader experience with other languages. I never even noticed the issue before.

C++ addressed this not by fixing it, but by introducing the reference type. But the C++ ref type brings along with it all kinds of new problems, which I won't get into here.

Re:Starbucks CEO will work a shift at the company’s cafes on... by fsckboy on Thursday March 23, 2023 @11:18PM (#35284657)
> switch between a value to a reference

your language is too sloppy for me, a pointer-to-a-struct contains a value (could say "is" a value), and some struct-members might resolve as values, but a switch from a struct to a pointer-to-a-struct is not a switch between a value and a reference; while you might call a pointer "a reference", a struct is never a value. Or did you mean a "dot" r-value and a "dereference to an" r-value? This all makes a difference because C is a call-by-value language, and you can't pass a struct, so it's an important distinction to maintain.

This kind of change might be something a student or newb might encounter, but an experienced C programmer is going to have a sense from the start whether to go with a static/local struct or a malloc'ed one. Maybe on more common a struct containing a struct might switch to a struct containing a pointer to another struct.

personally, I use hungarian and ps->x vs s.x is a nice reinforcement of what hungarian is trying to reinforce. Using parenthesis to illustrate a sort of precedence, I guess I associate the (pointer->) like that as opposed to the (.member) though I can't defend that as making an inordinate amount of sense :)

Re:Starbucks CEO will work a shift at the company’s cafes on... by WalterBright on Friday March 24, 2023 @03:56PM (#35294576)
> an experienced C programmer is going to have a sense from the start whether to go with a static/local struct or a malloc'ed one

In my and others' extensive experience in C, almost everyone is wrong about where their programs are consuming time. Profiling almost always produces surprising results. Being about to easily refactor programs to experiment with different data organizations is a superpower for a language.

C programs are difficult to refactor, and so they tend to persist with their earliest design decisions despite changing requirements and profile results.

Re:Starbucks CEO will work a shift at the company’s cafes on... by tshaddox on Thursday March 23, 2023 @03:10PM (#35279813)
The workers might be distracted by other problems that are literally impossible for the CEO to even simulate, like food insecurity, housing instability, looming medical bankruptcy, etc. I bet the CEO is able to be a much more productive barista without spending company time worrying about those things!
Re:Starbucks CEO will work a shift at the company’s cafes on... by WalterBright on Thursday March 23, 2023 @03:21PM (#35279971)
If the CEO is spending a shift working on the line, he still has all his CEO responsibilities to worry about. Those are 24/7, they never stop.
Re:Starbucks CEO will work a shift at the company’s cafes on... by afavour on Thursday March 23, 2023 @03:39PM (#35280200)
Of course of those problems become too much for the CEO they can always quit.
Re:Starbucks CEO will work a shift at the company’s cafes on... by fennecfoxy on Friday March 24, 2023 @12:30PM (#35291495)
Well for companies as large as Starbucks, I think most of those responsibilities come down to picking the nicest place for a three martini lunch.
Re:Starbucks CEO will work a shift at the company’s cafes on... by bakugo on Thursday March 23, 2023 @03:31PM (#35280088)
Never underestimate the average HN user's ability to come up with an excuse to bring up stupid C/C++ vs Rust arguments in the comments of any post, no matter how unrelated.
Re:Starbucks CEO will work a shift at the company’s cafes on... by WalterBright on Thursday March 23, 2023 @03:56PM (#35280441)
I didn't mention Rust.
Re:Starbucks CEO will work a shift at the company’s cafes on... by jeffrallen on Thursday March 23, 2023 @04:03PM (#35280524)
Nor D. :)
Re:Starbucks CEO will work a shift at the company’s cafes on... by stuaxo on Thursday March 23, 2023 @10:11PM (#35284193)
The CEO has the same advantage a new person has coming onto the job and seeing problems.

As soon as you have been in a place 3 or 6 months you are used to all the workarounds and the reasons why things can't be done.