Open Side Menu Go to the Top
Register
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

01-19-2016 , 03:21 PM
If that code is in your main() function and program execution stops as soon as you boot because you messed up, then that's fine, but what if you make an obvious error buried super deep in some code that rarely runs (but blows up 100% of the time) and it's not caught for awhile? I'm not sure if that's how Python works but that's how JS does.

And that's not to say it crosses some kind of line, or that it's wrong or anything - you can write dumb bugs that will always blow up in C++ too. It's just further down the continuum of tradeoffs between safety and iteration speed, and having spent most of my life working closer on the "safety" side, where the fact that your code even compiles guarantees a base level of "correctness" in what it's doing, it feels odd and new to me to be doing things differently.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-19-2016 , 03:25 PM
Quote:
Originally Posted by daveT
I straddle both worlds using Python and PL, which is weakly typed and strongly typed respectively.
It would be helpful to learn at least one language from the broader ML family (including Haskell, Scala, F#, etc) to place this debate in proper context.

Quote:
Perhaps I'm just too dumb to figure it out, but I never understood the type -vs- typeless debate, but my two cents:

What difference does it make if you call the following with ints, doubles, floats, or numerics?

Code:
average(x, y)
In a typed language, you have a choice between function overloading or local type coercion (I dislike both options). Clearly, you don't take averages of strings.
What's wrong with

average(x: number, y: number):number

where int/double/float/numerics/etc are subtypes of number

average[t/number](x:t, y:t):t

where average is a generic function over type t where t is a subtype of number?

Quote:
What if you want to get user_name by user_id

Code:
get_username_by_userid(user_id)
The function name makes it clear that you are calling by some integer.
How is user_id constrained to be an integer? What's an integer here anyway - is it a 32-bit or 64-bit or system defined? If I later change it to use some kind of GUID string, does it break? What does it break?

Quote:
At a higher level, I think that most of the power of typeless comes from not passing single arguments, but passing along collections, such as arrays, JSON, dctionaries, vectors, or whatever the collection of items are in your code.
The main reason that we have popular dynamically typed languages is that they are a couple of orders of magnitude easier to design and implement, which allows for more of them to exist in the first place.

The other reason is that if most of your code is about talking to the outside world, which is not strictly typed by default (the outside world is not constrained by the language's type system), most of the benefits of a strict type system go away while most of the drawbacks remain.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-19-2016 , 03:30 PM
Quote:
Originally Posted by goofyballer
If that code is in your main() function and program execution stops as soon as you boot because you messed up, then that's fine, but what if you make an obvious error buried super deep in some code that rarely runs (but blows up 100% of the time) and it's not caught for awhile?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-19-2016 , 03:53 PM
Quote:
Originally Posted by goofyballer
If that code is in your main() function and program execution stops as soon as you boot because you messed up, then that's fine, but what if you make an obvious error buried super deep in some code that rarely runs (but blows up 100% of the time) and it's not caught for awhile? I'm not sure if that's how Python works but that's how JS does.
The program with that error won't run at all in Python no matter where it is, and it would be pretty difficult to get to the point where this is deep in code unless you are just writing reams of code without ever compiling.. I think there is some continuum here, but if JS does that, I have to agree that's kind of yucky.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-19-2016 , 04:04 PM
Quote:
Originally Posted by daveT
The program with that error won't run at all in Python no matter where it is, and it would be pretty difficult to get to the point where this is deep in code unless you are just writing reams of code without ever compiling.. I think there is some continuum here, but if JS does that, I have to agree that's kind of yucky.
Python absolutely allows you to run a program that will 100% blow up due to a type error. That's kind of the point.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-19-2016 , 04:10 PM
I'm not sure if you mean "that is a good thing" (in which case, wat) or "that is a worthy tradeoff to get the good parts of weakly typed languages" (subjective but valid).
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-19-2016 , 04:18 PM
I've never understood these arguments mostly because it just makes sense to me the way JS does it. Hey my function is expecting a string? OK, send it a string. Oh it didn't give a string and blew up when I ran it and it told me what line it blew up on? OK fix that?

I guess compile-time checking would be nice to catch those but with babel/eslint/jshint catching any bad CODE on save ('unexpected token', gulp outputs an error to the notify window instantly) I'm fine with my toolkit and the language.

Other than 0 being falsey that **** sucks.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-19-2016 , 04:19 PM
Goofy Im 100% with you and thats generally my gripe when using python, but Im guessing its just because I also started off with static typing. Luckily there is scala so I can at least pretend Im a dynamic, functional programmer

Sounds like its just what youre used to.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-19-2016 , 04:28 PM
Quote:
Originally Posted by goofyballer
I'm not sure if you mean "that is a good thing" (in which case, wat) or "that is a worthy tradeoff to get the good parts of weakly typed languages" (subjective but valid).
It's like how guns killing people is a feature.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-19-2016 , 04:42 PM
But if we could make your gun be like "oh hey, I detected that you're pointing this at a human and you haven't activated the 'this is an emergency' switch, so I'm gonna do the world a solid and not fire a bullet right now", that would be pretty cool!
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-19-2016 , 04:45 PM
Is everyone here familiar with the worse is better essay?

http://dreamsongs.com/RiseOfWorseIsBetter.html

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

Dynamically typed languages (ironic given the origin of the essay) are a classic case of worse is better - it's just so much easier to design and implement an acceptable dynamically typed language that it's what you end up with by default unless you have a massive budget and/or some kind of programming language + type theory experts. They are also much easier to learn and use, which means it follows worse is better on the adoption side as well. The fact that statically typed languages are as popular as they are, given the enormous evolutionary disadvantage they carry, says a lot about the importance of compile-time type checks. I will add that dynamically typed languages tend to evolve towards static types as well.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-19-2016 , 04:48 PM
I will do whatever I can to avoid creating another non-trivial Python production application.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-19-2016 , 04:58 PM
Quote:
Originally Posted by candybar
Is everyone here familiar with the worse is better essay?

http://dreamsongs.com/RiseOfWorseIsBetter.html

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

Dynamically typed languages (ironic given the origin of the essay) are a classic case of worse is better - it's just so much easier to design and implement an acceptable dynamically typed language that it's what you end up with by default unless you have a massive budget and/or some kind of programming language + type theory experts. They are also much easier to learn and use, which means it follows worse is better on the adoption side as well. The fact that statically typed languages are as popular as they are, given the enormous evolutionary disadvantage they carry, says a lot about the importance of compile-time type checks. I will add that dynamically typed languages tend to evolve towards static types as well.
Thoughts on TypeScript? We're starting to play around with it now. Will Sublime do all the possible compile time checking or do we need something like WebStorm?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-19-2016 , 05:06 PM
Quote:
Originally Posted by jjshabado
I will do whatever I can to avoid creating another non-trivial Python production application.
Do you mind elaborating on this?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-19-2016 , 05:19 PM
Quote:
Originally Posted by suzzer99
Thoughts on TypeScript? We're starting to play around with it now. Will Sublime do all the possible compile time checking or do we need something like WebStorm?
This is a tough one because some of the advantages are offset by the risk of ending up with an obsolete codebase (due to TypeScript falling out of favor much like CoffeeScript) but given how poorly JavaScript code bases age anyhow, the likely popularity of TypeScript going forward and generally readable JS output that the TypeScript compiler generates, I would be okay using it for production apps.

No idea about the IDE support for it though.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-19-2016 , 05:27 PM
Quote:
Originally Posted by candybar
Well, any kind of selective bootcamp signals that 1) they are able to pass some kind of selective admissions process and 2) they are serious about a technical career. 1) is mostly why people care about a degree from a good college and 1) and 2) are entirely why people care about an MBA degree from a top school.

