6 ms·
Have you considered that many people aren't particularly fond of deciphering complicated math equations? For them, your argument is in favor of avoiding functi
by skybrian 9y ago
Have you considered that many people aren't particularly fond of deciphering complicated math equations?
For them, your argument is in favor of avoiding functional languages. Too math-like! A step-by-step procedure might be simpler to understand.
- wvlia5 9y agoA good analogy would be music notation (pentagram) I could describe a piece of music in English prose, telling you were to put your fingers and for how long. The language itself would be easier to understand, but the efficiency of information transmission would be very low. Chinese looks complicated, unless you know Chinese. The ultimate criteria to judge a language should be how efficiently (concisely) it expresses the concepts of the subject matter. At most, I will concede you: Goodness_of_language = conciseness × parsing_speed_of_an_experienced_user
- Arainach 9y agoUnderstandability is more important than conciseness in a team environment. In a team, you're not writing code for you - you're writing code to be reviewed by other people, integrated with other people's code, and maintained by other people in the future. In the example from this article, all developers I've ever worked with would understand what the "good old C" example is doing within seconds. Most would understand the Python example. Most of them still working in the industry today would be able to figure out what the functional python code was doing without much excessive effort - it would take them longer, which is bad, but if they were working in it every day I'm willing to believe that they'd parse simple examples like that readily enough. None of them would understand APL. J is even worse. I stared at the J code for a full minute without any comprehension of the language syntax or what was being accomplished. That code isn't readable or maintainable. It is bad code.
- mikebenfield 9y ago> J is even worse. I stared at the J code for a full minute without any comprehension of the language syntax or what was being accomplished. That code isn't readable or maintainable. It is bad code. But why does code need to be readable to someone who doesn't know the language? Yes, it's true that Python and some other languages are pretty readable even to people who haven't written any of that language, and that is a nice feature in many contexts... nevertheless, if I'm hiring a Python programmer, I'm either going to hire someone with experience in Python, or I'm going to accept that they're not going to hit the ground running and be massively productive right out of the gate... so how is it really such a loss to write in J and accept that non-J programmers won't understand my code?
- drdrey 9y agoTo avoid silos?
- Arainach 9y agoReadable code decreases ramp-up time, both in a language and in a codebase. I've never written a line of Java in my life, but if you dropped me in a Java codebase I could start understanding the structure immediately and contributing to it very quickly. If you dropped me in a J codebase I'm not convinced that would ever be the case. Writing terse readable code is great. Writing code that is so terse that it doesn't have variable names is an antipattern.
- kortex 9y agoLook at the top 7 languages used in industry: C/++/#, Java, JS, Python, and VB.NET. They all more or less follow "C-like syntax". In fact compare APL or J to any of the Tiobe 20, and you'll see they are wildly different in look and feel. https://www.tiobe.com/tiobe-index// https://www.tiobe.com/tiobe-index//
- mikebenfield 9y agoWell, I'm definitely aware of what mainstream programming langauges look like. But I think the popularity of a language is only loosely related to its technical attributes.
- agumonkey 9y agoForget it. It's a different culture, it's void to try to understand this without leaving your previous point of view. And for the laughs, I've been taught java first, and read a lots of C code, and I had a very bad understanding of what was going on. APL or similar don't cause that confusion. Actually, after years of FP, I now get C a lot more. To quite Hickey, it's not easy but it's simple. There's a set of primitives and operations, a clear system. It fits some peoples brain. For others, imperative state machine are just what they like.
- dvt 9y ago> The ultimate criteria to judge a language should be how efficiently (concisely) it expresses the concepts of the subject matter. Some might say that the ultimate criteria to judge a language should be how quickly an inexperienced user starts to be fluent in it. I studied math (so the syntax isn't really an issue), but I think functional programming is completely inappropriate for general purpose programming tasks (e.g. writing a website, writing an iPhone app, etc.).
- catnaroek 9y ago> Some might say that the ultimate criteria to judge a language should be how quickly an inexperienced user starts to be fluent in it. The ultimate criterion to judge a formal language (such as a programming language) is how easily anyone (regardless of expertise level!) can express their ideas in a precise and unambiguous fashion in it. It isn't clear that this criterion favors any known programming style. Edit: grammar
- firethief 9y agoBy that criterion a shovel is always preferable to a backhoe. Powerful tools take longer to learn.
- tigershark 9y agoDo you mean like purescript or ReasonML that is the foundation of Facebook messenger or F# that is used for plenty of iphone apps?
- skybrian 9y agoBut if you don't know Chinese, it would take quite a compelling argument to convince you to give it a serious try, no? If you're not in China, why not continue in English? Of course leaning more math isn't nearly as hard as Chinese (for the non-Chinese), but this analogy isn't working in your favor.
- crdb 9y agoInteresting examples to pick. I trained as a classical musician and when I picked up the guitar, I was too lazy to learn the notation and learnt the songs by ear and feel instead (this may be why my guitar is collecting dust in a corner). Conversely I know a lot of "amateur" musicians, some pretty advanced, who have learnt songs by ear and can't decipher musical notation of any kind, or understand any music theory. Chinese looks complicated even to the Chinese, hence Simplified Chinese arriving in the 1950s (and according to Wikipedia, they've started another round of simplification in 2013). Without an alphabet, there are thousands of characters to learn (8,000 in the 2013 version). Ask any Western-born Chinese how fluent they feel and how easily they can read it...
- AlexCoventry 9y agoYeah, this was a strange post, and it's strange that it's risen so high on HN. I'm not even sure what argument it's trying to make.
- mikebenfield 9y ago> aren't particularly fond of deciphering complicated math equations? But it's not complicated. One of the great things about mathematical expressions is that they are simple. But two of the other great things are that they are concise and unambiguous, and it's those two that unfortunately lead many students to think they are complicated.
- mrob 9y agoMathematical notation is highly ambiguous. See recent discussion of the alleged proof of the ABC conjecture (https://news.ycombinator.com/item?id=15971802 https://news.ycombinator.com/item?id=15971802 ). If it was really unambiguous then we could parse it like computer code and decide if it is correct or not without all the controversy about what it really means.
- deleted 9y ago[deleted]
- mikebenfield 9y agoWell, mathematical notation is written for humans, not computers. With a bit of context, and comparing to human language (not code), it is very much not ambiguous.
- marssaxman 9y agoMathematical notation is not one thing; it is a whole poorly-specified family of context-dependent micro-notations. While I have spent my entire career enthusiastically educating myself on a wide variety of topics beyond anything I was exposed to in school, I have found it essentially impossible to learn any new mathematical notation beyond that which was taught formally. I am capable of understanding novel computer-science concepts perfectly well once they have been translated into a more accessible notation, and of putting those concepts into practice in my own engineering work; but as long as I am struggling through papers which express those concepts in mathematical notation, I understand little and get only as far as I can by inferring what the underlying abstractions must be from the surrounding English text. It very much is complicated, if you aren't already part of an academic system capable of passing it along to you, and so far as my experience has gone there is basically no other way to bootstrap yourself into it. I have spent rather more of my life educating myself outside any academic system than I ever did within one, so the value of a notation with such limited learnability strikes me as being considerably lower than what people who have made a career inside academia might naturally assume.
- naasking 9y ago> Too math-like! A step-by-step procedure might be simpler to understand. A step by step procedure is exactly a mathematical process. Mathematical notation is just a shorthand for some procedures so you don't have to spell out every single step every time. You'd be well served by learning them!
- skybrian 9y agoMathematically equivalence has little to do with readability. Readability is both important and subjective. Sadly, few people investigate what their audience actually finds easy to read.
- oh-kumudo 9y agoTrue. I think some FP people, especially the new converts, seem to hold a weird view that simple == shorter code, which is SIMPLY not true.
- avmich 9y agoSize often correlates with complexity. I suspect a size of certain kind can serve as a definition of complexity. In programming it's often the case that a shorter program is preferred to a longer.
- lucio 9y agogoogle code golf. In the productive world, an easier to understand program is better, even if that implies more code. Variable names like "TotalAmount" are better than "x". Also, a 10 line procedural code is better than a one-line function, just because is easier to understand, and easier to change in the right way when the specification change. (it will change 15 times before implementation)
- avmich 9y agoThank you. My experience tells me another story. More code in terms of code size in bytes isn't always more complex. For example, sometimes one wants to emphasize the similarities and analogies and spends extra bytes to show that. But that in my experience is rare - and while it could be beneficial for a novice or for a substantially unfamiliar code, for good code if soon becomes burdensome. TotalAmount instead of x would probably drive crazy most mathematicians. Or most APL programmers. And probably most people demonstrating code on a whiteboard. Even in more mainstream languages like Clojure or Haskell a lot of variables are rather short; it's unfortunate that C++ with history of Hungarian notation, Java or C# have a habit to use long names. There is a reason why mathematical notation exist. F = gmM / (R^2) is often preferable to "force is proportional to both masses and to inverse of square of the distance with proportionality coefficient gamma". My advice for you is to try develop a program in REPL fashion. Standard J package from Jsoftware has a good environment for that - you can launch a computation expressed in a line, see the result and if you aren't satisfied just copy the line, make changes and launch it again. Pretty convenient in comparison to classical save-compile-run-checkResults loop of, say, C++ development. One line is certainly easier to change 15 times before implementation when specification change.