Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
ClySuva19117yWhy would anyone ride a bicycle without a training wheels?! It is much safer with them!
-
@ClySuva If you want to use a bike metaphor, then using a dynamically typed language is like trailing down a mountain with ludicrous speed and in front a corner you want to hit the brakes, but only then you realize that the brakes you were so damn sure were there, are actually in fact null, and you crash and die.
-
@k0pernikus I hardly test my software, but I always test the brakes on my bike
-
ClySuva19117y@k0pernikus your metaphor is just how you feel about it. :D My metaphor has some reasoning behind it:
What do training wheels do on a bike? They make you not fall over. Same with static typing. But if you know how to ride a bike, you won't fall over anyway. Technically you can keep the training wheels even if you are good, but they make the bike a bit more cumbersome.
Same with static typed languages. They are safer, but can become cumbersome. If you compare Java and JS code, for example, on web services, you will often see 6:1 ratio. The code which does exactly the same thing is 6 times less code in JavaScript than it is in Java.
Sometimes this is enough of a reason to choose dynamic language, and if the devs know what they are doing, they write code a lot faster. Specially if you are handling lot of naturally dynamic data.
Lot of web is written in JS, PHP, Python even Perl, including very large projects. -
grayfox35947yWell, it's rather simple actually. You're just careful.
When you program with dynamically typed languages you just don't go changing types of variables everywhere.
I mean, you just don't plug a pen-drive into your phone charger USB port just because it fits.
When programming you simply are careful as in statically typed languages you are with, for example, null pointers. -
In Frink, the variables are dynamically or statically typed depending on how do yo declare them.
Alan Eliasen is wise. -
@antorqs I definitely agree with his definition...
I have never been a big fan of dynamic typed languages since I keep forgetting stuff and I suck at good design...
But I definitely see the appeal in that it’s quicker, and, not that hard to maintain ( or understand ) if u know what ur doing 🙂 -
@ClySuva I’m with @k0pernikus — there’s no real difference at the end of the day in time invested, the difference is that in a dynamically typed language the effort and time is expended after you get fucked over, while a statically typed language will repeatedly fuck you over arbitrarily before that can happen.
A skilled programmer will implement a dynamic
language as well as a static language of course.
The major difference is that the methodology for implementing safety in a dynamic language is comprehensive testing. This is basically the same job that the compiler is doing in a statically typed language. It’s a job that a machine can do, and it’s a job that a machine is infinitely better equipped to do than a human.
So.. aside from arbitrary reasons like requirements and lack of alternatives, what’s the advantage of a dynamic language? -
ClySuva19117y@OscarSouth Sure in case of Dynamic language, you may find a cat in place of brakes on your bike, if someone has done something very silly. :D But even though, you can never put a cat where brakes should be in static language, nothing guarantees the brakes actually work.
The test is pretty similar in both languages, checking whether breaks work. But in dynamic language the test also confirms the breaks are not a cat, otherwise the test would fail.
I do agree the extra safety saves from lots of troubles. Specially in projects where lot of people with various levels of skill are included. But at the same time, using dynamic language may give you a definite edge in flexibility. Specially in projects where just a few, but very good developers are working.
For example: microservices often work great with this approach. There is huge difference in maintainability whether the service is 500 lines of code or 3000. -
@ClySuva yea that sounds like a valid example.
There are statically typed languages such as Haskell though, which’ll require even less lines of code (in general) as well as delivering additional layers of safety and equational reasoning.
Caveat here being the additional barriers to entry that this kind of language can bring. -
aritzh7527y@ClySuva or even better, in a dynamic language, your bike may well have s cat, but as long as it behaves as a brake, you won't really care. (Duck typing FTW)
-
@ClySuva PHP7 supports strict types and I embraced it. For JavaScript projects, I use strongly typed (at compile time at least) TypeScript. I detest the random tricky runtime bug, but especially in large codebases TypeScript had been and still is a lifesaver.
Currently developing a lot with Scala and loving the strong types out of the box.
I cannot be bothered to debug dynamically typed bugs anymore. Lot if programmers are so damn sure that they don't need the "safety wheel", yet I end up fixing their mess after an any cast for them because they weren't thinking about that one edge case crashing the application. -
I love static languages with Type Signatures.
A descriptive one line comment and a Type Signature and you don’t even need to see the function itself to have all the insight you need. -
I used to be a huge defender of static typing, but then I fell in love with dynamic typing. It's awesome to not need to write types. Creating objects with whatever structure you want without creating a class is another thing I love.
On the other hand, I still think that types are necessary when working in a team. Today I had to do something in a project that wasn't mine and I took a long time to find out the structure of an object I needed to pass to a function. If it was typed, I would only need to look at its type.
Everything has its ups and downs. Don't waste so much time arguing which one is better, because it all depends on your context. Instead, try learning what they are good for, use whatever fits you (and your team) best and go build awesome things. -
grayfox35947y@shellbug First, I want to make clear I agree with you.
Ok, the last part of your comment is easily fixed with a good, comprehensive documentation.
I'm an advocate of simple, effective, comprehensive documentation BUT obviously I know that not everyone or everywhere this is the case. -
@antorqs type declarations are a form of documentation (or just communication, at least), just like tests.
-
Dynamic languages are much, much more concise. Simpler to read for beginners.
I still favor static typed ones but when I have an algorithm in mind and need to check it quickly, I'd rather type it into a script console rather than spend an extra minute building and compiling
Related Rants
Why would anybody use dynamically typed languages? I mean it is lot safer to use static languages, no? No weird bugs, no weird outputs...
How they manage to write such big applications in dynamical languages?
question
static
dynamic
typed