I've been mostly wondering why solid CS graduates from 2nd-tier state colleges demand quite a bit less out of school than top bootcamp graduates even though they are generally better programmers and much stronger in terms of fundamentals.



One thing I did notice was that their projects were designed to be easily presented and they were presented in a very similar way on a very boilerplatey, but good-looking portfolio page. Everything they did is on GitHub, their cover letters and resumes are uniformly well-written and well-presented. But I don't know how much is the bootcamp and how much is just standard advice that's out there and the fact that these people at one point pursued careers outside of tech where resume, cover letters, etc are more important.



This kind of setup sounds definitely good for motivation and learning.

I don't think I would hire out of bootcamps but I would definitely encourage people to go to bootcamps.
Posting from my phone so I apologize for the format.

Regarding signals, I agree with you in theory. Many people don't see it that way and maybe even associate a negative stigma with boot camps. Until pretty recently app academy encouraged students not to mention that they went to a boot camp on resumes or in cover letters.

I'm not sure if it's actively encouraged now but when mentioned they try to make sure students couch it with something like "Graduated from App Academy, a 3 month, 1000+ hour boot camp with an acceptance rate of under 5%"

Certainly the boot camps know that their students need an easily understood, visual portfolio. Students are encouraged to clone a relatively pretty, well known site and polish up some of the games and mini site clones that are done through the course of the program.

