5 ms·
In the past week my coding colleague (whose age is only just into double digits) and I have had to: * insert lines of code into asciidoctor Ruby to debug how t
by gorgoiler 6y ago
In the past week my coding colleague (whose age is only just into double digits) and I have had to:
* insert lines of code into asciidoctor Ruby to debug how the command line interface differs from the library interface;
* read through Raspberry Pi SenseHat code to figure out that the drivers won’t load via SSH (you have to plug in an HDMI cable!);
* rummage through Python’s PY Sequence List to answer the question “what kind of sort does Python actually use?”.
The problem with shipping binaries is it lowers the standard for being able to build from source.
If a package is easier to ship as a binary because the source is hard to distribute reliably, we give up hope of end users being able to modify and build their own versions.
This is obviously bad for freedom. It’s also hard for debugging and learning.
- executesorder66 6y agoYou have a 10 year old coding colleague?
- heavenlyblue 6y agoThe answer to “which sorting algorithm python uses” is the first result in Google. The third is official python docs.
- gorgoiler 6y agoThe context was one where we were learning about how things work, rather than wanting to just know the answer per se. I always _try_ to show how one can answer problems from first principles before resorting to “go look it up on stack overflow”. It boosts ones sense of usefulness as a teacher if one can occasionally give more in depth answers as teachable moments. For one thing, demonstrating deeper understand is how you score high marks in exams.
- heavenlyblue 6y agoI don't understand what you mean by "first principles". Open up Python's source code and check - this is first principles-first hand. As a matter of fact I am going to go as far as saying that reading source code is the _only_ way to actually be any good in software engineering because it's the only source of truth that never gets out of sync with the de-facto. Did you expect to find a blog post about it (you can find it on the first page of Google search I mentioned)? Or a YouTube video (didn't pay attention to that)? Books are reasonably good but usually get out of sync quite fast. And going back to first principles: the reason most of the literature may not mention what sorting algorithm Python uses is because a) it's irrelevant as a first principle knowledge b) it gets quickly out of sync.
- dnadler 6y agoI think you've misread the comment. You seem to both have the same definition of first principles.
- fnord123 6y agoI think it's a tongue in cheek way to say that they are teaching their 10 year old child to code and they have had to shave some painful yaks.
- gorgoiler 6y agoNot quite that young. I am a teacher with 85 teenagers under my wing, at the last count. An important part of school is learning how to learn. It is a constant struggle with pupils to get them to actually think instead of googling for an answer. Sometimes it feels a bit like I am a grumpy oldie telling them things like _in my day we had to look things up in books instead of using Google!_ but most of the time it’s valuable in and of itself to go through things from first principles. (The sensehat bug was a case in point.) As far as source code is concerned, it turned out to be quite tractable to follow the Python source code at least far enough to find the timsort.txt document. If any of these kids go on to have technical careers, there will be plenty enough time for googling answers later on in life. Hopefully some of them will be writing the answers too.
- fnord123 6y agotbh the only source of truth is the code. Documentation and comments are all lies! shakes fist
- toyg 6y agoIt's a bit like tech support, where you have to assume the user is always lying.
- maxbond 6y agoI once got locked out of my Amazon account because I went through a weird flow where I ended up changing my email without clicking a confirmation link, and I made a typo, so it was changed to a nonexistant email. No one in tech support believed me. No one was willing to help me. They told me to make a new account. I've done my best not to buy from Amazon since. Please don't be hostile to users.
- toyg 6y agoThat's more fraud detection than tech-support, sadly. Even if they believed you, they might not have been authorized to help. You wouldn't want random people to hijack your account by crying "typo" to the support guys.
- kelnos 6y ago> read through Raspberry Pi SenseHat code to figure out that the drivers won’t load via SSH (you have to plug in an HDMI cable!) I'm really curious about this. Why would a driver care about whether you load it on a "real" tty vs. over the network? How does it even know?
- gorgoiler 6y agoI have to admit the facts known to me are simply: plugging in the HDMI cable stopped the bug. We didn’t dig further than that, though the error was quite obscure until we read the source code, at which point we realized that the “FB” the error mentioned meant the Linux console framebuffer. I assume the Python module for operating this device ships with a GUI, which is couple to some Linux framebuffer initialization code, which in turn only works if the framebuffer is enabled, which presumably it isn’t if the host boots without an HDMI device connected.
- sigjuice 6y agoI have a Raspberry Pi with a Sense Hat that has never had an HDMI cable plugged into it. I have written small programs with the Python module that operate the LED matrix that work fine AFAICT. The LED matrix also happens to be a framebuffer device, and it is possible that your error was about the LED matrix. The LED matrix is an RGB565 framebuffer with the id "RPi-Sense FB". The appropriate device node can be written to as a standard file or mmap-ed. https://www.raspberrypi.org/documentation/hardware/sense-hat/ https://www.raspberrypi.org/documentation/hardware/sense-hat...
- stinos 6y agoIf a package is easier to ship as a binary because the source is hard to distribute reliably, we give up hope of end users being able to modify and build their own versions You might be giving up hope too soon, because what you describe has in my experience been the life story of source code from the start, to some extent. And I'm not blaming it for that. Distributing source code (well, not the distribution itself, but getting it to build) on all possible systems out there is hard and impossible to get 100% correct. It's simply inevitable to encounter systems on which it doesn't build because of their specific configuration, or user error. Despite that, end users have been building their own versions and still do. Users who really want to don't let themselves hold back by a compiler error. Granted it's possibly that in a perfect world where everything would just work there would be somewhat more users doing that, but there's no such thing as a perfect world. Moreover I do have the impression things are actually much better these days, mainly thanks to CI which makes it easy to get out of the bubble and build on multiple platforms. At least I don't have that feeling anymore of 2 decades ago where I sort of was prepared to waste hours getting anything to build which got handed to me on the internet. Still, it would be very interesting to go and see the percentage of projects out there which just build according to the instructions.
- yodelshady 6y ago> read through Raspberry Pi SenseHat code to figure out that the drivers won’t load via SSH (you have to plug in an HDMI cable!); What? I can assure you this is not true. My R Pi has never touched an HDMI cable and runs a sense HAT just fine. What OS?
- cowsandmilk 6y ago> rummage through Python’s PY Sequence List to answer the question “what kind of sort does Python actually use?”. If you needed to dig through source code to find out that python use Timsort, I genuinely am curious about how bad you are at search engines. I believe in reading source code to answer some things, but that example is really odd for anyone who has researched sorting algorithms since Python literally invented a sort used by many other languages now.
- gorgoiler 6y agoAhem, a more uncharitable person might retort with: If you need a billion dollar search engine and an internet connection to make sense of the source code on your local machine, I am genuinely curious how bad you are at reading source code! But as I said, that’s pretty uncharitable. Because of course I didn’t have the source code for Python locally. I downloaded it after Googling “Python source code”.
- cycomanic 6y agoThis reply made my day, thanks!
- kidsil 6y ago+ Negatively commenting on someone else's coding abilities. + Explaining something that is "obviously common knowledge". + Reducing motivation of participant to share their experience. I think we have HN bingo right here.
- FridgeSeal 6y agoIt needs “here’s why you should have used XYZ instead, obviously” to really round it out in my opinion.
- snovv_crash 6y agoDon't forget someone plugging their startup which solves this problem for the price of only 2 coffees per month.
- deleted 6y ago[deleted]
- abathur 6y agoYou might find the Nix package manager fruitful. (Fair warning: Nix isn't "easy", but it is powerful. It takes some work to find your sea legs.) It isn't always possible, but Nix places a lot of emphasis on building software from source (or downloading a pre-built copy from a binary cache), and it has fairly good support for overriding/customizing the expression that builds one or more pieces of software. A few months ago I was trying to debug a test in the Oil shell project that broke only on macOS for very unclear reasons. I eventually figured out that, in a specific mode, bash (which both Nix and macOS use as sh by default) was filtering out a specific environment variable that this specific test was trying to set, before running a target program with a sh shebang. I only needed to add a few lines to the project's build expression to patch bash and use the patched version for the tests (all without affecting the system/user bash).
- nh2 6y agoI expect Nix to become more popular due to its ability to build static binaries. The key benefit that nixpkgs has over other Linux distributions' package sets on this topic are: 1. It allows you to _program_ your package set, thus adding static-linking overrides to 1000s of libraries/executables in a go, instead of having to modify each package manually. 2. It allows the end user to choose what linking they want, as opposed to the Linux distribution making that decision for them upfront. 3. It allows to do this from any Linux distribution.
- haberman 6y agoI agree that being able to read source and modify the code for experimentation are important. In my experience, the best way to read source code and experiment are to get the source from the upstream repo (eg. GitHub) and read/build from that. I do this with code written in C or C++ all the time. The code is always out there (unless you're talking about proprietary software, which none of your examples above are).
- sulZ 6y ago> * read through Raspberry Pi SenseHat code to figure out that the drivers won’t load via SSH (you have to plug in an HDMI cable!); I've suspected that for a long time without confirming it personally, so thank you for your time.