| ▲ | saurik 14 hours ago |
| I compile a lot of C++ code from a lot of places, and the only time I run into code that somehow simply doesn't work on newer versions of C++ and where the developers aren't even sure if they will accept any patches to fix the issue as they claim it "isn't supported" to use a newer version of C++--even for the public headers of a library--is, you guessed it: code from Google. Meanwhile, most of the C++ code from Google seems to be written in some mishmash of different ideas, always at some halfway point along a migration between something ancient and something passable... but never anything I would ever dare to call "modern", and thereby tends to be riddled with state machines and manual weak pointers that lead to memory corruption. So... I really am not sure I buy the entire premise of this article? Honestly, I am extremely glad that Google is finally leaving the ecosystem, as I generally do not enjoy it when Google engineers try to force their ridiculous use cases down peoples' throats, as they seem to believe they simply know better than everyone else how to develop software. Like... I honestly feel bad for the Rust people, as I do not think the increasing attention they are going to get from Google is going to be at all positive for that ecosystem, any more than I think the massive pressure Google has exerted on the web has been positive or any more than the pressure Google even exerted on Python was positive (not that Python caved to much of it, but the pressure was on and the fact that Python refused to play ball with Google was in no small part what caused Go to exist at all). (FWIW, I do miss Microsoft's being in the space, but they honestly left years ago -- Herb's existence until recent being kind of a token consideration -- as they have been trying to figure out a tactical exit to C++ ever since Visual J++ and, arguably, Visual Basic, having largely managed to pivot to C# and TypeScript for SDKs long ago. That said... Sun kicking Microsoft out of Java might have been really smart, despite the ramifications?) |
|
| ▲ | DanielHB 3 hours ago | parent | next [-] |
| > code from Google. I spilled my coffee, I was just talking the other day to some coworkers how I don't trust google open source. Sure they open their code but they don't give a damn about contributions or making it easy for you to use the projects. I feel a lot of this sentiment extends to GCP as well. So many google projects are better than your average community one, but they never gain traction outside of google because it is just too damn hard to use them outside of google infra. The only Google project that seems to evade this rule that I know of is Go. |
| |
| ▲ | humanrebar 2 hours ago | parent | next [-] | | Googletest is the most widely used test library for C++. Googlemock is the only mocking library available that's reasonably feature complete. | | |
| ▲ | bluGill 22 minutes ago | parent | next [-] | | I you are using googletest, you owe it to yourself to check out catch2 which I find much better and uses modern C++. There are a few other test frameworks in C++ that look better than google test as well, but catch2 is the one I settled on (and seems to be the best supported): feel free to check them out. I've given up on mock frameworks. They make it too easy to make an interface for everything and then test that you are calling functions with the expected parameters instead of the program works as you want. A slight change to how I call some function results in 1000 failed tests and yet I'm confident that I didn't break anything the user could notice (sometimes I'm wrong in this confidence - but none of the failing tests give me any clue that I'm wrong!) | |
| ▲ | gpderetta 25 minutes ago | parent | prev [-] | | Google test and mock are quite powerful but are a big hit at both compile time and runtime, which matters for quick edit-compile-fix loops. I still go back and forth on whether google test and mock are worth it. Google benchmark is also nice. |
| |
| ▲ | badpun 2 hours ago | parent | prev [-] | | Tensorflow is/was decent. It looked like they made a lot of effort for it to be accessible for outsiders. | | |
| ▲ | th2oi34234234 2 hours ago | parent [-] | | Have you tried building the damn thing ? Nix build is still stuck in the one from 3-4 y back because bazel doesn't play well. Debian too has some issues building the thing... |
|
|
|
| ▲ | pjmlp 6 hours ago | parent | prev | next [-] |
| The issue with Microsoft until recently, has been the power of WinDev, which are the ones responsible for anything C++ on Microsoft dungeons. Hence the failure of Longhorn, or any attempt coming out from Microsoft Research. Ironically, given your Sun remark, Microsoft is back into the Java game, having their own distribution of OpenJDK, and Java is usually the only ecosystem that has day one parity with anything Azure puts out as .NET SDK. |
| |
| ▲ | quietbritishjim 6 hours ago | parent [-] | | What is "WinDev"? A quick search didn't turn up much except a French Wikipedia article. | | |
| ▲ | pjmlp 5 hours ago | parent [-] | | Windows Development, per opposition to DevDiv, Developer Division. Two quite common names in the Microsoft ecosystem. | | |
| ▲ | loup-vaillant 4 hours ago | parent [-] | | For a moment there I thought you were referring to this trademark: https://pcsoft.fr/windev/index.html Which was known at a time for having young women in light clothing in their marketing material. | | |
| ▲ | jcelerier 2 hours ago | parent [-] | | aha, that's the windev that comes to mind too. I didn't know they were actually a french company, wild that they're still around... their ads were plastered everywere in the 2000s. Apparently they have a programming language for which you can "one-click-switch" between english and french for the keywords??? https://pcsoft.fr/windev/ebook/56/ | | |
| ▲ | voidfunc 2 hours ago | parent [-] | | That's actually kind of neat, also I love how the brochure uses the American flag for English... | | |
| ▲ | xbar 10 minutes ago | parent [-] | | Yes. I would have preferred that they had used Canadian flags for both. |
|
|
|
|
|
|
|
| ▲ | vinkelhake 12 hours ago | parent | prev | next [-] |
| > Honestly, I am extremely glad that Google is finally leaving the ecosystem, as I generally do not enjoy it when Google engineers try to force their ridiculous use cases down peoples' throats, as they seem to believe they simply know better than everyone else how to develop software. Well, you may be celebrating a bit prematurely then. Google still has a ton of C++ and they haven't stopped writing it. It's going to take ~forever until Google has left the C++ ecosystem. What did happen was that Google majorly scaled down their efforts in the committee. When it comes to the current schism on how to improve the safety of C++ there are largely two factions: * The Bjarne/Herb [1] side that focuses on minimal changes to the code. The idea here is to add different profiles to the language and then [draw the rest of the fucking owl]. The big issue here is that it's entirely unclear on how they will achieve temporal and spatial memory safety. * The other side is represented by Sean Baxter and his work on Safe C++. This is basically a whole-sale adoption of Rust's semantics. The big issue here is that it's effectively introducing a new language that isn't C++. Google decided to pursue Carbon and isn't a major playing in either of the above efforts. Last time I checked, that language is not not meant to be memory safe. [1] https://github.com/BjarneStroustrup/profiles
[2] https://safecpp.org/draft.html |
| |
| ▲ | pjmlp an hour ago | parent | next [-] | | People like to always talk about Carbon like that, yet the team is the first to point out anyone that can use something else, should. Carbon is an experiment, that they aren't sure how it is going to work out in first place. > "If you can use Rust, ignore Carbon" https://github.com/carbon-language/carbon-lang/blob/e09bf82d... > "We want to better understand whether we can build a language that meets our successor language criteria, and whether the resulting language can gather a critical mass of interest within the larger C++ industry and communit" https://github.com/carbon-language/carbon-lang/blob/e09bf82d... | |
| ▲ | IAmLiterallyAB 20 minutes ago | parent | prev [-] | | > Herb side that proposes minimal changes Herb is developing a whole second syntax, I wouldn't call that minimal changes. And probably the only way to evolve the language at this point, because like you said Sean is introducing a different language entirely, so its not C++ at that point. I really like some of Herb's ideas,but it seems less and less likely they'll ever be added to C++ | | |
| ▲ | darknavi 6 minutes ago | parent [-] | | Have you seen some of his recent talks? Lots of underpinnings of cppfront have been added or are in committy. He compares it to the JS/TS relationship. |
|
|
|
| ▲ | andai 43 minutes ago | parent | prev | next [-] |
| I am out of the loop, what kind of pressure were they putting on Python? |
|
| ▲ | throwaway2037 13 hours ago | parent | prev | next [-] |
| > riddled with state machines
Why is this bad? Normally, state machines are easy to reason about. |
| |
| ▲ | majormajor 13 hours ago | parent | next [-] | | The set of developers who say "I want to implement this logic as a state machine" is MUCH larger than the set of developers who say "I should make sure I fully understand every possible state and edge case ahead of time before making a state machine!" | | |
| ▲ | kayo_20211030 21 minutes ago | parent | next [-] | | I have a coding problem. I'll use a state machine! Now, I have two problems :-( | |
| ▲ | throwaway2037 12 hours ago | parent | prev [-] | | Couldn't this be said about any alternative solution? I fail to see how this is specific to state machines. What do you suggest instead of a state machine? | | |
| ▲ | bvrmn 4 hours ago | parent [-] | | Like properly model a domain in domain terms? | | |
| ▲ | nottorp 3 hours ago | parent [-] | | And that won't be a state machine with the states having more fancy names? | | |
| ▲ | InDubioProRubio 2 hours ago | parent [-] | | It will be, but the idea of having an overview over the states is gone then. There is just modules-> objects with the transitions being method calls. Nobody will have to know all the things about all the state transitions, resulting in another problem (dys)solved by architecture obscurity. If needs be the state-machine can be reconstructed on a whiteboard by a team of five. |
|
|
|
| |
| ▲ | risenshinetech 13 hours ago | parent | prev | next [-] | | Please describe "normally". State machines can turn into nightmares, just like any design pattern used poorly. | |
| ▲ | nurettin 9 hours ago | parent | prev | next [-] | | State machines don't have syntax for "transition here when event is encountered no matter what state you are in" so the whole diagram becomes a spaghetti mess if you have a lot of those escape hatches. | | |
| ▲ | lelanthran 2 hours ago | parent | next [-] | | > State machines don't have syntax for "transition here when event is encountered no matter what state you are in" so the whole diagram becomes a spaghetti mess if you have a lot of those escape hatches. I place a note at the top of my diagrams stating what the default state would be on receipt of an unexpected event. There is no such thing as "event silently gets swallowed because no transition exists", because, in implementation, the state machine `switch` statement always has a `default` clause which triggers all the alarm bells. Works very well in practice; I used to write hard real-time munitions control software for blowing shit up. Never had a problem. | | |
| ▲ | rramadass an hour ago | parent [-] | | > hard real-time munitions control software for blowing shit up. Never had a problem. Ha, Ha, Ha! The juxtaposition of these two phrases is really funny. I would like to apply for a position on the Testing team :-) |
| |
| ▲ | quietbritishjim 5 hours ago | parent | prev | next [-] | | State machines don't have a native syntax in C++ at all, so you can structure them however you want. It's easy to structure a state machine, if needed, so that all (or some) states can handle the same event in the same way. | |
| ▲ | liontwist 3 hours ago | parent | prev | next [-] | | goto is exactly this feature. | |
| ▲ | a_t48 9 hours ago | parent | prev [-] | | I believe HSMs can model this, but don't quote me. :) | | |
| ▲ | nurettin 8 hours ago | parent [-] | | Yes, of course in theory nested state machines should be able to model this. I feel like adding more complexity and bending the rules is a bit of a concession. | | |
| ▲ | jeffreygoesto 5 hours ago | parent [-] | | Back in the days we implemented HSM helper classes in about 500 LoC and generated them from Enterprise Architect. No need to write a GUI yourself, but better to have a visual for documentation and review. Worked very well until we replaced EA with docs-as-code, now I miss that there is no nice simulator and Modeler for that workflow. |
|
|
| |
| ▲ | AnimalMuppet 13 hours ago | parent | prev [-] | | They can be. Or they can be... less easy. Imagine you have an informally-specified, undocumented, at-least-somewhat-incomplete state machine. Imagine that it interacts with several other similar state machines. Still easy to reason about? Now add multithreading. Still easy? Now add locking. Still easy? Cleanly-done state machines can be the cleanest way to describe a problem, and the simplest way to implement it. But badly-done state machines can be a total mess. Alas, I think that the last time I waded in such waters, what I left behind was pretty much on the "mess" side of the scale. It worked, it worked mostly solidly, and it did so for more than a decade. But it was still rather messy. | | |
| ▲ | lelanthran 9 hours ago | parent | next [-] | | > Imagine you have an informally-specified, undocumented, at-least-somewhat-incomplete state machine. Imagine that it interacts with several other similar state machines. Still easy to reason about? You think that developers that wrote an informally-specified, undocumented, at-least-somewhat-incomplete state-machine would have written that logic as a non-state-machine in a formally-specified, documented and at-least-somewhat-complete codebase? State-machines are exceptionally easy to reason about because you can at least reverse-engineer a state-diagram from the state-machine code. Almost-a-state-machine-but-not-quite are exceptionally difficult to reason about because you can not easily reverse-engineer the state-diagram from the state-machine code. | | |
| ▲ | gpderetta 21 minutes ago | parent [-] | | In fact state machines are great for documentation even if the code is not explicitly written as a state machine! |
| |
| ▲ | rramadass 9 hours ago | parent | prev [-] | | But that is just true of any problem-solving/programming technique. In general, state/event machine transition table and decision table techniques of structuring code are easier to comprehend than adhoc and even worse, poorly understood pattern-based techniques are. |
|
|
|
| ▲ | 5 hours ago | parent | prev | next [-] |
| [deleted] |
|
| ▲ | protomolecule 2 hours ago | parent | prev | next [-] |
| > riddled with state machines What's wrong with state machines? Beats the tangled mess of nested ifs and fors. |
| |
| ▲ | bluGill 17 minutes ago | parent [-] | | That depends on your problem. I've seen useful state machines. I've seen someone implement a simple decoder as a complex any-to-any state machine that couldn't be understood - a single switch statement would have been better. Nothing about state machines, but some people have a hammer and are determined to prove it can drive any screw - it works but isn't how you should do it. |
|
|
| ▲ | returningfory2 11 hours ago | parent | prev | next [-] |
| I think the article is pretty interesting. There are so many more interesting takes than just another boring Hacker News moan about Google. |
|
| ▲ | pif 6 hours ago | parent | prev | next [-] |
| Google has such proficient programmers that they had to invent a language for dummies (Go) for them not to get lost. The farther they step from languages for professionals, the better! |
| |
| ▲ | guappa 3 hours ago | parent | next [-] | | And then they were so unproficient that they made a terrible language that has the same amount of safeguards as C (ok a bit more, but not much more). | |
| ▲ | pif 3 hours ago | parent | prev [-] | | [flagged] | | |
| ▲ | zozbot234 3 hours ago | parent [-] | | Golang is a great programming language if your alternative is Java, C# or scripting languages like Python/Ruby/etc. Not everything needs to be written in C++ or Rust from the outset. It's also reasonably possible to rewrite small codebases from Golang to, e.g. Rust for better performance. | | |
| ▲ | guappa 3 hours ago | parent [-] | | It really isn't, no. It joins an awkward syntax with bad API design and terrible safeguards. | | |
|
|
|
|
| ▲ | trmantrl an hour ago | parent | prev [-] |
| The technical pressure exerted on Python (which was resisted) is one thing. The social pressure incubated the most radical culture warriors the Internet has ever seen and its proponents have ruined the Python organization, driven away many people and have established a totalitarian and oppressive regime. Interestingly, Google has fired the Python team this year. The revolution eats its own? Anyway, Rust should take note and be extremely careful. |