335 points · by Santosh83 · 6y ago · 79 comments
It's a good exercise to put complicated ideas into very simple language.
George Orwell had that job during World War II. The BBC used to broadcast news to the British Empire in India and Hong Kong, using Basic English. Orwell's job was to translate the news into Basic English. He later wrote that this is a political act. Converting news to Basic English means taking all the ambiguity out. If a political statement was ambiguous, removing the ambiguity means making a political decision. Someone has to decide what the statement really means.
That's where Newspeak, in "1984", came from.[1]
[1] "Orwell, The Lost Writings", https://www.amazon.com/Orwell-Lost-Writings-George/dp/087795...
Many years back I used to suffer long meetings in another 101 meeting room - I suspect that numbering scheme might be quite common.
[Edit: Mind you in the same building a lecture room where I used to suffer maths lectures is now a bar! The building having been converted to a hotel.]
The book can be borrowed at https://archive.org/details/orwelllostwritin00orwe
This is also a good introduction.
I am not sure if it's the same to others, but for me to learn a language for the first 15 minutes, I am really not interested with the differences of signed vs unsigned integers. I may have look of this when I got stuck somewhere later.
I think a better order will be:
1. play ground
2. hello world
3. control flow
4. function declaration
5. string, list and dict
6. featured stuff with this language (e.g. threading, async call)
I should be able to write basic stuff and play around with the above. Then I would try to sort out all kinds of remaining pitfalls myself :)
It is a shame because I love the potential of Rust but it seems that not much has changed in the two years since I last touched it in the regards to documentation for external projects. I still am not good enough with Rust to start producing my own projects as a result, which in other languages you can do rather quickly. I hope the ecosystem matures in this regard because I love everything else, the tooling, the build system is very modern and mature as best as I can tell.
Eg,the C++ boost docs are IMO completely decrepit, but people still manage to be productive using it.
If you see a mistake in the docs, open an issue (or a PR), it only costs you little time.
By the way, if you see outdated Haskell docs please report them on https://github.com/tomjaguarpaw/tilapia. I am (slowly) collecting examples and trying to improve the ecosystem.
That's actually one of my big pet-peeves about OSS. This is especially annoying because the Rust ecosystem already has a really nice solution to the problem - skeptic ([0]).
Skeptic finds Rust snippets in markdown files and dynamically builds tests to run them. So if your docs go out of sync with your code, `cargo test` fails.
Tested it on clap (no specific reason, just have a checkout locally) and it ran 314 snippets from the docs so seems to work.
I wouldn't be surprised if readmes were rotten, but you should be able to rely on examples in docs and example programs in Cargo projects, because they are automatically built and run during unit tests.
let num = String::from("10");
let num: i32 = num.parse().unwrap();There are many such cases in the document, but let's take for example "inference". There is a definition of what "type inference" is in the first paragraph of the section. But the reader must still then learn this phrase at the same time as learning the programming language. Maybe a simpler English statement would be "Automatic types", using the word automatic, which is more wide spread and is adopted in many languages. The meaning is not as precise but the document can then further explain what it is.
I am not a native English speaker but have become so used to using it that it is sometimes difficult to know which terms cause issues to programming language learners. Perhaps HN is the wrong place to ask this but I would be very interested in knowing which terms other non-native speakers have problems with.
I think that this write-up could use a simpler English, as it is titled, then the reader can later proceed to learning the more precise technical terms in other material.
I have lots of vocabulary that is "English-only"; it's especially noticeable if I'm asked to translate something, as coming up with a translation can take a while even though I can effortlessly understand the source sentence.
I think this is only possible true for people who speak languages with large programming communities - Chinese and maybe Russian - but I doubt it’s true for anyone else.
Anyway, I'd consider simple english a tool for introducing new concepts.
Learning programming still means that the concepts must be introduced, and having a new word to bind the new concept seems good to me.
I guess my point was just that I find the write up in "simple English" the same as the Rust book (I have just been going through it).
I would not have any objections if the term is introduced later on. To rely on it from the start just seems... well, the same as the book :)
I would still suggest to go with automatic :)
This not IMO newbie programmer material so I think a caveat could be added.
Just asking out of curiosity and maybe readers can learn a thing or two about making documentation more accessible.
The actual level of English in good documentation is usually fairly "low" - i.e. keep it simple, assume your reader wants to learn (Too many people suffer from I'll let you google that for me). That and a lot of non-native speakers probably speak better English than me (I know more words but I'm lazy)
I know how to program, I've been bitten by memory bugs - rust's design makes sense to me (i.e. the borrow checker is relatively intuitive because I've written and worked on compiler/s). That is difficult to convey in 10 minutes to someone who only knows how to plot a graph in python (for example).
My approach is usually to state all my assumptions as I go, while naming as much as I can as I go (e.g. googling for operators can be very difficult) when explaining things. In writing, I find that writing documentation away from the code can be quite fruitful otherwise the overall structure and meter of the code can be hard to divine.
I think you're getting at an important issue here. I've been programming (as a hobbyist, not a professional) for over a decade, have contributed to a bunch of open source projects, written software of my own. Mostly in languages like Python, but I've dabbled with C, Rust, etc. The stuff about lifetimes in this guide is still borderline incomprehensible to me. The reason for that is that the basic issue here isn't the difficulty of the language used to describe the concept, but that the concept itself is complicated. Maybe it needs to be complicated, but I don't think there's any way to distract from the fact that Rust is a very hard language to learn.
Hey, I've been writing Python daily for 12 years and I struggle with that!
First you have to get matplotlib installed. That often works nowadays, but you have to be sure you've installed numpy first, and on a bad day you'll find yourself looking at some sort of C compiler error and copying stuff from stackoverflow to make libgfortran be found or whatever.
Then you try to remember the bizarre way people import matplotlib. Your mind briefly flits to memories of blog posts explaining that matplotlib has two parallel APIs, and you start feeling annoyed about that. Then you start feeling annoyed that one of the APIs is based on matlab; why should a key part of the python ecosystem be apeing matlab? It's not like anyone has ever thought matlab had APIs, or anything really, worth emulating. Anyway, it's something like `from matplotlib.pyplot import plt`, or some nonsense like that. So you spend a few minutes failing to remember, and then googling for it with a rising sense of frustration.
Then you get this error:
_RuntimeError: Python is not installed as a framework. The Mac OS X backend will not be able to function correctly if Python is not installed as a framework. See the Python documentation for more information on installing Python as a framework on Mac OS X. Please either reinstall Python as a framework, or try one of the other backends._
And now you're really quite annoyed. What the fuck is a framework? It's some MacOS thing but it's always been clear that it's a non-UNIXy concept that you don't want to and shouldn't need to know and you kind of suspect it shouldn't even exist. But holding that opinion would require finding out what it is.
So you google for how to overcome that. And then... there's some weird thing where you have to put a line in the middle of your inport statements before importing matplotlib... and finally you wish you hadn't been so stubborn and had just used an IPython notebook, but you just kind of hate them despite how beautiful and well-engineered they are. They can't be version-controlled, you hate typing code into your browser, you always end up with an incomprehensible mess of mutable state, etc.
I used to use R and, back then, I enjoyed making plots and did so efficiently and reasonably well.
Uh oh! You have used a non-permitted word (style)`[0] https://splasho.com/upgoer5/phpspellcheck/dictionaries/1000....
Edit: I just figured out you might fully realize that and were probably just pointing it out to OP. Ignore me. :)
https://doc.rust-lang.org/std/string/struct.String.html#meth...
string use utf-8, which is 1 byte for the most common characters.
char is unicode
An array of `char` would technically be UTF-32. Which isn't particularly useful, imho.
Sometimes I wish we had a basic "algorithms" language that was used absolutely everywhere, and every book everywhere teaching another language would assume the person knows how to program using the basic language and then teach the new language as a diff of the basic one.
Why do I say this? Because as someone who is versed in quite a few languages, I find the signal to ratio of these texts to be uncomfortable. For example, I know C really well, so the explanations of integer sizes are irrelevant, I know what is shadowing, etc., but the explanation of the return statements is really useful, the variable declaration is interesting, so I keep having paragraphs I can skip followed by paragraphs I have to read, followed by paragraphs I can skip, etc. I get tired quickly when reading like this.
> Type inference means that if you don't tell the compiler the type, but it can decide by itself, it will decide.
The word 'decide' implies that there was a choice that was made. I would think of inference more as 'determine' as the process is deterministic just not always successful. Or are there actual cases where the compiler infers a type that's close but not entirely correct?
I just want those new to programming to understand the joy of systems and simple graphics programming like in the ol' Turbo Pascal days!
Can someone explain that in basic english?
"I applaud this. And it reminds me of the up-goer five. https://xkcd.com/1133/"
Working link: https://xkcd.com/1133/
It's a lot of fun.