this post was submitted on 24 Jul 2023
68 points (93.6% liked)

Programming

17017 readers
560 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 1 year ago
MODERATORS
top 11 comments
sorted by: hot top controversial new old
[–] beefsack@lemmy.world 47 points 1 year ago* (last edited 1 year ago) (5 children)

I remember my time doing Ruby was really informative about testing and languages in general.

The Ruby community was really great at doing automated testing and it's actually where I really cut my teeth on testing, but if you go back and look at the tests you'll find heaps of them are testing and checking types for functions. It almost felt like people were building static typing using automated tests.

Some people bang on about static typing getting in the way of agility, but the reality is that you either end up spending the time creating extra tests, or you end up cutting corners and creating unreliable software which you'll spend a lot of time troubleshooting down the road. You end up paying a big price to save a marginal amount of time at the start of a project.

[–] fubo@lemmy.world 27 points 1 year ago

Some inexperienced programmers hear "static typing" and think "Java".

[–] gnus_migrate@programming.dev 27 points 1 year ago

Also being able to prove the relationship between different parts of the code enables a lot of productivity tooling like IDEs. Simple things like renaming a class or a struct become chores at best in a statically typed language, whereas in dynamic languages there is an element of risk in refactorings like that.

[–] maegul@lemmy.ml 10 points 1 year ago

Some people bang on about static typing getting in the way of agility

With live/inline static typing checkers in editors (with, eg, VSCode's LSP system), there's IMO an obvious boost to "agility" in preventing minor unforced errors/bugs basically they're even written. Passing the right arguments to the function? Correctly processed an object or data structure? Function matches the required API? Live type checker will often answer those questions straight away without having look up or check anything.

[–] kool_newt@lemm.ee 5 points 1 year ago (1 children)

Check out Crystal, it's like static typed Ruby.

[–] attn_dfct_dev@programming.dev 1 points 1 year ago (2 children)

Is there a static typed equivalent of Python? Not MyPy, but a static Pythonic language.

[–] kool_newt@lemm.ee 2 points 1 year ago

Huh, I've never heard of anything like that.

[–] henfredemars@infosec.pub 3 points 1 year ago

I really like the mix we have at work with Python. We type all methods, but no typing in the body unless the code is unclear. We treat it more like if it were a statically typed language with type inference. This gives the IDE loads of info to work with for refactoring and warnings. The reality of dynamic typing is more like an implementation detail.

[–] muhanga@programming.dev 3 points 1 year ago* (last edited 1 year ago)

And also there is a lot of cases where you really don't need or want static typing. Static typing and type systems are great when they helping you but very bad when you are forced to fight them due to compiler problems or bad modeling.

In the end it is all an engineering problem: which amount of your budget you need to spend on proving programm correctness. Cost/benefit and all of that.

Static typing and unit tests don't make your codebases great, safe and supportable. Thinking and understanding your usecases, decomplecting problems and some future planning wins.

[–] Sigmatics@lemmy.ca 3 points 1 year ago

You should place more emphasis on the discovered bugs and runtime errors in the results section.

load more comments
view more: next ›