Scala
August 20, 2020Scala is a difficult and useful programming languages. One thing I hate about this is there are many ways of doing the same things. It is flexible in that way. It is also simple. A lot less verbosity. If you really know the language, you can do big big things by typing few code. That would be awesome for expert developers. It will take a lot of time for one to get to that level. This way too many options are they for styles too. You can write the way you write in Java too. But functional programming is the best. For that you have to avoid a lot of things scala provides you. Even then people use some things. There are too many features. You have classes and objects. Objects is where you put static methods. You can make classes work like functions and functions work like classes. There are seven or eight different ways of writing functions. You can avoid paranthesis in a lot of places. I don’t know exctly where. The best way is to start coding, with a few features only and learn shortcuts as you go. Better stick to case classes and objects first. And write only pure functions. When you find something that you can’t do with the existing setup, search for option and learn the thing adviced. Case classes are a must but they are classes. But think of them as just types. You don’t write behavior inside them. Pattern matching is awesome. There are implicits. I understand implicits. Some functions take implicit arguments. When calling them you don’t have to pass the argumet, as long there is something of the required type in the context, that is in the stack, that value is used. What happens when there are multiple? Well, I better avoid such situations. I better annotate types everywhere. Avoiding paranthesis is benefitial. When the last argumetn is a function, I can was code block covered by braces, and need not add parantheses. Get this paranthesis problem when writing JS. Is is not here. IDEs or VS plugins are super useful here, I think. Beause of the type system, you get all the warnings and things. You can put anything inside any file, I think and import using the filename, filepath and exported item. It sounds very clean, but people put ugly things there