 I mean, I like to talk about me because I'm not sick and also because it gives you context to actually understand how I see things So I am an engineer from France. So I basically to make it very simple I'm not very good in technical stuff, and I'm quite good at big picturing stuff Well, that's I've true because I've been doing a lot of technical things since I left school But that's how I am where I come from other thing after my school I joined a team who was dedicated about open source We were providing both support and expertise of our open source technologies, which include free software and during those four years in this team I became a committer on PMD project, which is a Java tool and also became a main contributor to XFADR and Finally in like two years ago. I was in I became involved into the Mercurial community But transiting the HG book into French At last I'm still teaching at my old school so school I graduated from which is called USME Soudriya And I'm teaching build technologies on OOP programming. So I'm kind in the middle of like industries, but also school That's it Well quickly, this is just the ad I'm working for a company called number for now, which is Stated in Berlin. So if you want to do cool stuff in Berlin, you can apply we are recruiting that's done Okay, first thing this is this talk is called Scala expressiveness, which It's kind of weird. So let's just think about what expressiveness mean For other people express enough is about writing small code. Yeah, I can write my card on on this bottle of water. That's cool That's maybe cool, but it's not really expensive enough expensive enough is how much your code convey your idea behind it So for instance, if you look at the first code sample Python against Java Well, clearly Python is More concise, but also it's bringing you More expressiveness because like you just say I want to range going from three to minus five by a step of minus two Which is kind of making sense if you look at this thing here Well, you can figure out what it means, but it's going to take a while Now other operation Python against pearl Well Python against this way of doing this in pearl. I guess there is better way to do that Same thing again if you got Python, it's maybe so it will be put longer than the one in pearl But it's kind of coming more sense. It's more easy to understand what's happening here than here Also, because Python is a compiled type system on this thing is actually Because Python is actually handling reggags as like Compiled thing you can compile the expression on reuse your reggags, which you can do it pearl which also bring you More expressiveness The idea is not to say to say that Python is better than pearl Java or whatever the idea is that depending what you're doing expressiveness of a language may change So that's that's for the little introduction by this So what does it really bring us? I mean, why do we seek or not expressiveness in a long programming languages? Well, the first thing is I love a lot of abstraction Which we always seek for I love our obsession or the while we will still be paying with you know assembler system This of course because More easy way to express ourselves because we the more higher novel we are the less we have to take care about little thing behind So if you are writing a web services for instance, you don't want to worry about network connection This API error or this kind of stuff. You just want to write your web services and just hopefully create something That's working over the web Also, we want to have expressiveness because basically we wrote less code and the thing is that the less we wrote Code the less we expose ourselves to bugs If we go back to the authors to the big sample of Java code We are just so no there is many way to get something wrong here We can put plus one instead of plus two we can change a sign The Python way with this range function is more efficient and less prone to both to bug And of course the more your code conveys sense the more your code is expressive Well, so that's it's readable and it's far more better to spend three hour writing three line of code Rises and spend like one hour writing like a huge pain Much of God, it's gonna be quite difficult to read after a while So let's start with the first example. No, not yet. Yeah, you know first first scala. So let a bit about scala I don't know how much people here know about these languages. So basically it's running over the GVM So it's like rotten in scala in Java and run over Java I guess there is port now. I mean is a sport like you can run scala over. I think mono on some other languages, but whatever basically these languages is like Providing you with all pay programming languages. You can have clatties. You can have inheritance polymorphist methods This kind of stuff, but it's also mixing functional programming, which means that you have closer. You have Well functional first class citizen This kind of thing Which makes scala a very very rich and complex syntax Basically, I think scala can even kick his ass to see this plus and I mean, this is already very complex Well, we will see when we are going to see through the code that scala has a very very many many keywords and stuff like that But also it's still a strongly type languages It's not like groovy, which is like not not type. It's still strongly type and it's also helping you by in we are using inference Basically, it's trying to deduce the type of the current values or variable So you'll have to do this thing that we also see in the Java like least string Equal new early least string. No, you just write val equal new List and it's going to be able to say, okay You just want to create a new val which is a list and because you put string into the list It's a list of string. So it's going to deduce But it could typing which really help you because you can just leave out all these typing stuff and still have the benefit of typing at least if you believe in typing Some people don't so whatever Okay, first example Well, this is kind of abuse you have like this classical pojo classes of Java So you got like all your private stuff Public method to get access to sing we'll get your setters. You got this equal method You need to write you got this hashtag method You need to write you got this public to string you need to write because those are badly done by default in Java And you got in Scala This is what we call a class class class is basically doing to do quick is going to do all of that for you First time correctly. I guess expressiveness is is kind of abuse. I mean you just wrote four lines And you really know what you have And again, you can see that it's still so good type I mean this returning a string those are string. We are not having like a groovy or type less language Okay, next example Pattern matching makes safer as you can see well, this is like an example of how to handle branching in a code in Java Well given To be truthful, this is a bad example one can do a better in Java I hope you are seeing stuff because the red thing is not really well, whatever So basically you got this huge if statement where you are doing stuff like if My list is not empty gets this thing and equal to that thing and blah blah blah blah Okay, so that's crappy and basically you can either have a special case of a result or a partial result at the end Just print a message here You got this case statement, which is very Pretty poor for in Scala because this case statement is all you to actually match against type So if you just pass to the case statement a valid list with the content you expect like one and two It's going to go to the hop if you pass a list with two and four is going to go to valid result And if you pass something in the list, it's just going to go to the defaults case Which mean that if somehow we end up passing a list of the wrong type of the wrong number of element of whatever you want Instead of having a big exception, it's another thing scratching is just going to go to the default case Which make your case statement far more resilient than this one If I pass a null pointer to this one, I will just get at some point and a new pointer exception. I Guess I'm not sure but if I pass a new pointer or more exactly an array containing the wrong number There's a long kind of list. I'm going to go to the default case again What Scala bring us here is not really about concessions, but really about explicitly what I want to do Next one, I hope I'm going to quickly put this thing XMN, I mean he who here has already I guess everybody here has already wrote some kind of XML parser And get like fed up with this I mean, you know this especially in Java when you have this complex document object create and then you have this Bizarre error and you have to create Subtrees document node. This is hell and Frankly, it's made it made XML like a pen is yes, and it's a shame because XML will used to be fun. I mean Back then like 10 years ago Well in Scala XML is like a first-class citizen also like for the functional function so You can basically wrote XML into Scala code and just it's just going to return to you a type of Data type of XML so you can say Val XML equal some XML code on you got a variable Which is type by XML so you can add XML stuff together. You can Merge XML stuff together. You can basically under XML like a data type like integral string whatever Also, it's quite efficient. I mean you can write this thing directly and just just you've got this special syntax to pass value inside One could argue this is like mixing that our model with programming blah blah blah, but frankly I Don't think it is one cool thing also if you just notice and again, this is red so nobody is saying anything but Uncoding is here, which means that you don't really care about unconnect up until the end You just write your XML you have XML data binding and when you are actually going to print this out of the memory Like in the file or in the network at this point to take care of unconnecting which I find To be a good way to do it Well, this is nice, but to be very to be truthful XML support in Scala have some limitation on it can be quite tricky You can't really order the way you want to tribute you may have a not I'm doing complex thing You have no excessive validation So you have you have to basically wrap some kind of Java object to do that So it's not perfect, but it's really give you a way to quickly deal with XML I mean simple case very quickly and efficiently And also again coming back to the expressiveness It's mean that if you have an issue with this thing when you're going to open the open the code We just like really have like a template of the XML file not like Tom object with some add on I don't know with some set attribute thingy, which is not very clear. We're going to see directly what you are what you are fixing One more example on which is quite famous This one is about ending lists and we all know because we are all doing well all developer that ending list is Mostly what we do and we just create anything in the program is going to be on links to this stuff On this famous example is that it was done by Martin Odoski, which is a scalar creator So it's quite famous and it's really I think it's really shows you How much color can be concise and most most important express here So I just create a list here of person. So I create person person are already defined on the first line So the case the case class so like in the first example with one line. I can define a new object Then I create a list of person I don't have to type person because person is a list a list I fill with person so scala is able to Reduce that this list is a list of person if I try to add something else than a person here I'm going to have a compilation error and Then I'm going to create a new Well, actually new to two new list older and younger those two new list are going to be partition from the person list And I'm going to pass to the partition method a function. This is a function the thing here. So the underscore dot edge Super equal 18 is a function and the patch written is going to use this function to actually create two sublist One will be younger one will be older Now just close your eyes and think about doing the same thing in Java code Okay, it's scary thing, but I guess you can also think about it in other languages mean It would be like very very long and there will be like a like a ton of tons of way things can go wrong Also, yeah Yeah, when partition return does it return one list or two lists? I'm kind of shady about all these things that actually Yeah, I repeat the question I'm kind of shady about how this was going This was like the last example, so I'm lucky and I was going to say do you have any question, but that was done Yeah, so I'm gonna just conclude on and then I can come back on the question conclusion is There is a lot of noise and scala world about like scala is took a black scala is like Reboot to see I guess it's not the point here the point is that does scala provide you with the correct exclusive then you need to so If you want to retain something of this old show just pretend that thank you for listening and enjoy the first day