News for hackers. Stuff that matters.
Re:Seven deadly sins of talking about “types” (2014) by pytester on Saturday December 14, 2019 @08:52AM (#21789479)
>When you see a huge codebase in python grown over several years and try to refactor it, reason about it, or just enhance it, you will inevitably come to the conclusion that the omission of static type checking is a grave error from a system-design perspective.

I inevitably came the exact opposite conclusion. Perhaps because at the start of my career I was trying to do the same thing with Java, and it added overhead and expense without a commensurate payoff in safety.

Frankly, I think velocity is ridiculously underrated:

* Because of the age old "customer doesn't know what they want" issue - hence you throw away a lot of the code that was not fit for purpose.

* Also because the right kind of architecture is only obvious in retrospect - hence you throw away a lot of the code that was not fit for purpose.

* And finally, because the only times in my career where I've had significant success in refactoring a large mission critical codebase it was python and it was because I'd managed to quickly build custom tooling infrastructure (e.g. testing) to support that refactoring.

I do take some issue with python's type system (e.g. the whole truthiness thing), but on the whole it balances safety and velocity in a highly pragmatic manner.

Re:Seven deadly sins of talking about “types” (2014) by cjfd on Saturday December 14, 2019 @09:40AM (#21789691)
Well, java tends to be one extreme and python the other.

Java appears to be the most bureaucratic language around where most code is written by people who are just a bit too enthusiastic about OO so every class becomes a FactoryManagerPatternVisitorImplementation and every struct 'of course' needs getters and setters.

Python on the other hand is often written without any safety and I have frequently witnessed how every typo becomes a new variable maybe just because the cat stepped on the backspace key and how one developer changes the signature of a function but not all places where it is called.

I think there are great benefits to compile/lint time type checking for anything bigger than just a throwaway script. For python one can use mypy, which helps. There is no need to, though, to turn everything into a festival of object orientedness. Most classes need neither parent nor child. And some functions can just be global functions.

Re:Seven deadly sins of talking about “types” (2014) by pytester on Saturday December 14, 2019 @09:57AM (#21789764)
I think a lot of java's "bureaucracy" is simply duct tape around its badly constructed type system.

>Python on the other hand is often written without any safety

Oh for sure, but I find it easy to start dialing up python's safety from day one of starting on a project (e.g. start writing asserts), no matter how complicated.

Working around java's horrible type system? Less easy.

Re:Seven deadly sins of talking about “types” (2014) by marcosdumay on Saturday December 14, 2019 @12:06PM (#21790499)
I'll have to agree with pytester, and say something strongly discouraged by the article... But, well, Java can not be an extreme, its type system is very basic, it can represent very few stuff, so it can not check much.

If you want something closer to the extreme, go for Haskell. But then, you can't complain much about bureaucracy.

There is an annoying tendency of people to base their opinions on technology directly copied from the 70's.

Re:Seven deadly sins of talking about “types” (2014) by choeger on Saturday December 14, 2019 @10:12AM (#21789834)
> I inevitably came the exact opposite conclusion. Perhaps because at the start of my career I was trying to do the same thing with Java, and it added overhead and expense without a commensurate payoff in safety.

It really sounds like your code base simply wasn't too big after all. When you change a Java API, how much time does it cost you to find all broken client code? How much in the same case for python?

> Frankly, I think velocity is ridiculously underrated

Again, it sounds like your projects were still rather young. IME, throwing away code practically never happens when it has been installed for at least half a dozen customers. So python helps you to build stuff quicker, because it does not force you to be sound. But soundness is exactly what you want after a certain threshold.

Re:Seven deadly sins of talking about “types” (2014) by pytester on Saturday December 14, 2019 @10:22AM (#21789884)
>When you change a Java API, how much time does it cost you to find all broken client code? How much in the same case for python?

With a decent test suite and a bunch of well crafted asserts, it ends up being much quicker. Indeed, for the really subtle broken stuff, pretty much only a decent test suite can catch it.

>Again, it sounds like your projects were still rather young.

Probably just better tested than yours.

In time, you might learn to appreciate this quality but who knows...

Re:Seven deadly sins of talking about “types” (2014) by choeger on Saturday December 14, 2019 @10:38AM (#21789995)
> With a decent test suite and a bunch of well crafted asserts, it ends up being much quicker. Indeed, for the really subtle broken stuff, pretty much only a decent test suite can catch it.

I think you don't understand the point. Unless you propose that my test suite tests the libraries I am using, testing does not find code affected by API breakage. And even if you do test your used libraries in your client code, think again about how much effort it cost you to do what a machine can do just better.

> Probably just better tested than yours.

First of all, I doubt it. Second, you just sound rather arrogant.

I hope you are aware that a) testing by necessity will always be incomplete and b) type systems by necessity will always be restricted.

The developer who just discards one of these tools sounds like a woodworker who discards a chainsaw because he loves his splitting axe so much.

Re:Seven deadly sins of talking about “types” (2014) by coldtea on Saturday December 14, 2019 @12:23PM (#21790639)
>First of all, I doubt it. Second, you just sound rather arrogant.

Oh, the irony.

"It really sounds like your code base simply wasn't too big after all"

"Again, it sounds like your projects were still rather young"

Re:Seven deadly sins of talking about “types” (2014) by choeger on Saturday December 14, 2019 @06:56PM (#21793290)
Are you aware of the meaning of the phrase "it sounds like"? Because comments like this just make the whole discussion-in-the-web thing a rather unpleasant experience.
Re:Seven deadly sins of talking about “types” (2014) by coldtea on Monday December 16, 2019 @10:48AM (#21803869)
Not sure how the meaning of the phrase "it sounds like" plays into this.

My point was that you accuse the parent of arrogance, while he was merely mirroring/responding to the arrogant tone in your comment (in the lines I've quoted).

That is, my point wasn't that you made an absolute claim ("your code is X") that was false. If that was my claim, yes, you could refute it by saying "I only said that it sounds like X is the case, I didn't make an absolute claim".

But my point was rather that the tone in your comment was arrogant.

"Your code base simply wasn't too big after all" is equally arrogant whether prefixed with "sounds like" or not.

It makes assumptions about the size of the other person's codebases, and it arrogantly implies that they don't see what they see because they haven't worked in as large codebases as you have.

Re:Seven deadly sins of talking about “types” (2014) by pytester on Saturday December 14, 2019 @10:56AM (#21790107)
>Unless you propose that my test suite tests the libraries I am using, testing does not find code affected by API breakage.

I do find that well crafted integration tests give the best bang for the buck.

>First of all, I doubt it. Second, you just sound rather arrogant.

This was a mirror image response to your condescending assumption that I "just hadn't worked on large enough code bases"

It's a little sad that you didn't have the self awareness to recognize that my feigned arrogance was satirizing yours ;-)

Re:Seven deadly sins of talking about “types” (2014) by choeger on Saturday December 14, 2019 @07:03PM (#21793322)
> integration tests

if you really worked on large projects you would know that integration tests involve more than just one language. They are a helpful tool, and a very important one. But if I had to rely on integration tests to figure out API breakage, I would have to quote a massive price for any libray upgrade. Fortunately I have cheaper and better means.

> It's a little sad that you didn't have the self awareness to recognize that my feigned arrogance was satirizing yours ;-)

Yeah right. You quote two projects and consider your work better tested than mine. And I am the arrogant one. All I said is that you sound like you did not see the kind of projects I did.

Here's the thing. You either are really up to something and know something that all us soundness-first old farts doni know. Then you are going to revolutionize software development that has been coping with the same issues since the 70s. Or you are simply an arrogant youngster full of Kool aid, and you will crash against the same walls everyone else in the industry did.

Re:Seven deadly sins of talking about “types” (2014) by youerbt on Saturday December 14, 2019 @09:38AM (#21789681)
I can't help the feeling that your post is about Python vs Java rather than static vs dynamic.

And I don't see how your 3 points about the velocity thing are affected by static types.. Like, come on, many points can be argued over compiler usefulness, but help with throwing away code is rather not one of them.

Re:Seven deadly sins of talking about “types” (2014) by pytester on Saturday December 14, 2019 @09:50AM (#21789734)
>I can't help the feeling that your post is about Python vs Java rather than static vs dynamic.

Because the OP was about python and because python and java are the two languages where I have worked on refactorings of large scale code bases.

I can't help but feel that if you make a hypothesis (e.g. "static typing is naturally better"), you need to be open to examples that disprove this hypothesis.

>And I don't see how your 3 points about the velocity thing are affected by static types..

Static typing usually means a lot of time spent satisfying the compiler. I don't disagree that this can be useful because it catches bugs (although a lot of stuff caught by compilers are not bugs). I disagree that this isn't a cost/benefit trade off that naturally works out.

Re:Seven deadly sins of talking about “types” (2014) by youerbt on Saturday December 14, 2019 @10:23AM (#21789888)
I don't think you disprove the hypothesis, though. I think you are talking about equally, if not more, important thing - ergonomics. Java is not an example of static types not bringing in benefits, it's an example of overcoming those benefits by other things.

> I disagree that this isn't a cost/benefit trade off that naturally works out.

I agree, it is. I just think that programming languages are a whole package and Java is really bad with this cost/benefit ratio. I'd rather see something else being an ambassador of static types.

Re:Seven deadly sins of talking about “types” (2014) by pytester on Saturday December 14, 2019 @10:35AM (#21789966)
>I don't think you disprove the hypothesis, though. I think you are talking about equally, if not more, important thing - ergonomics

Types are an intrinsic part of ergonomics.

>I'd rather see something else being an ambassador of static types.

I'd be happy to see another language be an "ambassador of static types" provided the tip of the iceberg of 'visible things built in it' doesn't compromise of say, one spam filter and a file converter.

I'm getting pretty tired of hearing about how awesome and productive haskell's type system is for 15 whole years and seeing a whole lot of evidence that it's waaaaaay too unproductive to build anything of use in it.

Rust is a fine ambassador of static types (and has some great usage examples), but rust and python address extremely different non-overlapping markets and rust isn't shy about the fact it makes it fucking hard to compile things in.

Re:Seven deadly sins of talking about “types” (2014) by youerbt on Saturday December 14, 2019 @11:16AM (#21790216)
> Types are an intrinsic part of ergonomics.

For example creating new type in Java and Rust is a whole different world. If you can't separate Java the language from the idea of static typing and type systems, you are probably not a person suited for such discussion.

As for your remarks about Haskell, welp, I have build things with Haskell and Python, and it's not even close. But I guess chasing runtime exceptions during development is an acquired taste.

Re:Seven deadly sins of talking about “types” (2014) by pytester on Saturday December 14, 2019 @06:56PM (#21793289)
>If you can't separate Java the language from the idea of static typing and type systems

I can. It's people who make blanket statements about static or dynamic typing who can't.

>I guess chasing runtime exceptions during development is an acquired taste.

Much like building software people actually use.