Regarding CS grads from mid tier schools asking for less money, I think there are a few factors. Boot camp grads are going to be productive from day one assuming they land somewhere with a stack they're familiar with. They're going to be junior, but they know the frameworks pretty well. This isn't necessarily the case with a lot of recent grads.

And it's not just framework and language familiarity too. They know how to use git and have some practice breaking down and scoping projects. My understanding is that many CS programs still don't tech any of these skills.

Lastly, these boot camps keep track of where their students go and how much they make for marketing purposes (or tuition calculation in the case of App Academy). As a result they are able to speak with confidence about what is available and how much the skill set is worth on the market.

I think there are valid reasons to prefer hiring from the set of boot camp grads or cs grads, but ultimately I think the choice is close and should be dictated by the needs of your company. Both groups have gaps, they're just in different places.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-19-2016 , 05:47 PM
Timely article from HN http://games.greggman.com/game/dynam...static-typing/ cliffs: the safety you get from static typing is not worth the development/debugging time spent vs dynamic languages.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-19-2016 , 06:02 PM
I just set up typescript to work with vim about a week ago. The auto completion boost it gives is pretty amazing and would be very helpful when working with some large unfamiliar codebase. I don't have it doing syntax highlighting with errors in real time, the typescript compiler just outputs the errors in another terminal.

Writing out type annotations doesn't seem like a huge time sink or annoyance to me tbh. But it feels like people abuse it and start making everything implement an extension of an extension of an interface and soon the code looks like java.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-19-2016 , 06:13 PM
Quote:
Originally Posted by Grue
Timely article from HN http://games.greggman.com/game/dynam...static-typing/ cliffs: the safety you get from static typing is not worth the development/debugging time spent vs dynamic languages.
Good read, thanks.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-19-2016 , 06:15 PM
Quote:
Originally Posted by Grue
Timely article from HN http://games.greggman.com/game/dynam...static-typing/ cliffs: the safety you get from static typing is not worth the development/debugging time spent vs dynamic languages.
In all fairness, statically typed languages tend to be much more verbose. Java and C# aren't exactly compact languages.

If you can get the brevity and speed development of Lisp / JS / Python / Ruby and tack on types, I'd like to see a one-to-one comparison there.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-19-2016 , 06:16 PM
Quote:
Originally Posted by Grue
Timely article from HN http://games.greggman.com/game/dynam...static-typing/ cliffs: the safety you get from static typing is not worth the development/debugging time spent vs dynamic languages.
http://danluu.com/empirical-pl/
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-19-2016 , 09:16 PM
Quote:
Originally Posted by daveT
In all fairness, statically typed languages tend to be much more verbose. Java and C# aren't exactly compact languages.

