Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Mastering Functional Programming

You're reading from   Mastering Functional Programming Functional techniques for sequential and parallel programming with Scala

Arrow left icon
Product type Paperback
Published in Aug 2018
Publisher Packt
ISBN-13 9781788620796
Length 380 pages
Edition 1st Edition
Languages
Arrow right icon
Toc

Table of Contents (23) Chapters Close

Title Page
Copyright and Credits
Dedication
Packt Upsell
Contributors
Preface
1. The Declarative Programming Style 2. Functions and Lambdas FREE CHAPTER 3. Functional Data Structures 4. The Problem of Side Effects 5. Effect Types - Abstracting Away Side Effects 6. Effect Types in Practice 7. The Idea of the Type Classes 8. Basic Type Classes and Their Usage 9. Libraries for Pure Functional Programming 10. Patterns of Advanced Functional Programming 11. Introduction to the Actor Model 12. The Actor Model in Practice 13. Use Case - A Parallel Web Crawler 1. Introduction to Scala 2. Assessments 3. Other Books You May Enjoy Index

Motivation for using Scala


The primary motivation for using Scala for examples in this book is as follows. First of all, Scala is a functional language. This means that it has support for almost all of the functional programming styles that have been developed so far. Another reason for choosing Scala is that it is designed explicitly with object-oriented programmers in mind. Scala positions itself as a mix between object-oriented and functional languages. This means that new programmers that come from the object-oriented world can use Scala as an object-oriented language. This facilitates the transition from the object-oriented style. In fact, Scala is often used as Java without semicolons, meaning that you can program your Scala programs similarly to how you used to program your Java programs. The preceding reasons facilitate transition for new programmers greatly. Also, Scala features a very powerful mechanics for functional programming. So, you can write functional programs just the way you would do in Haskell.

 

We can even say that Scala is more potent than Haskell because, in some circumstances, the object-oriented approach is absolutely necessary. You can access the entire JVM infrastructure, meaning that you can use any Java library from Scala easily. The infrastructure is very mature and industry-oriented. Unfortunately, you cannot say the same thing about Haskell, which is less production-ready than JVM languages. Purely functional languages such as Haskell are used in production. However, they do not possess as mature infrastructure, say, for dependency management or compile tools as does Scala. Even though you can use all of the object-oriented libraries from Java in Scala, there is an entire host of native libraries for Scala, which are also production-ready and can facilitate a purely functional programming style.

A final thing about Scala worth mentioning is that it is an experimental language. This means it is often used as a playground to test new features and research in computer science. This means that leading-edge research is available to you as a Scala programmer. Combine that with accessibility to JVM, and you get an ideal tool to advance your knowledge in computer science while developing real-world software.

In short, all of this means that while using Scala, you can use a wide spectrum of styles, from a conventional object-oriented approach all the way to leading edge functional programming research. This makes it a great language for examples in this books.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime
Visually different images