Generally I agree. However, we shouldn’t be developing 100k+ line applications in general (note that I’m not saying ever). Rather, we should be building smaller components and composing them into larger applications. Additionally, 100k lines of Java is probably only 30k lines of python.
To your points about dynamically typed languages and speed, I agree. Though, I wouldn’t say that the obvious solution is Java...
C# really is a very nice language. If it played more nicely with platforms other than Windows, I think it would have been an ideal choice for medium-sized projects and larger. It's a bit of a statically typed Python with a little more cluttered syntax.
As to why someone would want to add type declarations to a dynamically typed language. In my opinion static (i.e written in the code) types are convenient where the types are known while writing the code. Sometimes, however, this is not the case. Types can be created at runtime, by querying the database or reading from a .json. A Qt designer file gives you a QWidget subclass. SQLite and key-value stores hold untyped objects. Any metaclass action results in a class that's generated in runtime.
In these cases, having a static type system would make you work with it somehow. It can be generating class declarations from configuration files as part of the build process (which .NET does). It can be creating an "interface" ISomethingThatGoesInTheDatabase with subclasses DBInt, DBString, DBUserProfile, etc, thereby duplicating a class hierarchy (and yes, I've seen that happen in a Java project).
Many of these issues can be overcome by using Object in statically typed code. However, that's very frowned upon by static typing people. I think Python type annotations might hit the sweet spot - you can use them wherever they're useful, but you don't have to use them where they don't make sense.
The last time I used the .NET ORM stuff it used code generation. It doesn't surprise me to know that it's better these days, because the language designers generally make good decisions.
If you're working with two untyped systems - by which I mean systems that would work with all types - then you don't need to know what you're working with. For example, an event/notification system. The code that handles the method arguments doesn't need to know what type they are. The best you can do is treating them as Object[]; creating INotificationMethodCallArguments is much worse than just not knowing what type it is. Once someone decided to create a superclass or an interface (it's an is-a relationship, right?), you have to create classes that wrap existing classes and it becomes a huge and useless waste of time.
Likewise a storage system. It takes stuff and stores it, then retrieves it for you. You know what you're going to get, but the storage system doesn't know what it's going to give you. It should handle Objects, not IRetrievedItem. When I worked in Java, there were so many useless types.
Hence. If you know the type, by all means write it down. If you don't, don't. Don't create a new type so that you have something to write down. And while in most cases you know the type, the overhead of these useless types was a huge weight on the back of that Java team I was part of, because these types then invade normal code, conversions start happening back and forth... It's not pretty.
Do you feel comfortable deploying that code to production without code review, unit tests, integration tests, and passing all of the system tests?
It doesn't matter what language I use, I am going to engage a sane testing policy to ensure the highest quality product possible.
I have found that the ratio of testing to lines of code remains about the same regardless of what language I use. So I try to reduce the lines of code and redundant information in the code.
I could probably reduce your code above to a few lines of Python, and still keep it under 80 chars per column. Add a few unit tests, and it will be ready for system integration before lunch.
0
u/[deleted] Jan 05 '18
[deleted]