![]() ![]() You have a guaranteed very easy process to deploy and maintain applications, with a great performance!Ģ. The second point, which is that you have the best of both worlds! why should you use Java and stuck to OOP* or use Haskell and stuck to FP while you can get them together? Ok, I know that Java 8 introduced a lot of features to support FP, but that nothing compared to what Scala offers. That’s an incontestable point since JVM is mature enough, optimized enough, and have been in use for over than 15 years. #SCALA PROGRAMMING CODE#In general, most of the programmers use OOP as the main paradigm and FP when they need to, which in most cases make the code simpler, shorter, and easier to understand and maintain.ġ. I will start with you, Java developers, because we share a lot together, we use the same base, yes, the JVM. The one should not treat OOP and FP as 2 worlds who should use one of them, even that’s possible in some cases, but to combine them both and use each of them when he/she needs to, and that’s exactly why Scala is found. In Scala, we can generalize (or converts) methods to functions, so we can use them outside the class they belong to! A method, in general, is a piece of code that does something and attached to a context, i.e, belongs to a class, while a function is simply a verb that does something or performs an action. ![]() To be closer to understand what the functions are, we want to quickly compare them with methods. Let’s back to the fact that every function is a value in Scala, that’s simply mean you can use a function anywhere you can use a value. This is not a place to introduce functional programming style and benefits, but I will mention what help us here. That maybe sounds weird or even crazy, but it opens a whole new world and programming style/paradigm that Scala supports, which is the functional programming world. Scala is also a functional language in the sense that every function is a value. It’s even more object-oriented than Java, by that I mean that any value, even integers and doubles are objects! this opens a new world of no-special treatment for primitive values. Scala is a pure object-oriented language in the sense that every value is an object. In this blog, I will try to make this introduction some way simpler with a taste of real Scala examples, note that I’m assuming a general knowledge of other object-oriented languages like Java or C# but no functional programming knowledge is ok. This is how Scala official website introduces the language to the world. Scala’s static types help avoid bugs in complex applications, and its JVM and JavaScript runtimes let you build high-performance systems with easy access to huge ecosystems of libraries”. “Scala combines object-oriented and functional programming in one concise, high-level language. Go Back Happy Saturday everyone! In this article Mohammad Noor Abu Khleif explains why his preferred functional language is Scala and explains a bit more about Scala. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |