6 ms·
Reminds me of a C++ codebase I once had to inspect that was entirely written as if it were written in Java. With camelcase naming for everything, getters and se
by gpuhacker 2y ago
Reminds me of a C++ codebase I once had to inspect that was entirely written as if it were written in Java. With camelcase naming for everything, getters and setters for every class variable, interfaces everywhere.
- bpye 2y agoGood job they weren't using MSVC I guess... https://learn.microsoft.com/en-us/cpp/cpp/property-cpp?view=msvc-170 https://learn.microsoft.com/en-us/cpp/cpp/property-cpp?view=...
- jart 2y agoYou ain't seen nothin. Check out the bourne shell source code from unix seventh edition. https://minnie.tuhs.org/cgi-bin/utree.pl?file=V7/usr/src/cmd/sh/word.c https://minnie.tuhs.org/cgi-bin/utree.pl?file=V7/usr/src/cmd... I can't believe it's not ALGOL.
- teruakohatu 2y agoWow, I was not expecting that! Was this style of C common back then? Before he wrote the Bourne shell the author wrote an ALGOL compiler, and ALGOL inspired Bourne syntax: https://en.wikipedia.org/wiki/ALGOL_68C https://en.wikipedia.org/wiki/ALGOL_68C
- pasc1878 2y agoThere were article suggesting #define BEGIN { and #define end }; to make C look more like Pascal. I think in Europe C was not as common as other languages at the time so the terseness looked odd.
- pavlov 2y agoAlso because the special characters were (and are) difficult to type on European keyboards. Characters like []{}\|~ are behind multi-finger access and often not printed at all on the physical keys (at least in the past). You can see how this adds a hurdle to writing C… Pascal was designed by a European, so he preferred keywords which could be typed on every international keyboard. C basically just used every symbol from 7-bit ASCII that happened to be on the keyboards in Bell Labs.
- smatija 2y agoJust as example, on my slovenian QWERTZ layout: [ - altgr+f, ] - altgr+g, { - altgr+b, } - altgr+n, \ - altgr+q, | - altgr+w, ~ - altgr+1. You get used to them, though you start feeling like a pianist after a short coding session. The one most annoying for me are the fancy javascript/typescript quotes, which I have to use all too often: ` - altgr+7.
- ulbu 2y agoToday I learned that there exist people who use non-US layouts when coding. That’s spectacular!
- pavlov 2y agoHow did you think people outside the US learn programming?
- anthk 2y agosetxkbmap us -option ctrl:swapcaps -option compose:rwin Problem solved. US layout, and with the right Window keys you can compose European characters.
- pavlov 2y agoThere’s so many assumptions here about a person who’s starting to learn programming. For starters, that they’re on Linux, they feel comfortable running complex CLI commands, they can memorize the U.S. layout just like that, and that they can type without looking at the physical keys (because changing the virtual mapping means keys produce something else than what the label says). In reality, the learner’s first exposure to C family languages is more likely to be a website where you can run some JavaScript in a text box. And the first hurdle is to figure out how to even type {}. American developers just completely forget about that.
- 2y ago
- froh 2y agohttps://minnie.tuhs.org/cgi-bin/utree.pl?file=V7/usr/src/cmd/sh/mac.h https://minnie.tuhs.org/cgi-bin/utree.pl?file=V7/usr/src/cmd... wow. thanks for this gem.
- worstspotgain 2y ago> camelcase naming for everything, getters and setters for every class variable, interfaces everywhere This is not far off from the guidelines in many cases, e.g. Windows code (well, not every variable of course.) A lot of Java design was copied from C++.
- pasc1878 2y agoI had that as well but also Java passes strings in as f(String *) so the C++ code was f(new String("Hello")
- rauli_ 2y agoI've seen similar codebases as well written by people who have spent way too much time with Java. One even had it's own String class which was just a wrapper for std::string with Java-like methods.
- shortrounddev2 2y agoI think that's just OOP