6 ms·
Your IDE can check your syntax. For people who have to switch between languages regularly, precise syntax memorization is difficult and a waste of time.
by smt88 5y ago
Your IDE can check your syntax. For people who have to switch between languages regularly, precise syntax memorization is difficult and a waste of time.
- MrDresden 5y agoWhile I understand where you are coming from, I disagree. IDE tools are great performance enhancers, but they can also be crutches. I would always expect a professional software developer to be able to parse some code on a page and point out its syntax errors (as well as suggest edits). edit; here I am thinking about something more substancial then just a missing ';' or a lack of a closing "
- deleted 5y ago[deleted]
- megous 5y agoLet's use (C++) something not common, but not all that crazy: bool x = false; x ||= something(); How many multi-lingual programmers will remember which one of the 7 languages they know does have a boolean assignment operators and which do not without looking it up? Does that make them unprofessional? How many do remember exact operator precedence rules for all those languages, when in practice you may need just the basic ones and use () to work around the lack of exact knowledge. Also which version? Something not working in PHP 7.3 may be ok in PHP 8, but company wants you to code in PHP 7.3, or ES5. In practice you get quickly acclimatized to any of the languages you know after working with them for a few days or a week, but good luck remembering exact rules of any of them at any given time when asked.
- HWR_14 5y agoYou're not mentioning or alluding to the one obvious syntax error. I don't know how to spoiler it so I will say there is an issue on the second line that, again repeating, I don't know how to call out. And yes, I work in multiple languages.
- leetcrew 5y agoalso if you can't spot that error, you might not realize a subtle, yet important, detail about that line (if written correctly). contrary to what you might expect, it cannot short-circuit the way || does, leading to possible performance or even correctness issues.
- HWR_14 5y agoThis is very true. I hope that people are not using the short-circuit feature in a way that impacts correctness! I would have an issue with that code for trying to be too clever even if there were no bugs and it worked well. Performance issues, on the other hand, I can see accidentally arising.
- bryondowd 5y agoI see short-circuit for correct behavior all the time, most frequently in the format: if (pointer && pointer->member == value) Where you want to make sure a pointer you've been given isn't null before you try to dereference it. Without short-circuit, this becomes a segfault.
- HWR_14 5y agoYes, the "and" pattern is common. I've seen plenty of "ensure this exists before operating on it" chains, where it even goes if ( pointer && pointer->otherPointer && pointer->otherPointer->member == value ) I've never seen someone use an "or" pattern in a non-confusing way. That is, I've seen "and" patterns that act as a safety/early out. I fail to see the use of an "or" pattern where you want to stop executing if the first value is true (ignoring using nots to invert the logic of an and pattern, and I would criticize that).
- lucumo 5y agoThat boolean assignment operator was addressed. Whether or not C++ has them (it doesn't) is exactly the point of that code snippet. They do exist in other languages. ES has it in exactly that form. Java has it in the |= form, not to be confused with the bitwise OR of the same form. Whether or not these short-circuit is not all that interesting for most boolean logic. (Though it can be useful to know if these are used as hacky error-handling and default-setting. It depends on how you read "something" whether or not that's going on here.)
- AdrianB1 5y agoHow many of the multi-lingual programmers that know 7 languages are really good in all 7? As an interviewer and hiring manager I am more impressed of people than know 2, max 3 languages very well than 7 at an intermediate level.
- AnIdiotOnTheNet 5y agoI think you overestimate the value of being super intimate with any given language. Pretty much no language in common use is so different from the others that you drastically have to change how you express any given thing you're trying to do. Knowing concepts and when and how to apply them is more important in my considered opinion.
- Frost1x 5y agoIn my opinion, if you're hiring for an expert in a specific language, you're not hiring a software engineer, you're hiring X language developer or X language software engineer. The language needs to be explicit in the position listing and perhaps even job title. That's fine if that's what you want but be specific about it so you don't waste people's time looking for a language specialist when most people anymore are generalists that have all sorts of knowledge distributions for any given set of technologies but can most likely adapt and learn to fit your distribution of technology given just a bit of time and opportunity. Modern development requires juggling too many technologies for most people to specialize in a single language unless their career goal is to niche themselves to that language.
- megous 5y agoSomeone doing webdev fullstack for more than 10-15 years will know at minimum ES + (PHP/Python/Ruby/Java/Go...) + SQL + HTML/CSS and a few utility languages. So at least 4. If you combine webdev with something low level/embedded, you need at least one systems language, so you're at 5 languages you need to be proficient in. Add one hobby language or a second web backend or systems language, and you're at 6 major languages. 7 is a lot. But 5 is plausible to be proficient in for someone who switches between webdev and lowlevel stuff to not burn out, or has a FOSS hobby.
- beberlei 5y agoYes! Because the IDE cannot help in Github Pull Request reviews for example.
- rendall 5y agoIf a company did not run automatic tests and lints on whatever they felt was important to have when merging to production, to the fullest extent possible, I would stop everything and write those. This leaves reviewers free to focus on the intangibles: architecture, expressiveness, logic and data flow, and so on.
- RHSeeger 5y agoIn my experience, Pull Requests aren't about catching syntax errors... the build will fail if there's errors like that. Rather, a Pull Request, and the code review involved, is about the underlying logic of the code; both with what it's doing it and how it's doing it.
- smt88 5y ago> they can also be crutches Yes, they are absolutely crutches. All great tools, libraries, and abstractions are crutches. I want programming to be easier for myself and my employees. The only problem with a crutch is that you might end up not having it when you need it. That's not an issue in this case. > here I am thinking about something more substancial then just a missing ';' or a lack of a closing " The original example that I was responded to was about an interviewer who expected their code to compile. That would include incredibly pedantic things. For example, if you're the kind of person who uses single quotes in JavaScript and then you're suddenly writing a different language where '' is different from "" and `` and $"" and whatever, you could easily make an unimportant mistake that prevents compiling.
- Piskvorrr 5y agoAn IDE can check your syntax, sure. It can even catch low-level bad practices ("you're making a database call in a tight loop, this is horribly inefficient"). This is, in my opinion, basic tool usage: warn of LHF early. Last time I saw one of those test-ish pieces of code, though, an IDE+static analysis would have caught about 1/2 of the problems; the other half required actual thinking (not statistical pattern matching, aka AI): "don't trust user data, that should not go there even though the call signature matches, you're holding it backwards."
- smt88 5y ago> "don't trust user data, that should not go there even though the call signature matches, you're holding it backwards." Good type systems do this, although it's beside the point. The point I was making is that the IDE remembers unimportant things so that my only concern is the actual thinking part. It abstracts away the minor and sometimes very important syntax differences.
- DougBTX 5y agoI don't buy that argument, as a programmer you have to write out code following a precise syntax all the time. Programming would be insanely tedious without knowing correct syntax. Having said that, if someone came up with an interview test which used especially esoteric parts of the language in unconventional ways and then asked to spot the errors, the could be a dubious question.
- smt88 5y ago> as a programmer you have to write out code following a precise syntax all the time When did I claim that the IDE absolves you of needing to know the syntax? It doesn't. But between autocomplete, hinting, linting, and any other static analysis, it makes it close to painless to switch between languages without making horrifying mistakes. The top-tier JetBrains IDEs (IntelliJ and Rider come to mind) will even tell you ways to make your code more efficient or modern, like changing a bunch of if/else to pattern matching. Why should I have to remember the full truthiness table of JavaScript? Why should I have to remember what all the different string delimiters do in every language? It's not important. My IDE can (and does) know that I'm trying to do some kind of string interpolation and will just fix it for me.
- kragen 5y agoYour IDE can tell you if your syntax failed to represent any valid program. It can't tell you if your syntax represents the wrong valid program. If you can't even spot invalid syntax, you have no hope of spotting bugs, because you can't read what the code says. Which turns out, contrary to your beliefs, to be important for many purposes. That doesn't mean you can't debug. You can step through the code step by step in the debugger, or add more and more logging around the bug, until you figure out which expression has a meaning unintended by its author. But that means that, if we're working in a language someone knows well, you're likely to spend hours debugging a problem that they can just see immediately when they're reviewing a merge request. That's an orders-of-magnitude difference in productivity when it's important for code to be correct, precisely due to what you call "precise syntax memorization". Most of programming isn't writing code. It's reading code. It's possible to go overboard with this. There are other skills that are more important than being able to look at some code and immediately see what it means. There are excellent programmers with severe dyslexia who will just never be able to do this. But it's foolish to think that gaining this skill is "a waste of time" for those who can. There are languages I've used where I don't know the syntax that well. PHP, Ruby, x86 assembly, OCaml. There are languages where I know the common syntax well, but there are plenty of obscure corners of the syntax that I don't: C++, Perl, bash. But I regularly switch between C, Python, and JS, and I'm pretty confident that I know their syntax, as well as numerous other languages like Tcl, Lua, Prolog, PostScript, and arguably Scheme and Elisp, which I don't use regularly but still wouldn't have any trouble spotting syntax errors.
- handrous 5y agoI'd struggle to code a five-line program that'd compile in languages I've written tens of thousands of lines of code in, in Notepad, that'd actually compile & run on the first try. I might fail that in a language I was writing last week. I mean, I might manage it, but it'd be sheer luck. Decent chance I forget, in the moment and under pressure and without examples to crib off of, IDE support, or the ability to check the manual, the correct way to do comparisons for all types, even, or basic stuff like how to print to the console or what this language's sugar for a "for-each" is, or whether it has such sugar. Reading input? The right calls for file IO? Anything more complicated than that? Oh god, there's no way. Luckily I never fucking ever have to do that in my actual job. If I did, I might well get good at it. Since I don't, I... don't. I also haven't gotten much better at driving semi trucks or framing a wall, in my over-a-decade career writing software. Go figure.