News for hackers. Stuff that matters.
Re:Microservices Considered Harmful (2019) by macspoofing on Sunday June 07, 2020 @07:49PM (#23452142)
>when not to use static typing

I'll bite. When should static typing not be used?

(Note: I agree with your general point)

Re:Microservices Considered Harmful (2019) by yashap on Sunday June 07, 2020 @07:54PM (#23452176)
When I’m throwing together a quick script, or maybe some minor piece of automation, Python is my go-to language.

For any decently large project, though, I prefer static typing.

Re:Microservices Considered Harmful (2019) by karatestomp on Sunday June 07, 2020 @08:34PM (#23452399)
I'd kinda prefer it then, too. If it's short and I'm just scripting stuff up it's probably mostly calls to existing code (libraries) so almost all the static typing would do is tell me when I'm screwing up and give me hints for valid arguments with types and names, with little or no added overhead. It'd be very nice.
Re:Microservices Considered Harmful (2019) by MaulingMonkey on Sunday June 07, 2020 @08:42PM (#23452439)
Consuming types in that context is nice, defining them is what's generally a PITA / extra boilerplate / overhead.

To take a concrete example that could go both ways: Say you want to parse a JSON blob for some task. On the one end, you could access it through dynamic typing, or tools like jq, that don't need a schema for the entire data format. At the other extreme, you could make typescript definitions defining a schema for the entire format.

The more the same data gets (re)used, the more worthwhile taking the time to define a full schema is. But to download and add type definitions (often out of date and in need of further tweaking) for every once-off API request? Way more effort than it's worth.

Re:Microservices Considered Harmful (2019) by seer on Monday June 08, 2020 @12:43AM (#23453621)
Most static type systems do not force you to say what’s the entire shape of the data, just what the shape of the data you need is.

In fact its a good practice to do in general. So that when processing the json blob you tell what only your processing requires.

What you get is that if for example you do your validation, but then by chance you touch more data that you’ve checked for, the types will tell you you are dangerous waters, and you can go update the validations.

This is especially useful if you’re not the original author or if you’ve written it several months back and don’t remember the details.

Static types are really cool that way, and can be treated as just a faster to write and faster to run and always up to date unit test.

Re:Microservices Considered Harmful (2019) by jbreiding on Sunday June 07, 2020 @11:38PM (#23453364)
For me it's where I'm developing a task to do stream processing and classify the data by an arbitrary subset of the data and don't want to model the entire structure to avoid losing/changing the original data structure.

I'm sure there's better ways to do this, but that's an example I'll throw in.

Re:Microservices Considered Harmful (2019) by ergothus on Sunday June 07, 2020 @08:58PM (#23452523)
When the communication loss (visual noise) from the added static typing info is of bigger impact than benefit type safety offers you.

All of which depends on a lot of variables.

Re:Microservices Considered Harmful (2019) by hedora on Sunday June 07, 2020 @09:36PM (#23452746)
My heuristic is that if anyone else will ever read the code, it should be statically typed (or be written in a language like shell where the language is essentially limited to one type).

Most people disagree, but then they end up writing giant python monoliths with layers of implementation inheritance, dependency injection and functional programming paradigms.

In the end, they try to port it to pretty much any other language, but at that point it’s too late.

Re:Microservices Considered Harmful (2019) by empthought on Sunday June 07, 2020 @10:08PM (#23452908)
Python has a pretty good type checker.
Re:Microservices Considered Harmful (2019) by kobalsky on Monday June 08, 2020 @11:26AM (#23457317)
Many AAA games implement their engines in C++ but use something like Lua for game logic.