Like what you see? Subscribe here and get it every week in your inbox!
Issue #1 - March 10, 2019
Here are the top threads of the week, happy reading!
1. Ask HN: What made you change your mind about a programming language/paradigm?
Top comment by DanHulton
Testing.
Unit testing to me seemed akin to drinking 8 glasses of water every day. A lot of people talk about how important it is for your health, but it really tends to get in the way, and it doesn't seem to really be necessary. Too frequently, code would change and mocks would need to change with it, removing a good chunk of the benefit of having the code under test.
Then I started writing integration testing while working on converting a bunch of code recently, and it has been eye-opening. Instead of testing individual models and functions, I was testing the API response and DB changes, and who really cares what the code in the middle does and how it interfaces with other internal code? So long as the API and DB are in the expected state, you can go muck about with the guts of your code all you want, while having the assurance that callers of your code are getting exactly out of it what you promise.
Unit test suites would break all the time for silly reasons, like someone optimizing a function would mean a spy wouldn't get called with the same intermediary data, and you'd have to stop and go fix the test code that was now broken, even though the actual code worked as intended.
Integration tests (mainly) only break when the code itself is broken and incorrect results are getting spit out. This has prevented all kinds of issues from actually reaching customers during the conversion process, and isn't nearly so brittle as our unit tests were.
2. Ask HN: How do you keep your files organized on macOS?
Top comment by oskapt
I do all document management with an app called DEVONthink. I’ve been working with digital paper apps for years, and DEVONthink absolutely crushes everything else. I put everything in it, and I sync it between devices using WebDAV via Seafile, which also works to get data offsite in case the house burns down. It’ll do encrypted databases, and it has mobile apps that work great. I scan documents directly into it, tag them, and sometimes link them from multiple folders, which Devon will do without copying them (or I can also copy them if I need to). It has fuzzy search capabilities and automatic OCR that is lightning fast. It’s one of a handful of apps that are always open on my desktop.
Documents aren’t stuffed into some database, either. They’re indexed and stored in a folder hierarchy that you can still access. This makes it easy to search and find them with tools like Alfred or Quicksilver or Spotlight. You can open them directly using apps like Word, and Devon doesn’t care. Devon also has an inbox you can use with Finder, so when you drop a file into the folder, it automatically moves to an Inbox folder in Devon for you to process and move to a final destination within the app.
It’s truly a fantastic piece of software.
3. Ask HN: Where should I start as a 34-year-old switching to software as a career?
Top comment by chrisgoman
Develop any software for your domain (lab technician or microbiology) that solves a simple problem you see or encounter daily. Identify a problem in your current day job that can be solved with software like recording data in the lab, tracking supplies, etc. (nothing too complex) and come up with a solution (website to check-in/check-out, mobile app (?), etc.) and learn how to build it. It will not be perfect but you will have done something. Having domain experience will GREATLY make it easier to transition -- learning a new field and software at the same time is going to be rough.
https://sysadmincasts.com/episodes/51-mechanics-of-building-...
4. Ask HN: Current and former FB employees, what's the other side to the story?
Top comment by fbemployee1234
Throwaway for obvious reasons. Opinions are my own.
I joined in the last year. I had major issues with FB before, reflecting typical HN user stance. I joined because I was curious and their promises sounded like an amazing place to work.
And it is. They treat us better than any other company in terms of autonomy and input. Everyone has a tea seat at the table.
And what I’ve seen, the external perceptions don’t match the internal objectives. I hear real change from leadership, and most of the major issues are years old.
Fb has invested hugely in protecting elections, possibly more than any single government. They have doubled that on integrity, etc.
And realistically, I don’t think we know how to balance harm and good in the real world. I just don’t see tracking online activity as more harmful than the benefit that people get from the service. (Not so much US users, but the benefits to people in very poor countries are very real, and wouldn’t exist if the service didn’t monetize so well)
In short I don’t see them as an evil entity. They’re just a large one that is easy pickings for negative press. I used to work for the US government in a health research role; this feels similar.
When something is so massive and decentralized, the “bad press” events are gonna happen. I think FB, and especially Zuckerberg, have done a great job responding to these issues to try and solve them.
Remember, what Facebook is doing has never been done before. There are going to be mistakes.
5. Ask HN: How to speak like a leader, not like an engineer?
Top comment by warent
Leadership is basically just people-engineering and business-engineering. Engineers use tools to build products, and so do leaders.
The immediate assumption is that people are tools/resources to build the product. That's talking like an engineer.
Don't use your team to work on a project/product. Use the project to work on your team. They're not there to build the product. They're there to gain some personal fulfillment. Use the development of the product to grow them.
In my humble opinion, that's talking like a leader. Flip the engineering perspective over and communicate a new set of values with a layer of empathy.
6. Ask HN: How to create a service similar to Patreon?
Top comment by makeee
I built a patreon competitor using stripe connect. It wasn’t super successful, had a handful of creators making $20-$100/month, but it’s definitely doable without a ton of legal work. Stripe makes it pretty easy. You can set it up so payments go directly from supporter to creator’s stripe account, with a percent going to you. If you want to batch payments or have more control over funds then you actually need to collect funds and do the payouts, which makes things a bit more complex. Feel free to email me if you want to chat.
Honestly, dealing with payments is nothing compared to the amount of hand holding required to help creators set up a nice profile, pick good rewards, do a good job promoting their page, actually fulfill their rewards so they don’t lose backers, etc. It often took months of back and forth with creators to finally get their page launched. I’d avoid building a patreon competitor unless you personally know some very big creators (500k+ followers) or have a very specific niche in mind.
7. What was the nicest codebase you've inherited without the original author(s)?
Top comment by mattnewport
I inherited EASTL (EA's internal implementation of the C++ STL designed to be more suitable for use in games) for a while after the original author left EA, although I'd already done some work on it while he was still there. It's now open source on GitHub. There's also a paper out there outlining the original motivation and design goals.
It was generally very well written and where it differs from the standard there's usually an interesting reason why. It had extensive unit tests that ran automatically across a very wide range of supported platforms and compilers including all major desktop, mobile and console platforms. It is generally much more legible than the STL implementation used by Microsoft (which was one of its design goals) while also often more efficient. It's the STL so it's mostly fundamental algorithms and data structures and widely useful utilities of general interest rather than very domain specific business logic.
8. Ask HN: Game devs, what is the hardest part about designing an AI for your game?
Top comment by Jasper_
Game AI is mostly pathfinding (which basically falls down to creating navigation meshes for levels), and very basic decision making skills, which is usually a weighted decision tree (e.g. if they're getting shot at, cover might be weighted at 80%, shooting back at 20%). You don't want to actually create something actually smart to fight, you want something with understandable, predictable logic for the player and something they feel clever outsmarting. Anything too complex and players will get discouraged by the difficulty.
Machine learning isn't really a great fit for this, as it is neither predictable nor understandable, and thus the player can't plan around it or try to outsmart it.
9. Ask HN: Anyone Using Elm in Production?
Top comment by jlundberg
We've been using Elm since Nov 2016 right after the 0.18 release to rewrite an old B2B web app.
- The system has 150+ users that was migrated over night and has been online for about 2 years now.
- No runtime exceptions in production. In testing the only thing we had was "Stack size exceeded" in Internet Explorer due to a poorly written time zone module.
- Translation was solved with one build for each language to avoid passing down the model everywhere.
- Coding takes more time but things don't gradually turn into spaghetti and refactoring is a breeze.
After the initial functional struggles it feels like writing "the code of your life". Overall, a very positive and fun experience and I don't regret us betting on this new fairly untested technology. And none in the team had lots of prior SPA experience so we had to learn new stuff anyway. Almost as good a tech choice as when we decided to use gevent or MongoDB but for a very different problem.
This was for a custom client project and not our main 46elks service which is an API that mostly uses Python.
10. Ask HN: How would you monetize software that runs mostly offline?
Top comment by ebiester
Sell it like a normal product. This was the way commercial software worked for decades. They buy a license. They download it and register it while connected to the internet. They then take it offsite. Then, have an option to be paid to be on call for support when a meet is happening. That way nobody is surprised if something doesn't work.