News for hackers. Stuff that matters.
Re:38% of bugs at Airbnb could have been prevented by using ... by franciscop on Sunday February 10, 2019 @10:01PM (#19131743)
I think there's a bigger issue with the narrative here. Sure, types (and tests) help avoiding bugs, and they are definitely useful in large projects like Airbnb. However, they also add a cost that is always ignored, and it's even taboo to talk about it. You don't want to be labeled as an "anti-good-practice" person.

But for some cases, this cost is tremendously important IMHO:

- Startups: being X% faster at launching your product might mean the difference between life or death for the company. This includes Airbnb back in the day!

- Early libraries: not being forced to use a specific type makes it easier to change your mind midway and experiment. Later when the library API is more stable, sure, feel free to add types. Thinking too structured is dangerous when trying to innovate.

- Personal projects: where it just doesn't matter if it breaks in some situations and having to build a whole babel tower might discourage you from getting started for fun.

As an example, doing "horrible" things I could launch a fullstack prototype in a couple of days, or a decently working prototype in a week. Granted, I would not want to work with that code after 1 month and there would be some bugs, but the ability to get something quick-and-dirty is also very important and something categorically ignored. As an added benefit, this also allows you to iterate quickly, and throw whole pieces of code altogether because you avoid the "sunk cost fallacy" both from yourself and 3rd parties.

Please use types, and tests, and other good practices in principle. But also learn when it's good to break those! I get the chills when I think on someone who blindly believes on only using X for everything and anything.

Re:38% of bugs at Airbnb could have been prevented by using ... by fnordsensei on Monday February 11, 2019 @12:40AM (#19132320)
The sweet spot would be to not have an all or nothing proposition, but to be able to work with fluidity in the beginning, and then to harden the result later on by adding in various layers of sanity checks, of which typing could be one.

It's unsurprising that Airbnb—after having succeeded—find that they could have eliminated some of their current problems by making a trade-off earlier on.

A parable: a baker has a shelf of many different flours that she uses to make different kinds of bread. Being the only person in her small bakery, she relies purely on muscle memory and habit to know which flour goes where. She experiments a lot with different mixtures and kinds bread.

Later, some breads have turned out to be more popular than others, and she's doing well. She hires a couple more bakers, and now finds that she needs to label the flours, write down recipes for the successful breads, and has to establish procedures and guidelines for restocking. Different people have different habits, and muscle memory transfers poorly from person to person.

When she was starting out, she benefited from short feedback loops. The shorter, the better. Later on, the benefits of short feedback loops wouldn't be any diminished, but the need for reproducibility has become much larger than it was at first.

Re:38% of bugs at Airbnb could have been prevented by using ... by DenisM on Sunday February 10, 2019 @10:19PM (#19131811)
Can you provide an example where static typing slows you down compared to dynamic typing?

I've been using static typing for decades and the only problem I can imagine is having to add an object property definition instead of just using it. And I can't imagine this extra operation being a significant drag. Is it for you?

Re:38% of bugs at Airbnb could have been prevented by using ... by geowwy on Sunday February 10, 2019 @10:29PM (#19131839)
This is my question as well. I think about types even when I don't explicitly declare them.

"Function x will return a list of a"

"Function y will return an instance of b or null"

"Function z will return an instance of c or throw an error"

How much time am I losing by putting that information in the function declaration? I doubt it's more than the time I lose when a function returns or throws something it wasn't supposed to.

Re:38% of bugs at Airbnb could have been prevented by using ... by crumpets on Monday February 11, 2019 @12:06AM (#19132210)
Right, you’re treating the code as statically typed even when it’s not. In that case you never gain the advantage of dynamic languages.

Thinking so strictly about what types a function will receive rules out making use of things like decorators in python that operate on function arguments regardless of type.

Or generic validation utils that take many types and return the passed in type after performing internal validation logic relevant to the type.

Re:38% of bugs at Airbnb could have been prevented by using ... by DCoder on Monday February 11, 2019 @12:55AM (#19132367)
"Takes many types" ≠ "cannot be typed". TypeScript supports decorators, union types, and `any`/`unknown` types.

Those generic use cases are good examples of flexible types, but I have a hard time seeing how

* "I don't know whether the `getMyReplies()` function returns a list of items, an iterator, a non-rewindable generator whose results I need to cache, or a closure with/without memoization" and

* "I don't know whether the singular Reply entity has a field called pid, parent_id, parentId, ParentID, ParentGUID, or parent_message_identifier"

are advantageous to rendering a list of replies.

Re:38% of bugs at Airbnb could have been prevented by using ... by z3t4 on Monday February 11, 2019 @07:26AM (#19133891)
For code written in JavaScript you check the source code to see what arguments it takes and what it returns. If it's not written in JavaScript, for example a Browser API's or NodeJS built in module, you read the documentation and use console.log's. Then you rely of good naming, for example (nrA, nrB) => sum vs (a:Number, b:Number) => c:Number where the one without static types is more clear of what the function does and what it returns.
Re:38% of bugs at Airbnb could have been prevented by using ... by untog on Monday February 11, 2019 @10:05AM (#19134916)
Having to search through source for the argument types of a function is usually an example given in favour of strong typing, not against it.
Re:38% of bugs at Airbnb could have been prevented by using ... by z3t4 on Monday February 11, 2019 @10:31AM (#19135105)
There are not many reasons to read the code of your dependencies, you will learn a lot doing so. One issue when you work with the compiled code is that the type annotations have been removed, and that type annotations leads to more terse code as it would otherwise become too verbose eg. number:number tends to become n:number and when the type is removed it just becomes n, so you kinda become dependent of your tooling and can't easily just stop using it in favor of something better.
Re:38% of bugs at Airbnb could have been prevented by using ... by DCoder on Monday February 11, 2019 @12:59PM (#19136520)
Compiled code doesn't have to be unreadable.

Languages like C and C++ made it readable with debug symbols.

The web stack does the same with source maps. The TypeScript compiler also offers to emit .d.ts files with type information for reuse in other projects.

Re:38% of bugs at Airbnb could have been prevented by using ... by root_axis on Monday February 11, 2019 @01:11AM (#19132426)
> In that case you never gain the advantage of dynamic languages.

Treating the code as statically typed makes the code predictable, less prone to bugs, and easier to maintain. If a function's return type is determined by dynamic factors at run-time, it becomes a maintenance and debugging nightmare; the effect is compounded as more and more unpredictable dynamic functions are chained together.

> operate on function arguments regardless of type

parameterized types and other techniques allow you to describe this type of behavior in a type safe way.

> Or generic validation utils that take many types and return the passed in type after performing internal validation logic relevant to the type.

All these things are possible in typed languages.

Re:38% of bugs at Airbnb could have been prevented by using ... by geowwy on Monday February 11, 2019 @04:20AM (#19133067)
> Right, you’re treating the code as statically typed even when it’s not. In that case you never gain the advantage of dynamic languages.

Both the things you mention can be done in statically typed languages. The only difference is in dynamic languages you don't have to declare interfaces, subclasses, etc. I just wonder whether that really is as much of an advantage as people think.

I've spend years using both types of languages and I think I think the safety of statically typed languages is usually worth the slight amount of friction it adds.

Re:38% of bugs at Airbnb could have been prevented by using ... by Guthur on Sunday February 10, 2019 @10:55PM (#19131938)
You do this because that's how you have trained yourself to think about code. It's a little self centered too assume this for everyone else.
Re:38% of bugs at Airbnb could have been prevented by using ... by int_19h on Sunday February 10, 2019 @11:42PM (#19132124)
Thinking about data contracts for inputs and outputs is pretty basic stuff. If you don't do that, how do you know what your code actually does?
Re:38% of bugs at Airbnb could have been prevented by using ... by carlmr on Monday February 11, 2019 @03:36AM (#19132880)
They don't, but they're fast and fail often.
Re:38% of bugs at Airbnb could have been prevented by using ... by regularfry on Monday February 11, 2019 @10:26AM (#19135067)
There's a gap between things it might make sense to consider as data contracts, and things that can be expressed in practical type systems in common use.

One example: a function which, when given a single element, returns a single transform of that element. When passed a list of elements, returns a map of that transform over the list. You can argue as to whether that's a good idea or not, but I've seen JS functions that make sense in context which do that.

This might just be my lack of type system expressivity knowledge, but how would one annotate the type of that function? I get that you could use a union type on the param and the return value, but not how you link the two.

Re:38% of bugs at Airbnb could have been prevented by using ... by hombre_fatal on Monday February 11, 2019 @11:13AM (#19135503)
> how would one annotate the type of that function

Some languages support function overloads like Swift and Kotlin.

    fn foo(input: A, xform: A -> B) -> B
    fn foo(input: [A], xform: A -> B) -> [B]
Hmm, maybe we can generalize that into a Functor.
Re:38% of bugs at Airbnb could have been prevented by using ... by int_19h on Monday February 11, 2019 @03:41PM (#19138088)
Yes, this is very common in JS, and somewhat common in other popular dynamic languages. In TypeScript, for example, you'd implement this by defining several overloaded signatures. Note that this isn't C++ or Java, so you still have a single function implementing all of them - the various overloads just specify what happens depending on the arguments you pass.

https://www.typescriptlang.org/docs/handbook/functions.html#...

This is a limited approach, because the overloads aren't a part of a function type - i.e. you can't have an anonymous function value that is overload-typed, it must be a named function. In principle, a similar mechanism could be used for types as well, it just doesn't usually come up in that context (e.g. callbacks typically don't return different things), which is probably why they didn't do it.

Re:38% of bugs at Airbnb could have been prevented by using ... by cjs_2 on Monday February 11, 2019 @02:40AM (#19132680)
How could one think about functions differently than about what their input and output is?
Re:38% of bugs at Airbnb could have been prevented by using ... by zimablue on Monday February 11, 2019 @05:52AM (#19133504)
Your statement is just a tiny bit too general and that's where you're missing.

"What about their input and output is" => "what type their input/output is"

The next question is what does the type of the input/output actually tell you about the input/output? In the most popular languages (using interfaces), it basically tells you that the input/output might have a, b and c set (or they might be null), and it could also have anything else set.

So the actual information you have is that you might or might not have (a,b,c) and also might or might not have (anything). Not as foolproof as you think. The natural objection is that aha! I defined this class to require (a,b,c) in the constructor and do a nullity check, so I know much more than this! But this is back to having "types in your head", that constructor signature and nullity check isn't compiler enforced (as in if you change it, nothing will fail in the typesystem at the point of the function that we're checking, as long as those fields remain on the class). So the useful part of the static typing is actually living in your head either way.

Re:38% of bugs at Airbnb could have been prevented by using ... by mrep on Sunday February 10, 2019 @11:27PM (#19132067)
>Can you provide an example where static typing slows you down compared to dynamic typing?

I spend an annoying amount of time trying to compare/add/multiply... different types in C++ like time, durations, dates, ints, floats in my day job.

> And I can't imagine this extra operation being a significant drag.

If you have an open source C++ web framework that you think is comparable in features to python django or ruby on rails, I would be very interested as I do want the performance improvements but all the ones I have looked at look like way more work to implement what I want than using django/RoR.

Re:38% of bugs at Airbnb could have been prevented by using ... by int_19h on Sunday February 10, 2019 @11:48PM (#19132149)
> I spend an annoying amount of time trying to compare/add/multiply... different types in C++ like time, durations, dates, ints, floats in my day job.

Multiplying ints and floats "just works" in C (although you have to mind overflow, but that's not a type issues).

Other examples don't make a lot of sense. E.g. why would you need to multiply time by duration, or compare one with the other? They're different quantities, reflected as such in the type system. That it won't let you do something like that is the whole point - it would be a bug if it did (and if not, then the data types were chosen wrongly).

OTOH, adding a duration to a date is semantically meaningful - which is why std::chrono has operator+ overloaded for various combinations of time_point and duration.

Re:38% of bugs at Airbnb could have been prevented by using ... by mrep on Monday February 11, 2019 @12:13AM (#19132234)
> and if not, the data types were chosen wrongly

That is kind of my point. When I use C++ in my day job, there are highly optimized libraries/classes which makes sense considering the amount of work that needs to be done.

However, if I am just trying to do some quick data analysis and the data set is small, I just want to do some quick math on some basic data and not have to write code to convert between every single type under the sun.

With dynamic types, I can quickly convert data between dictionaries, sets, lists and what not and run it extremely quickly. That is much quicker than trying to compile and run code to transform data into the results I am trying to create.

Re:38% of bugs at Airbnb could have been prevented by using ... by cjs_2 on Monday February 11, 2019 @02:47AM (#19132696)
Isn't this more due to automatic type coercion in the language and not from the lack of types?
Re:38% of bugs at Airbnb could have been prevented by using ... by hopler on Monday February 11, 2019 @08:35AM (#19134322)
It's conversion, not coercion. Coercion is what C does to crash programs.
Re:38% of bugs at Airbnb could have been prevented by using ... by DenisM on Monday February 11, 2019 @10:44AM (#19135202)
C++ no, C# yes: ASP.NET MVC is pretty good.
Re:38% of bugs at Airbnb could have been prevented by using ... by franciscop on Sunday February 10, 2019 @10:27PM (#19131830)
For example, having a compiling system. That is a drag for everyone, but especially for newcomers and people getting started.

Edit: can you really not imagine any situation where typescript slows down some team in some situations? :)

Re:38% of bugs at Airbnb could have been prevented by using ... by tom_ on Sunday February 10, 2019 @10:28PM (#19131838)
These people reap the greatest benefit, because they are least familiar with the codebase and get the most out of having the computer check their changes make sense.
Re:38% of bugs at Airbnb could have been prevented by using ... by franciscop on Sunday February 10, 2019 @10:38PM (#19131877)
Totally agreed. I'm not saying that they would not get benefits! I'm just saying there's also a cost and that might be the difference from someone continuing learning or giving up.
Re:38% of bugs at Airbnb could have been prevented by using ... by tom_ on Sunday February 10, 2019 @11:12PM (#19132009)
I was assuming professional programmers with at least some experience - the article is about the toolchain in use by Airbnb.
Re:38% of bugs at Airbnb could have been prevented by using ... by cellularmitosis on Monday February 11, 2019 @06:10AM (#19133581)
I’m not sure. A newbie experiencing a truly interactive REPL-style environment might be way faster than being stuck in an edit-compile-debug loop.
Re:38% of bugs at Airbnb could have been prevented by using ... by james_s_tayler on Monday February 11, 2019 @02:05AM (#19132561)
Depends on compile/deploy times really. 5 minutes per cycle is painful. 30 seconds not so much. You often just compile the part you need and that can be very fast. Depends on the language too. I've found .NET turnaround times faster than Java for example.
Re:38% of bugs at Airbnb could have been prevented by using ... by root_axis on Monday February 11, 2019 @01:33AM (#19132485)
There is a cost to breaking up your logic into various modules/packages on the file system when you could simply write all your code in one gigantic file and not worry about any of that. Just because it saves time doesn't mean it's the best choice.
Re:38% of bugs at Airbnb could have been prevented by using ... by franciscop on Monday February 11, 2019 @05:22AM (#19133341)
Is there any situation where it'd be better to keep all your JS to a single file?
Re:38% of bugs at Airbnb could have been prevented by using ... by hombre_fatal on Monday February 11, 2019 @11:27AM (#19135615)
Premature extraction can solidify premature abstractions and create pressure against reabstraction.

The creator of Elm has a talk that mentions this: https://www.youtube.com/watch?v=XpDsk374LDE

Re:38% of bugs at Airbnb could have been prevented by using ... by SomeHacker44 on Monday February 11, 2019 @12:20PM (#19136133)
Depends on the problem.

As a user if both Haskell and various LISPs since 1990, I would say I personally am as productive in both strongly typed and dynamically typed languages, assuming I have a match between my problem and my platform, and avoid overengineering my types (heh).

I am also equally productive in what I consider weakly typed languages (hello, Java), when I can avoid boilerplate hell.

Bottom line is I think the productivity of the developer is more a function of the familiarity with the language, platform, tooling and problem (and proposed solution) than how strongly typed the language is.

I do find that having a REPL improves productivity in essentially all cases.

Re:38% of bugs at Airbnb could have been prevented by using ... by skohan on Monday February 11, 2019 @10:29AM (#19135083)
Exactly. In fact, I find dynamic types to be much slower to work with in the long-run.

For example, with a statically typed language, just one look at the method signature is sufficient to know exactly what it has to be passed. In the worst example of dynamic typing, in Javascript I don't even know how many arguments have to be passed. I probably have to look at the API documentation, and hope the author gave details about what the function is expecting.

And compile-time errors are much cheaper than runtime errors.

Re:38% of bugs at Airbnb could have been prevented by using ... by shabbyrobe on Sunday February 10, 2019 @10:26PM (#19131829)
It could just be that the devs on a team don't know how to use those tools yet. Having to learn how to use TypeScript effectively while establishing the patterns that underpin a new project would definitely slow you down. Maybe that's a cost you can bear early on, but maybe it isn't.
Re:38% of bugs at Airbnb could have been prevented by using ... by macca321 on Tuesday February 12, 2019 @07:58AM (#19143083)
probably when not using a JetBrains IDE
Re:38% of bugs at Airbnb could have been prevented by using ... by jondubois on Monday February 11, 2019 @03:18PM (#19137870)
- Slow debug cycle due to increased compile time. If using TDD, it takes longer to run tests. The delays adds up - Especially on large projects and especially if you're not used to having a build step during development.

- Sporadic source mapping issues/bugs which makes it hard to fix things (I had an issue with Mocha tests last week where it was always telling me that the issue was on line 1). I've worked with TypeScript on multiple projects across different companies but every single time, there has been source mapping or configuration issues of some kind.

- Type definitions from DefinitelyTyped are often out of date or have missing properties/methods. It means that I can't use the latest version of a library.

- Third party libraries are difficult to integrate into my project's code due to conflicts in type names or structural philosophy (e.g. they leverage types to impose constraints which are inconsistent with my project requirements).

- Doesn't guarantee type safety at runtime; e.g. If parsing an object from JSON at runtime; you still need to do type validation explicitly. The 'unknown' type helps but it's not clear that this whole flow of validating unknown data and then casting to a known type adds any value over regular schema validation done in plain JavaScript.

- Whenever I write any class/method, I have to spend a considerable amount of time and energy thinking about how to impose constraints on the user of the library/module instead of assuming that the user is an intelligent person who knows what they're doing.

- Compiler warnings make it hard to test code quickly using console.log(...); I'm more reliant on clunky debuggers which slows me down a lot and breaks my train of thought.

- The 'rename symbol' feature supported by some IDEs is nice, but if a class or property is mentioned inside a string (e.g. in a test case definition) then it will not rename that; so I still have to do text search after doing a symbol rename and manually clean up.

- It takes a lot of time think of good names for interfaces and they are renamed often as project requirements evolve. It's not always clear whether similar concepts should be different types or merged into one. It often comes down to what constraints you want to impose on users; This adds a whole layer of unnecessary mental work which could have been better spent on thinking about logic and coming up with meaningful abstractions which don't require arbitrary constraints to be imposed.

- Setting up TypeScript is a pain.

- Adds a lot of dependencies and complexity. It's a miracle that TypeScript works at all given how much complexity it sweeps under the carpet. Check the output JavaScript. It's ugly.

Re:38% of bugs at Airbnb could have been prevented by using ... by bandushrew on Sunday February 10, 2019 @10:09PM (#19131772)
" not being forced to use a specific type makes it easier to change your mind midway and experiment."

Is that really true? whether the original declaration is strongly typed or not, its likely that changes to the type will result in code changes needed wherever the value is being used.

The only thing that no typings does is make it impossible for the compiler to help you find where it is being used.

Re:38% of bugs at Airbnb could have been prevented by using ... by franciscop on Sunday February 10, 2019 @10:36PM (#19131868)
Yes, through duck typing. At some parts of my code near the entry point I might not care about what the input "file" is, but later (or the underlying library) for instance might accept both a path or an object for instance.

This is specially useful for options that are not used near the entry point, but instead are passed down. If the later implementation changes, you'd have to change the middle implementation as well to accept the new/different types.

Re:38% of bugs at Airbnb could have been prevented by using ... by int_19h on Sunday February 10, 2019 @11:56PM (#19132182)
Duck typing is completely orthogonal to dynamic typing - you can have static duck typing. C++ templates are one well-known example, but OCaml's intersection of its OO system with type inference also makes it kinda duck typed - e.g. if you define a function that calls a method on an argument, the type of argument is inferred as "some object that has a method with such-and-such name and types". If you call another method, that also gets added etc. But it's still statically typed - at call site, the actual type of the argument must have those methods, or it won't compile.

Or, getting back to C++, we have polymorphic lambdas there now (which are implemented in terms of templates, but with syntactic sugar that makes it all much cleaner):

   auto f = [&](auto x, auto y) {
       return x + y;
   };

   cout << f(1, 2); // 3
   cout << f("a"s, "b"s); // "ab"
   cout << f("abcd", 2); // "cd"
   cout << f(main, true); // compile-time error
Again, all statically typed, although the type checking basically consists of substituting the types in the body and checking if the result makes sense. Which is to say, the error messages from such code are very similar to the ones you get in e.g. Python if you have the types wrong, except here the errors are compile-time, not runtime.
Re:38% of bugs at Airbnb could have been prevented by using ... by jimbo1qaz on Monday February 11, 2019 @09:19AM (#19134599)
The Agg C++ library defines every class as a template, taking duck-typed parameters:

- type of Agg object passed into object

- type of "algorithm" used (or similar)

I read matplotlib's Agg C++ backend. Guessing which Class A could be passed into various template parameters in Class B was miserable because of duck typing. And it also broke "jump to definition".

``` Class B<A> { A a; } this->a.foo(), but you don't know what type a is. ```

Re:38% of bugs at Airbnb could have been prevented by using ... by machiaweliczny on Monday February 11, 2019 @04:37AM (#19133147)
All languages with structural typing support duck typing out of the box.
Re:38% of bugs at Airbnb could have been prevented by using ... by pjmlp on Monday February 11, 2019 @07:07AM (#19133811)
> Startups: being X% faster at launching your product might mean the difference between life or death for the company. This includes Airbnb back in the day!

Developing software since the mid-80's, worked in a couple of startups, never saw a case where using strong typing would be the cause of business failure.

> - Personal projects: where it just doesn't matter if it breaks in some situations and having to build a whole babel tower might discourage you from getting started for fun.

It is no fun to go back to something that was left hanging 6 months ago and reverse engineer what the code actually does.

Re:38% of bugs at Airbnb could have been prevented by using ... by franciscop on Monday February 11, 2019 @08:04AM (#19134107)
I've seen too many projects fail because they are way over-engineered. A complex pipeline, build system, developers not familiar with the practices, etc. all adds up. Now I do not know how much typescript might add in cost to all of this, but it's definitely part of what I'd consider an over-engineered MVP.
Re:38% of bugs at Airbnb could have been prevented by using ... by pjmlp on Monday February 11, 2019 @08:45AM (#19134397)
You can equally over-engineer in dynamic languages, don't see how a type system is to blame.
Re:38% of bugs at Airbnb could have been prevented by using ... by trixie_ on Sunday February 10, 2019 @10:21PM (#19131816)
There is a cost to not using types -

Dealing with bugs at runtime that would of easily been caught by a compiler.

Difficulty in understanding your own code base - functions available, parameters on those functions, the properties on the objects passed into those functions.

Refactoring - some of the most refactoring you'll do is when quickly iterating on a small application. Refactoring is super error prone, and typing minimizes those errors.

As always the typing is optional. So if it is slowing you down or some library doesn't have types, or you just don't need it in a particular case - then just use 'any'.

I've experienced typings increase my productivity in even the smallest projects. The compiler is your friend, the typings you need are often minimal and mostly inferred.

Re:38% of bugs at Airbnb could have been prevented by using ... by franciscop on Sunday February 10, 2019 @11:14PM (#19132019)
Agreed, I never said the opposite. But you'll agree that the costs of using types are mainly upfront, while the costs of not using them are mainly in the form of debt.
Re:38% of bugs at Airbnb could have been prevented by using ... by skohan on Monday February 11, 2019 @10:39AM (#19135159)
Except the costs of using types are usually in the form of a learning curve: i.e. when you are learning the type system it's relatively expensive, but once you've mastered it it's just part of your coding practice. When you do run into the rare issue, it's usually east to solve it.

By contrast, dynamic typing problems never go away. They're usually because of a faulty assumption, or due to a typo, or they're the cumulative hours you spend trying to figure out what exactly has to be passed into a function since it's not explicitly part of the signature, and the maintainer of the library you're using didn't document it well.

In the long term, static typing is much less expensive, and it's not accident that people tend to prefer more types over the course of their career rather than less types.

Re:38% of bugs at Airbnb could have been prevented by using ... by krzat on Monday February 11, 2019 @04:42AM (#19133166)
I'm sure for many people this cost is reversed and they are wasting time in dynamic language for looking up methods or fixing bugs that would not exist in typed code.
Re:38% of bugs at Airbnb could have been prevented by using ... by mattmanser on Monday February 11, 2019 @04:49AM (#19133194)
If I could give this comment a year's worth of up-votes I would.

Dynamic languages slow me down.

I have a terrible memory when it comes to method syntax, for example I would still have to look up Javascript's substring syntax every single time even though I have worked with JS for like 12 years.

Static typing's ability to supercharge autocomplete is a massive time boost for me.

Re:38% of bugs at Airbnb could have been prevented by using ... by skohan on Monday February 11, 2019 @10:44AM (#19135200)
Yes JS is probably the most egregious. After having transitioned mostly to statically-typed languages, it seems positively backwards not to have the types, or even number of arguments specified as part of the signature to a function. I have even had to dig through the source of a library when the author has neglected to document an API well.
Re:38% of bugs at Airbnb could have been prevented by using ... by woah on Monday February 11, 2019 @09:36AM (#19134720)
Bizarre attitude. Types help you work faster. They eliminate the entire class of “undefined <something>” errors that you usually have wade through when writing js. I’m guessing that you don’t have a lot of experience with modern typed languages.
Re:38% of bugs at Airbnb could have been prevented by using ... by skohan on Monday February 11, 2019 @10:34AM (#19135130)
As you say I think that perception is largely due to lack of experience with statically typed languages in general, and also maybe lack of experience with projects of non-trivial complexity and/or managing production code.

Compile-time errors feel like an unnecessary hindrance when you're not familiar with them, but when you understand that they are replacing much more vexing and difficult runtime errors, you never want to go back.

Re:38% of bugs at Airbnb could have been prevented by using ... by asdffdsa on Monday February 11, 2019 @01:48PM (#19137104)
Right, some compile-time errors for me are like; wow, thank god that didn't happen in a runtime environment
Re:38% of bugs at Airbnb could have been prevented by using ... by Vinnl on Monday February 11, 2019 @04:15AM (#19133045)
I think you're generally right. One thing I can really appreciate from TypeScript, though, is that is strikes a really nice balance in compensating for point 2. If something turns out to be really hard to type, or simply too much work, the `any` type makes it really easy to opt out of typing in a specific location. Once you've settled on the API and code that works, you can introduce the typings anyway. (Although I must say: exactly for those uses where I am expecting to be refactoring soon, I find I feel much safer to experiment knowing that TypeScript will help me with that.)

Furthermore, with TypeScript's current popularity, point 3 is starting to be less and less relevant too. When I start a React project, I just run `npx create-react-app --typescript`, and I'm up and running. TypeScript support by default is getting more widespread, which can make it a no-brainer to use in personal projects as well.

Re:38% of bugs at Airbnb could have been prevented by using ... by openfuture on Monday February 11, 2019 @04:41AM (#19133164)
This is why I'm so bullish on clojurescript!

The 'type system' is called spec - so the idea is that you can move fast but once you know some invariants you'd like to keep you can put them in the specification. Having the spec as your type system maintains sanity and gives programmers that are new to the code a high level overview.

It just makes so much sense, really feels like having & eating the typing cake.

Re:38% of bugs at Airbnb could have been prevented by using ... by _the_inflator on Monday February 11, 2019 @01:57AM (#19132538)
There is some truth to your point. And now think about using TypeScript, that gives you the edge right from the beginning. :)

I can assure you, that you want a somewhat stable software basis when the traction hits your software product. It is extremly hard to fix (dumb) bugs during those times. Certain edge case bugs suddenly become not so edgy bugs due to more customers using your product.

For me it is an anti-pattern nowadays not using TypeScript or even React/Angular.

Re:38% of bugs at Airbnb could have been prevented by using ... by empath75 on Monday February 11, 2019 @07:36AM (#19133947)
I just switched from python to go, and I’m the most productive I’ve ever been as a programmer, honestly. I don’t think types slow you down, personally.
Re:38% of bugs at Airbnb could have been prevented by using ... by hopler on Monday February 11, 2019 @08:32AM (#19134297)
AirBnB is a copy of ages-old vrbo with modifications. It wasn't a breakneck race to see who could launch code first. Coders overestimate the criticality of code to the success of a non tech business that operates on the web/apps. Airbnb isn't high tech, it's a business with modern business process of automation software.
Re:38% of bugs at Airbnb could have been prevented by using ... by tom_ on Sunday February 10, 2019 @10:27PM (#19131832)
There are endless articles written about this. If it's a taboo, nobody seems to be paying any attention to it.
Re:38% of bugs at Airbnb could have been prevented by using ... by regularfry on Monday February 11, 2019 @10:06AM (#19134924)
> You don't want to be labeled as an "anti-good-practice" person.

Oh god, so much this. Engineering theatre is a menace.

Re:38% of bugs at Airbnb could have been prevented by using ... by fergie on Monday February 11, 2019 @03:47AM (#19132934)
If HN gold was a thing, I would gild you.
Re:38% of bugs at Airbnb could have been prevented by using ... by franciscop on Monday February 11, 2019 @04:37AM (#19133144)
Thanks! I'm considering writing a blog post about rapid prototyping and aggressive refactoring, which sometimes contradicts some of these best practices.