3 ms·
> You're having trouble thinking at the level I'm talking about: variables, conditionals, loops, functions, etc. Exactly my point: just to give some examples c
by aleph_minus_one 3y ago
> You're having trouble thinking at the level I'm talking about: variables, conditionals, loops, functions, etc.
Exactly my point: just to give some examples concerning your keywords:
- In many cases, for loops (with an index) became unidiomatic. Instead foreach or range-based loops became the idiomatic way
- In C#, for many cases, the idiomatic way is to use LINQ. The old style to write LINQ queries was to use query expressions, but it became out of fashion. Now, you typically use the method-based query syntax instead.
- conditionals: there actually do exist programmers who argue that if expressions are code smell when you do object-oriented programming (google "ifless programming" or "anti-if programming"), since the idiomatic way in (class-based) object-oriented programming when what should happen depends on some state is to write a method. This thought has not become mainstream, though. On the other hand: for a related reason in Smalltalk, a programming language that takes object-oriented programming much more seriously than most other languages, there exists no "if" as part of the language; see for example https://www.quora.com/If-if-is-an-object-in-Smalltalk-how-is-it-defined/answer/Richard-Kenneth-Eng https://www.quora.com/If-if-is-an-object-in-Smalltalk-how-is...
- functions: functions now often have become stateful (coroutines, methods, polymethods, closures, ...). On the other side, there exist programmers (often from functional programming) who argue that functions as they exist in imperative languages are not "pure enough".
- Izkata 3y agoYou're still thinking at too high a level. I'm talking about "what is a function", not "all the ways functions can be used".
- aleph_minus_one 3y agoIf you do consider "what is a function?" not to be a not quite subtle question, you end up with something that basically everybody knows who paid a little bit of attention in the 7th grade math classes.
- Izkata 3y agoAnd this just reinforces what I'm talking about: People who have done this for a while have forgotten what it was like. I was a teacher's assistant in introductory programming classes for several years in college and I assure you people new to programming do have to put in effort for all the basic things I listed above, not just functions.