News for hackers. Stuff that matters.
Re:Why We Chose Typescript by ATsch on Friday June 30, 2017 @07:58PM (#14674356)
> their mistake of using python on the server side

I could not disagree with this sentiment more. As always, reality is more nuanced than this.

There seems to be a common theme of startups succeeding with dynamically typed languages, and adding static typing later. However calling the original decision a "mistake" is neither fair nor accurate.

After all, you don't buy a big mansion out of college because you are going to have a family one day. What is right for you today might not be right for you today.

Companies change as they grow, and switching from move-fast-and-break-things to slow and steady mode is just one of those things alongside all others.

Dynamic languages were great at bringing these companies where they are now: it allowed them to be agile and fast to market with a small team.

Are they going to benefit from switching? Yes, absolutely. But was the original decision a mistake just because the priorities and cost/benefit curves have changed now? I really doubt it.

Re:Why We Chose Typescript by slackingoff2017 on Saturday July 01, 2017 @05:55AM (#14676320)
Having used many languages over the years, the biggest advantage I've seen to dynamically typed languages is that they're easier to learn.

Python and JavaScript are probably the most common "first languages" taught in school. The dynamic typing and lack of complex IDE, compilation, and build system make then easier to learn. Most founders only have a few years of programming experience. Most startups can't afford to hire anyone experienced. Given these constraints, using these languages makes sense.

Dynamic language aren't any faster in practice. You can write quick and dirty spaghetti code in anything. It's only the naive that consider building large, or potentially large, projects in languages without static typing and strong IDE support.

In time I've realized that dynamic typing doesn't give any real advantages. It allows you to reuse variables, something that should never be done. It allows you to put different objects in the same array without having anything in common, which also seems like a bad idea. What else do you get? The language still has types they're just not visible when your writing code. I would much rather have compile-time types so I can use auto complete

Re:Why We Chose Typescript by adamlett on Saturday July 01, 2017 @08:36AM (#14676840)
Having used many languages over the years, the biggest advantage I've seen to dynamically typed languages is that they're easier to learn.

I love Ruby because of its delightful standard library, its thoughtful syntax which makes manual refactorings easy, not because or in spite of its dynamic types.

I detest Java because of its verbose syntax, its love affair with XML, and because it isn't a good unix citizen. Not because of or in spite of its static type system.

I detest Javascript because of its non-existent standard library, its many, many design errors (slowly being fixed, I know). Not because of its particular type system.

All other things being equal, I would prefer my language of choice to have statically checked, expressive type system. Unfortunately, all other things have not been close to equal historically. Things are improving, and maybe these days it's possible to have your cake and eat it too.

Re:Why We Chose Typescript by sametmax on Saturday July 01, 2017 @11:29AM (#14677496)
In practice the Python language is so easy that you rarely have bugs related to types. And when you got it, you find it out pretty early.

Types are useful when you grow, but thinking that you can't do anything big and robust without it is ignoring all the people that actually do so.

Another thing is that the simplicity and power of Python leads to having a lot of libs that are actually clean and solid for a lot of stuff. If I need to create anything under 100000 vis/day, I'm 3 times faster than a Go or Java dev on the backend. Literally 3 times.

I also produce better results. With things like Django rest framework, I can get the same REST API, but all the edge cases will be way better handled, small error messages, multi type of auth, etc.

Those things exist because it's fast to code in Python. And yes, dynamic typing help with that a lot.

So yes, it's true I don't have as much code completion and I have to remember a bit more about the code, but it's an exchange I'm making.

When I want to scale up robustness, I use type hints with mypy and get a strong code completion on PyCharm.

Re:Why We Chose Typescript by slackingoff2017 on Saturday July 01, 2017 @12:23PM (#14677722)
3 times faster with zero proof? Java has similar REST frameworks, notably Jersey and Spring Boot. There's also the Play/Dropwizard crowd and Vert.x . Look at spring boot code vs flask, it's almost identical.

Java libraries, particularly those maintained by Google and other tech giants are some of the most solid code ever written. I doubt Python or any other language comes close to the quality of popular Java libraries.

I still don't see how dynamic typing helps with speed? Any Decent IDE will fill in the types for you so you don't even need to key then mostly

Re:Why We Chose Typescript by ApolloFortyNine on Saturday July 01, 2017 @01:07PM (#14677894)
Actually develop in spring boot vs flask, and you'll see just how much faster it is to code in flask. Spring Boot has many peculiarities and boiler plate you have to deal with. Flask just works.

>I doubt Python or any other language comes close to the quality of popular Java libraries.

You complain about proof and then you throw out this line.

Re:Why We Chose Typescript by sametmax on Saturday July 01, 2017 @01:02PM (#14677865)
There is no proof of anything in any comments in this thread.
Re:Why We Chose Typescript by slackingoff2017 on Saturday July 01, 2017 @01:38PM (#14678031)
Hahaha yeah I just realized I've precipitated a classic flamewar, oops. I'll recuse myself from making further comments on this thread. :)
Re:Why We Chose Typescript by dboreham on Saturday July 01, 2017 @07:27AM (#14676612)
Couldn't have written this any better. Also add the need to write shed loads of "test code" in order to reduce the probability of runtime fatal errors that would have been caught by a compiler; and the fact that source code becomes very hard to understand and maintain due to lack of semantic clues from things like types and structure definitions.
Re:Why We Chose Typescript by orangecat on Saturday July 01, 2017 @12:43PM (#14677795)
Also add the need to write shed loads of "test code" in order to reduce the probability of runtime fatal errors that would have been caught by a compiler

People always say this, and I've never understood it. Can somebody provide an example of a test that you "have" to write in a dynamically typed language that you wouldn't with static typing? If you're referencing nonexistent properties, then any test that hits that line will fail, and such a test should exist regardless of whether you're using static types.

Re:Why We Chose Typescript by TimJYoung on Sunday July 02, 2017 @10:27AM (#14682621)
No, that's exactly the point: with a statically-typed language, you wouldn't need a test for a non-existent property reference. The compiler will choke on the bad reference, and any test that uses/references the module in which the code resides will fail to compile. In other words, just simply trying to compile the complete codebase serves as a baseline "type/sanity test". The compiler will simply not allow you to produce an application containing such code.
Re:Why We Chose Typescript by thomasz on Saturday July 01, 2017 @01:36AM (#14675563)
>There seems to be a common theme of startups succeeding with dynamically typed languages, and adding static typing later. However calling the original decision a "mistake" is neither fair nor accurate.

People forget how old reddit is. Most good options in this space for statically compiled languages did not exist back then, so there wasn't really a decision to make. It even predates rails.

Re:Why We Chose Typescript by crucialfelix on Saturday July 01, 2017 @01:58AM (#14675630)
and that until 2005 reddit was written in Lisp
Re:Why We Chose Typescript by bayesian_horse on Saturday July 01, 2017 @05:08AM (#14676189)
And there still is no prove that statically typed languages are somehow more productive or scaleable. It's just taken as an article of faith.
Re:Why We Chose Typescript by Sorreah on Saturday July 01, 2017 @09:09AM (#14676950)
It's hard to "prove" anything in discussions like this. Having been thrown in a few million loc projects, all written rather badly, I found it way easier to figure out what was going on in the ones with static types. At the very least, if you're inheriting an unknown codebase static types are in my experience a 10x speedup when measuring time to actually getting productive.
Re:Why We Chose Typescript by watwut on Saturday July 01, 2017 @11:08AM (#14677415)
Dynamic language does not make you more agile, it makes changes more risky and refactoring harder.

However, large part is that for frontend, static languages are just getting there. You need not just language, but also libraries, tutorials, tooling, IDE and so on and so forth.

Typescript nor flow does not absolve you from the need to learn javascript and web in general. If you are working on your first bigger project and still learning good techniques, architecture and concepts, css, having to also learn typescript or flow syntax on top of it off-puts people.

Re:Why We Chose Typescript by peatmoss on Saturday July 01, 2017 @10:02AM (#14677145)
This is partly why I'm so curious about languages like Racket, that let you start with easy, freewheeling dynamic typing, and then move, in parts, to Typed Racket. We just need to convince some big software engineering project to start down that road, so we can collect the data about the approach :-p