HNHacker News
TopNewBestAskShowJobs

fbonetti

1,018 karma · joined May 1, 2015

submissionscomments
fbonetti··on Elm in Production: 25K Lines Later
Elm's primary selling point is "no runtime exceptions". The subheader on Elm's homepage even says this[1]:

    Generate JavaScript with great performance and no runtime exceptions.
Type safety doesn't come for free. If you want to build an application that doesn't have runtime exceptions, you have to specify what external data should look like, how to translate that data into a native datatype, and what to do if that expectation fails. With this in mind, you can't just write `JSON.parse(data)` and expect everything to work. What if your data has a different shape? What if it's missing fields? What if field "foo" is a String instead of an Int?

Here's a short example in Typescript:

    import fetch from "node-fetch"

    interface Post {
      user_id: number,
      id: number,
      title: string,
      body: string
    }

    const postUrl = 'https://jsonplaceholder.typicode.com/posts/1'

    const show = function(post: Post) {
      console.log(post.user_id)
      console.log(post.id)
      console.log(post.title)
      console.log(post.body)
    }

    function getJSON(): Promise<Post> {
      return fetch(postUrl).then(x => x.json())
    }

    getJSON().then(show)
Do you see the bug? `user_id` is supposed to be `userId`, yet this example will compile without an issue. When you run it, `post.user_id` will be undefined, even though our interface clearly states that a Post most have a `user_id` field of type `number`. The compiler won't catch this even with `--strictNullChecks` enabled.

Everything in programming is about tradeoffs. If you don't care about strong type correctness, use something like Typescript. If you do care, Elm is a great choice.

[1]: http://elm-lang.org/

fbonetti··on Elm in Production: 25K Lines Later
I really wish people would stop spreading the meme that decoding JSON in Elm is "hard". Yes, Haskell allows you to automatically decode/encode datatypes, but this only works in the simplest of cases. For example, if your backend returns a JSON object with snake-cased fields, but your model has camel-cased fields, `instance ToJSON Person` won't work; you'll have to write a custom decoder. The automatic decoders/encoders in Haskell only work if the shape of your JSON perfectly matches your record definition.

Writing decoders in Elm is not hard. It's manual. It's explicit. It forces you to specify what should happen if the JSON object has missing fields, incorrect types, or is otherwise malformed. There's a slight learning curve and it can be time consuming at first, but it guarantees that your application won't blow up at runtime because of some bad data. Because of this, JSON decoding is frankly one of my favorite parts about Elm.

Typescript, on the other hand, offers no such guarantee. If you write a function that takes an Int and you accidentally pass it a String from a JSON response, your app will blow up and there's the nothing the compiler can do to help you. Personally, I'd rather write JSON decoders than have my app blow up because of a silly mistake.

fbonetti··on What are potential disadvantages of functional programming?
That's just a combination of pattern matching and tail call optimization. That code would look exactly this same in Haskell:

    countToTen n = countToTen (n + 1)
    countToTen 10 = done
fbonetti··on Canada's Housing Bubble Will Burst
All good points. Another benefit of investing in real estate (compared to investing in the stock market) is that you have significantly more leverage. You can ask a bank to give you a loan for hundreds of thousands of dollars and use that to produce positive, monthly cash flow. It's a lot harder to convince a bank to give you a loan to buy dividend producing stocks.
fbonetti··on Clojure Newbie Guide (2015)
Runtime type checking is useless. If a given function can't accept the data I plan to send into it, I want the compiler to tell me immediately.
fbonetti··on Vanlife, the Bohemian Social Media Movement
Did you work remotely while living in a van? Or did you still work in an office? It sounds like you did the latter, which sounds miserable. I think you would've had a different experience if you had used your van to travel.
fbonetti··on Jeff Bezos’ Annual Letter
I think you're getting at the heart of why burn down charts are so pointless. The shape changes sprint to sprint, depending on what kind of stories you take on. If the sprint is entirely high pointed stories, your chart will be mostly horizontal. If the sprint is entirely 1 pointers, the graph will look like an exponential decay.

