Functional programming is becoming increasingly widespread in industry. This trend is driven by the adoption of Scala as the main programming language for many applications. Scala fuses functional and object-oriented programming in a practical package. It interoperates seamlessly with both Java and Javascript. Scala is the implementation language of many important frameworks, including Apache Spark, Kafka, and Akka. It provides the core infrastructure for sites such as Twitter, Tumblr and also Coursera.
In this course you will discover the elements of the functional programming style and learn how to apply them usefully in your daily programming tasks. You will also develop a solid foundation for reasoning about functional programs, by touching upon proofs of invariants and the tracing of execution symbolically.
The course is hands on; most units introduce short programs that serve as illustrations of important concepts and invite you to play with them, modifying and improving them. The course is complemented by a series programming projects as homework assignments.
Recommended background: You should have at least one year programming experience. Proficiency with Java or C# is ideal, but experience with other languages such as C/C++, Python, Javascript or Ruby is also sufficient. You should have some familiarity using the command line.

II

The course develops the concepts of functional programming from scratch. With fun and challenging programming assignments, it gives ample opportunity to wrap your head around the alternate paradigm.

GB

Aug 13, 2017

Filled StarFilled StarFilled StarFilled StarFilled Star

An excellent introduction to the concepts of functional programming that had the "side-effect" of getting me hooked on the language! (Even though the hipster in me really wanted to prefer Clojure.)

수업에서

Getting Started + Functions & Evaluation

Get up and running with Scala on your computer. Complete an example assignment to familiarize yourself with our unique way of submitting assignments. In this week, we'll learn the difference between functional imperative programming. We step through the basics of Scala; covering expressions, evaluation, conditionals, functions, and recursion

강사:

Martin Odersky

Professor

스크립트

System, so the cutting of the section in the video lectures part of the class website. Everything that is shown on this video, is also explained in text and tools of that page to the class website. So, we are here, and we need to install a few things for our class. The first one is the JDK, the Java development kit, just a random environment in which Scala programs are executed. This time the same as the [INAUDIBLE] which is strongly recommended to use this version over Java 7 and 6. The second one, this is SBT. The main build tool for Scala which we'll use for building your programs and submitting your assignments through Coursera. Last but not least, we need an IDE that will help us to go within Scala. In this case, we're going to show you how to install. There are other options, though, you can also use the Scala IDE and sign. Well, let's get started by installing JDK. Here there are three subsections for each operating system. As we are in Ubuntu, let's go to the right section. You have another Linux operating system. You can check which comments are necessary to install Java either in this website or in the official website offering the solution. In this tutorial ,we're only going to cover Ubuntu deviant systems. But, installing another system is pretty straightforward. Usually, this is done with pseudo app get, install, open JDK, 8JDK. As we have already installed Java, we are going to skip this process. But we're going to show you how this is done. So we go to the terminal, and we type pseudoapp.getinstall, open JDK8 JDK. Type our password and we'll see that in that place. And we have already installed this version. In case you need to check if you have the right Java version, you have to do java-version. And you type in the terminal and you press OK, enter. And you will see that the first line, that version that you have is in here. In this case, we have Java 8. Let's install SBT, in order to install SBT, first, we need to unload it. Installing SBT and we click this, this link which will refer you to this website. Actually, let's wait. Cool. So we go to this link. And now we have the instructions to install SBT in any system. So we go to the Linux link. And we'll see here, the commands that we need to execute, so that SBT is installed in our system. The first ones, are creating a new repository, while, having a new repository to the system. And, update it, so that we can install SBT with this simple comment. So, let's copy paste this comments. We go to the Terminal and we paste them. Once SBT is installed, let's check that we have the right version of SBT. For that, we need to type SBT about. This is usually going to take some time on the first time you execute it because SBT has to bootstrap itself. As you see here, we do have the right version, 0.13.11. As a side note, SBT versions, are backwards compatible with previous versions of SBT, but not the other way around. That's good to know, when we use SBT in our daily workflow. So, now it's saying it's intalling IntelliJ IDEA. For that, we need to go back to the tutorial, and we also go here, in this thing, to install this idea tutorial. So, First, we need to download Intellij IDEA. For that, we need to get to the official website and make sure that we are in the Linux option. And we download the IntelliJ IDEA. As we have already done this, we just need to go to the, Downloads folder. Oops, here, yeah. And we'll see that we have the compressed file that we have just downloaded and the file or the folder that is the result of decompressing this file. So usually you can just decompress this file with x + v + F6. And we're going to do it again. Cool. So we have the folder here. Right? And what we need to do is to go in, and we'll see that we have several folders. Bin, lib, plugins, etc. So what we need to do is to go to the binary folder, and we need to execute the script that's going to execute IntelliJ IDEA. That's called Idea.sh. The next step to install Esker plugin so the IntelliJ recognizes both SBT and Esker 5, so we go to configure And now we'll go to plugs ins here. And now we have to go here and install the plug in, and type. Usually, there is a green button here that says install. As we have already installed this car plugin, we don't need to do this. But you will, so the following steps for you will be to install escala and then restart [INAUDIBLE]. So we're going to close this, and now we're going to create a new project. In this window we have to make sure that we select this color and SBT. So, we're going to extend. Now we need to name our new project so let's name it "Sample". Let's make sure that we have the right versions. One eight here and zero thirteen and two eleven eight for SPTS color version. If you don't have anything here we need to go to type new and [INAUDIBLE] will automatically detect your [INAUDIBLE] the case, so just have to press okay and that's it. So we finish. With [INAUDIBLE]. And now [INAUDIBLE] is going to create the project. And it's going to select everything, so that we can start coding. Close this. Now SPT is executing. So, it's going to create a new source folder here and that's the one that we use for putting all our codes Once we are ready let's play around with this [INAUDIBLE] worksheet. This is a feature that gives you a very interactive console to work with this color. Now that we need to go to source and select main and go straight to discard folder. So, we just right click here and you here When need to give it name say, Hello World. And now we see that the format has changed, so the idea is that we can type anything we want to here, which is the [INAUDIBLE] command or [INAUDIBLE] I think only has Syntex. Valid Syntex, right, and it's going to compile it and it's going to show the result on the right. So, let's create here an as a strength and we'll see intelligent, well we press control S to save, then intellij is going to. It's going to automatically compile this and output results, which is going to be about Cool. So, now let's try to do something slightly more complicated, right? So, let's go here and let's create a main application in [INAUDIBLE] We need to write [INAUDIBLE] as well and we're going to create [INAUDIBLE] class. Our main application is going to be a [INAUDIBLE] here object and we're going to decide the name. This subject is going to be inside the package quote example, so we're going to type example and then dots. And then the name of our main application which is going to be example with [INAUDIBLE]. So, we press OK and here we see the result, but in order to allow [INAUDIBLE] compiler to run this main application, we need to extend. Application or apps APP, extends, APP. And now this is going to execute the body of this object, so it's pooling here in a statement that it's going to create hello world [SOUND]. As you see, [INAUDIBLE] has recognized this as the main application, and there is a small icon here that we can click. And we see that we have several options. The first one is run example, second one there is [INAUDIBLE] sample, and the third one is run example quick coverage. Here we're going to just run the example. And if everything goes well we're going to figure out the bottom part of the Call, so it has compiled. Now it's executing the program, and we see the output here. So let's go back to the tutorial. I'll see where we are. We're in the step seven, and now we're going to learn how to open an SBT project. We come back, we're going to close the project and we're going to import it. By taking Q and input products. So, import a product A it goes here and we see that [INAUDIBLE] And in the project folder which is the project. So we select a built file and we click ok. And now, we see this window. And this window you can set up information about your project and specifically we see that we can set up the JAVA version, which is the correct one. One eight, and other options that we will explain later on. So we click there, and now SVT is going to create a new SVT project. But it's going to re-use the SVT project that we already created, but it has to protect the source files and also, which folders are in this project. We see the recognized folders. We continue. Now what we're going to do is change the beauty file. We find the beauty file here and we click on it. We can add a new dependency called scholar test as you see there is a notification here and this notification with three options. The first one is, reference project, the second one is enable IT port the other is to ignore. Enable and deport is official we will refresh SBT every time we change a file An SPT file or a SPT folder, this is extremely useful and I recommend to enable it. So we are going to enable it here, and we are going to add a dependency. So we are going to go back to the tutorial And copy, paste this command here, the second one. We'll save the file with control-S. And has automatically SVT. And now we are waiting for the result of SVT and the JSON error. Just a warning. Close and now [INAUDIBLE] is going to index the new appendices we just added to the project. Which is cool. It means that everything went fine. Now we want to execute any [INAUDIBLE] comment, we press alt 12 And these are going to open a terminal in our project folder with the example. Now we are able to execute this here. Remember that if you do this in another project folder, it's not going to work. It has to be in the work project folder. And we can type now nsbt Commands. So let's compare again the project. So that's it, now you're ready to use this current assignment. Good luck.