If you can get the brevity and speed development of Lisp / JS / Python / Ruby and tack on types, I'd like to see a one-to-one comparison there.
i believe haskell fits that bill
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-19-2016 , 10:24 PM
Quote:
Originally Posted by goofyballer
Good read, thanks.
There's this comment though which I agree with:

Quote:
Prechelt's work compares the lamguage landscape 20 years ago, and even then drew fire for not actually using the modern variants of static typing as its basis, instead focusing on the antiquated typing of Java and C++ (of 1999) and deliberately avoided allowing C++ templating. It was a stacked deck and out of date.

This sentiment you're expressing has been on repeat for 10 years and almost exclusively is told by people who only have exposure to very bad type systems that are left as slavish copies of legacy type systems, "for ease of learning." Modern type systems like OCaml and Haskell are not so incomprehensible as dynamic typing proponents would want you to believe and often times have fewer type checks (in the form of things like nil guards, chained Boolean operators using nil punning, etc) than dynamic code.

What's more, WRITING code speed is the most vacuous and saccharine of all metrics. Dashing out code promptly feels good, but is almost never the actual problem when it comes to launching products to production.
The right answer really is that if you're working on an app where correctness and error rate are big concerns, the code should be unit tested whether you're working in a statically typed language or not. Adding tests which ensure type safety where needed in a dynamic language is trivial compared to all the boilerplate you have to write in static typing.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-19-2016 , 10:53 PM
Quote:
Originally Posted by ChrisV
Adding tests which ensure type safety where needed in a dynamic language is trivial compared to all the boilerplate you have to write in static typing.
What? Boilerplate is easy to write in any modern IDE. I have no idea how you think it can be so much more work than writing tests.

I'm going to avoid getting into something as complex as type arguments. My earlier comment about Python applications is based around my belief that large python applications are much harder to maintain long term than equivalent applications written in many statically typed languages.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
01-19-2016 , 11:12 PM
Quote:
Originally Posted by ChrisV
The right answer really is that if you're working on an app where correctness and error rate are big concerns, the code should be unit tested whether you're working in a statically typed language or not. Adding tests which ensure type safety where needed in a dynamic language is trivial compared to all the boilerplate you have to write in static typing.
Unit tests don't ensure type safety - writing unit tests for type safety is actually very difficult and virtually never done systematically. Typically unit tests are of the form where when function f is called with arguments x, y and z, it should return value v. Unless you've somehow made it the function's responsibility to handle type errors, in which case your code would be even more verbose than boilerplate in static typing because every function would have a preamble that declares and checks arguments types, you need to make sure that f is never called with wrong argument types. This means the responsibility for ensuring that f is called a type-safe manner is scattered around in unit tests for various other functions that happen to call f and if f is part of a dependency that's injected/mocked, it's extremely easy to make a wrong assumption and/or test against wrong types. Remember, in the absence of a type checker, your brain has to know exactly what the valid argument types are when you're writing tests.

And that's still assuming you're using dynamically typed languages as statically typed languages without compiler errors. If you fully take advantage of the fact that the variables are not typed and can contain differently typed values at runtime with no constraint, you're in a much worse shape because it's very easy to have 100% test coverage and still have show-stopping type errors. And with dynamically typed languages is that you don't know which situation you're in - it's not like it tells you if you're using the same variable/parameter for differently typed values at different times.

I think part of the reason that a lot of people don't think that it's a big deal is because even most mainstream statically typed languages are dynamically typed with respect to some key aspects. C++/C#/Java all have nulls which make all object types dynamically typed with respect to null and have historically encouraged the use of unsafe casting instead of proper union types or generics, often to get around historical limitations, some of which don't exist anymore. But the benefits of static typing apply even here - the less you rely on these "dynamic" features, the better type checking works for you. For example, Scala retains Java's null semantics but because I never really used null in Scala code, I don't think I've ever seen a NPE while coding in Scala except when relying on Java libraries because in idiomatic Scala code, you don't use "dynamic" nulls - you use static "Option[T]" which is a type-safe way to handling optional values.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote

      
m