Since the shape is always different, there's virtually zero useful information to take away from it.

Some people in this thread claimed that burn down charts are useful for finding out a team's capacity. I disagree - you don't need a chart for this. If your team has a target velocity of 30 points and routinely fails to meet it, reduce the target velocity. Likewise, if the team routinely completes all of their work well before the end of the sprint, slightly increase the target velocity.

fbonetti··on Jeff Bezos’ Annual Letter
I agree. Being on the receiving end of Scrum feels like being an assembly line worker. I totally empathize with the business people who need some transparency into what the developers are working on week to week. Software is pretty abstract. I get that. But obsessing over burn down charts is the wrong way to go about it.
fbonetti··on Jeff Bezos’ Annual Letter
Because it erodes trust in the platform, obviously. Would you buy something from a website if you were concerned it might be counterfeit?

That being said, I've been a prime customer for years and I've never encountered this issue. I'm actually surprised to hear that's even a thing.

fbonetti··on Jeff Bezos’ Annual Letter
Yes, it was a VC-funded, early-stage startup.

On top of the large amount of process and the one week sprints, we also four different dev teams each working on their own microservice app which was tightly coupled to the other apps in the company. Every team had to deploy at the same time, and if one app went down, the other apps went down with it. The company's platform was essentially an ecommerce site that could have been one medium sized monolith, maintained by a single team of 5 or 6 developers, but instead we had 20+ developers, several dev managers, a scrum master, and a large QA automation team. I guess you could call it premature optimization.

There were also plenty of issues on the business side that prevented the company from truly succeeding. The place was a bit of a clusterfuck but it was an excellent learning experience.

fbonetti··on Jeff Bezos’ Annual Letter
It's a common metric used in the Scrum methodology. You start off the "sprint" with a set number of "story points" (say, 30 points), and end the sprint with zero points. When you graph the team's progress over the course of the sprint, it should ideally form a linear, downward slope.

https://en.wikipedia.org/wiki/Burn_down_chart

fbonetti··on Jeff Bezos’ Annual Letter
> The worst of these are also the sort of people who, if your speedometer was broken, would insist that the car is not moving. Even after you told them to look out the window.

That's an amazing quote. I'm totally stealing this.

fbonetti··on Ask HN: How do you avoid staying too late at work?
Have a life outside of work
fbonetti··on iPad 9.7‑inch
This was a few years ago, so it may no longer apply, but my biggest frustration was that none of my keyboard shortcuts worked. I like to toggle between the browser and my code editor while I code, and the only way I could do that was to physically swipe the screen with my hand. There was a workaround to enable certain shortcuts by turning on accessibility mode, but it was a huge hack and didn't work that well.
fbonetti··on When You Should Use Lists in Haskell (Mostly Not)
Any reason when you don't like String being an alias of [Char]?
fbonetti··on How did Europe become the richest part of the world?
You might be thinking of "Guns, Germs, and Steel"
fbonetti··on I've been writing ring buffers wrong all these years
That looks very similar to the handcuff knot
fbonetti··on Why we chose Vue.js over React
To be fair, writing if statements in JSX is messier than it should be, but this is the fault of JavaScript and not JSX. If statements don't return anything, so we have to either create an immediately executed anonymous function (like you showed) or use a ternary operator. I'm pretty sure the author knows that you can put if statements in JSX but is frustrated that it requires boilerplate, which I think is a valid criticism. That being said, I greatly prefer using plain JavaScript over custom DSLs like Mustache.
fbonetti··on Kent Beck: “I get paid for code that works, not for tests” (2013)
In terms of web languages, Elm is perfect for this purpose. It's a statically typed, pure functional programming language. It's impossible for functions to generate side effects. Side effects must captured by the type system as external "Commands". Also, the type system is inspired by Haskell but far more basic. To hardcore functional programmers this is a negative, but Elm is really easy to teach to JavaScript programmers as a result.
fbonetti··on Breitbart news site blocked by ad exchange
Businesses are free to dissociate from organizations that they feel will hurt their brand. They're also free to not do business with organizations purely for philosophical reasons.

