3 ms·
How do you write large programs in dynamically typed languages?
I've written a few medium sizes (500-1000) line programs in languages like bash, python, Ruby, and JavaScript. I use these languages because they lends themselves towards scripting (bash, python) or because I'm forced to (Ruby, JavaScript).
At first things are alright. In small programs I can keep track of types and what should be passed where. When programs grow and I try to refactor (50% of my time programming in Java is spent refactoring to keep my programs clean), or when I try to add a feature after taking a several month break, I find myself completely lost and unable to easily make changes.
So, how do you write maintainable programs in scripting languages?
- btilly 6y agoI would recommend that you pick up a book like Code Complete (it may be old, but it is still good) and develop really solid habits about how you name variables, functions, break down your programs, and so on. Getting the minutia right is the key to being able to write maintainable programs up to about 15k lines or so. That's when it starts to make sense to work on paying attention to the big picture while you're in the weeds. But if you're topping out at 500-1000 lines, that's where your problems likely are. (It probably isn't helping you that you're used to using tools that let you not think about the minutia up front and then help you to fix them after the fact.)