Programming language as a vehicle to express programmer’s thoughts is key to any software development. Functional programming languages on JVM (Java Virtual Machine) , given their focus on abstraction, have their special positions for financial services companies like Morgan Stanley – as the problem domain is highly complex and computationally expensive while the systems operate in a large-scale distributed environment. The complexity of the problem domain brings the challenge of maintaining balance between correctness and performance, while the large-scale distributed environment leads to another dimension of complexity in operations. The Scala programming language not only inherits from its root in being Functional Programming, but also embraces the Java ecosystem and OOP model, which unleashes its functional programming power to the real world and makes it possible to build large production systems and to evolve at a faster pace, optimizing performance while maintaining correctness. In this session, we will explore and explain the benefits of a few fundamental elements in Scala that form the basis of its power: principle of referential transparency, higher-order functions, async/await facility, and its type system. In addition, we will also cover briefly its history from the beginning, and its upcoming features towards the end.
Building upon the discussion in the prior session that introduces Scala as a functional programming language on JVM (Java Virtual Machine) and its fundamental elements of its power, this session will provide a concrete example in code by illustrating those key concepts. Focusing on a simple and natural extension that Morgan Stanley built via Scala’s compiler plugin mechanism, and relating the syntax to its corresponding semantics, especially its optimized program behavior at runtime while being succinct in source form, an essential analysis will be conducted to show how the afore-mentioned benefits can be realized, for example general-purpose caching, asynchronous I/O, harnessing multi-core, and distribution of calculation, etc. Various classical optimization techniques can be applied without changing the source program text, so that it remains clear in terms of logic and intent, while only annotation is necessary for those optimization to materialize, thus maintaining the correctness when we optimize. All these make it possible for Morgan Stanley to run large-scale complex analyses on grids of machines, with predictable performance, to achieve demanding SLA (Service Level Agreement), in an ever-changing market.