Does it surprise you that most companies won't advertise on Stormfront or 4chan /pol/?

fbonetti··on Elm for the Front End, Right Now
While it's easier to bang out code with React, you have to acknowledge the massive downside of that flexibility: you have zero guarantees that your code will work properly. Even if you use Typescript or Flow you still you won't have the guaruntee that your code accidentally "fire the missiles", because JavaScript is not a pure language.

I totally understand that DOM access is a pain point for Elm developers right now. I often run into that issue myself. But declaring a port is a small price to pay for the all that the Elm compiler gives you. When I have to refactor a React/Redux app, I absolutely dread it. With Elm, I love it, even if the project is older or unfamiliar.

fbonetti··on Google AI invents its own cryptographic algorithm
Deleting random lines of code? That's like the bogosort of machine learning.
fbonetti··on Comparison with Other Frameworks
OP did not mean "tightly coupled" in the traditional OO sense. They meant that they prefer their presentation to be coupled with their logic, which is how React components work.
fbonetti··on The State of JavaScript – Survey results
I'm not sure why you've been downvoted. I absolutely LOVE that Elm simplifies the boiler plate of a front-end app. Instead of needing a dozen different packages and tools, you basically just need the Elm core library and you're good to go.
fbonetti··on Ways to make working remote work for you
I don't mean this as a criticism towards you personally, but I've heard this same sentiment about remote working and I just don't get it.

I could never see myself accidentally working until 9pm. I understand having a passion for programming/work, but aren't there other things in your life you would rather be doing, like seeing friends, going out for a bike ride, trying a new restaurant, having sex with your GF or wife, or cooking a nice meal? I really don't understand the obsession with work (especially if you're on a salary and don't get paid for the additional hours).

fbonetti··on A full-featured form software built with love in python
At the last company I worked for, we used Salesforce as our database and source of truth in one of our web applications. It was exactly as horrible as it sounds :)
fbonetti··on Warned of a Crash, Startups in Silicon Valley Narrow Their Focus
Yep, the word "startup" has the same definition to me. It's more of a description of the culture than how new or scrappy the business is. I worked at a "startup" that had been around for 10 years, had no plans of exiting, and was sustainable, but had a very young staff, a keg in the kitchen, and pressured it's young developers to work late for shitty pizza.

I think some small businesses are jumping on the startup train so that they can attract kids right of college.

fbonetti··on Scientists to unveil new Earth-like planet
Yes, you will eventually reach an altitude where the gravitational pull of a given body is negligible. At that point you will have escaped it's orbit.
fbonetti··on Scientists to unveil new Earth-like planet
Before I played KSP I had a lot of hilarious misconceptions about the physics of rocketry and space travel.

On my first attempt to get into orbit, I loaded up my rocket with as many engines and boosters as I could strap on and fired the rocket straight up. The rocket breached the atmosphere but to my surprise the rocket came straight back down. I literally thought that launching rockets into orbit meant shooting them really high until they were "in space" haha. I then quickly learned that being in orbit means having a horizontal momentum that is balanced with the gravitational pull of a given body. This balance produces a curved elliptical trajectory.

fbonetti··on Meme pages plan mass revolt against alleged Facebook bias
> memes are the only culture we're producing right now

We live in an age where you can access any genre of music, any artwork, any TV shows and any movies from any culture on planet Earth with the click of button. We live in an age where people with obscure artistic talents can find online communities and actually make a living. People who are hobbyists can create high quality podcasts and youtube videos and have a global audience of millions, without any need for a middle man.

If you truly believe that memes are the only form of culture being produced right now, you live under a rock.

← PreviousPage 6 of 8Next →