 What is public friends will snoop around get the URL for the live and they will hear us talk before it all right I shall start the count of 15 10 import episode 48 it's 8 July 2017 streaming directly from Singapore it's we build live this time on we build live we'll be chatting about Scala programming language with Hawaii welcome to episode 48 of we build live I'm your host Sayani and on the Sunboard is Chinmei and our guest today is Lee Howie good morning Howie hello all right so so we got to know Howie because he just tweets and shares a lot about Scala yeah a lot about Scala and he also had him talk at the New York Hackers yes that's the first time he had a general talk about how to debug or like get into the code base of any unknown open source project that was a really nice talk yeah and that's how we got to know Howie through NUS hackers and then we just saw that he was just sharing a lot and if you don't already know please check out his vlog while we get through this live podcast LeeHowie.com and also his open source projects which are mostly listed on github.com slash LeeHowie so we are here to talk about Scala about open source about anything that Howie's hacking on coding so Howie why don't you introduce yourself. Hello everyone so I'm Howie I'm a software engineer currently based in Singapore previously I've worked at Dropbox in other places and I've done a lot of work open source around the Scala programming language so that's been kind of a hobby of mine with many side projects that over the years have been used by a number of people and I guess I like it enough that I keep working on it despite the fact that's not really making any money it's just a hobby. Which reminds me Patreon right Howie you're on Patreon so yeah if you like it's open source projects if you use it contribute on Patreon okay great so audience thank you for joining us on a live Saturday morning we'll be talking a lot about Scala about open source and Howie's projects and if you have any questions for Howie on Scala please drop it on Gitter.im slash we build SG slash live and we will pick it up and how we will answer them so Howie why don't we dive straight into what is. Oh wait don't you forget the Malphoam query. We usually have a welcome gift for a guest. Yes we do so at the beginning of every show we welcome all our guests with what we call a Malphoam query so a Malphoam query is sort of a question that I'll ask you Howie which you can kind of answer if you want it's more like a pun or a riddle so your your Malphoam query is what did the array say after it was extended what did the array say after it was extended array in JavaScript they would say undefined well this one said this one said stop objectifying me oh my god that's a good one well now that everybody is awake let's move on to a real topic of the day which is Scala programming language okay all right so Howie why didn't you tell us what is Scala programming language sure so Scala is a relatively new programming language I think it came out a bit over 10 years ago which is quite young in programming language terms so it's a kind of a it's a kind of a mix of an object oriented language like Java and a functional language like OCaml or Haskell and it happens to run mostly nowadays on the Java virtual machine although now there's also the backend which runs on JavaScript called Scala.js so people have traditionally used it for a lot of things but mostly around either compilers or distributed systems or websites and it's quite a broadly used for as far as niche languages go okay it's very interesting because when I looked into this right I saw that it had a very strange background so it's both functional and and OOP right like how does it pull it off like that's generally these two camps are considered like you know polar opposites right yeah so it's a bit unusual in that it's actually in many ways more OOP than Java is where Java is often considered the canonical OOP language so you can create objects objects have methods objects have fields and you pass objects around and everything is object including things like integers of other primitives that they aren't really objects on the underlying runtime but the language pretends that the objects and it works well enough in practice but it's also functional in that it encourages you to do things I guess what makes it functional is it encourages you to do things without changing variables so you define so the default default variable is actually called value not variable and value is basically a final variable in Java okay so it forces everything to be final so that you wouldn't be able to change it to the unmutable yeah so it doesn't quite force you but it encourages you to make things final and it provides some nice tools that make it easier so for example like if you program in Java a lot you often have this thing where you create the object and the objects in this half baked state doesn't really work yet and you have to call a bunch of like centers or builders on the object in order to make it work and in Scala you don't need to because objects can take named parameters and optional parameters so whereas in Java you need this builder to say like I want to set only these three parameters out of the maybe ten possible parameters in Scala you just make them optional and you no longer need a builder which mutates the object now you just set them all at once and the object is ready and immutable you can't change it and often you don't need to interesting that's very interesting because immutable like like we're talking about immutable objects or immutability is a very functional programming concept but it's interesting that you can actually work quite well in the OOP setting as well yeah so I guess the way I program Scala which is different from many other people people have the whole range of like Java like Scala to Haskell like Scala the way I program like Scala is basically using it like Java except the places where Java makes you do silly things due to its language design in Scala you often have a better way of doing it so for example in Java people often don't mark variables as final even when they could be final just because it's tedious and verbose and generally a pain to remember to do whereas in Scala calling something of value which is VAL is the same amount of verbosity as calling something of variable which is VAR those two keywords are both short and the same so you just use immutable vowels whenever it's convenient then you never have this problem of oh it's over both I'm too lazy to do it okay but if you're gonna if you see I've not really looked into the syntax too closely but if you're saying if you use syntax like vowel so does it also do type guessing kind of things where you just say it's a vowel and if because of what type it is or yep you also put your type in it does type in front like C sharp like C sharp does and I guess Java's going to at some point true true yeah that's what it was a Java 9 that was gonna have that or I think Java 10 so another five years maybe it'll take a while very interesting all right so Javi let's talk about Scala being used in large modern applications to be honest I first heard about Scala when Twitter started using it this was a big news back in the day right when they were using Rails I think and they refactored some parts of it into Scala yeah and it was in the programming it is a big thing because it's sort of yeah you know a lot of people were like oh you know this is how we make apps and then suddenly realized oh no there's a whole different world when you start to start scaling yeah and then you have Airbnb and Foursquare like seriously large modern applications are using Scala and Javi why do you think Scala is so attractive for this what are they using it for so I think it comes down to a number of different different factors there's no one like magic bullet that makes people want to use Scala but the factors are things like it's concise so people like Python and Ruby over things like Java because Java so both Python and Ruby are concise and Scala is about as concise as Python and Ruby are often feels like you're writing a dynamic language and how little code you write to get something done on the other hand Scala is also very safe you have the compiler that helps you check things and this is the flip side like people like Java because you have the compiler and it's safer than writing Python or Ruby if you make a typo it'll get caught and Scala is like more like Java and perhaps even safer in some ways people like Scala because it's relatively performance so it runs about as fast as Java and for all that people say about JavaScript being web-scale and fast it's actually about five times or ten times slower than Java is and Python or Ruby on the other hand about 25 30 maybe 50 times slower than Java is so Scala is about as fast as Java maybe one or two times two or three times slower depending how you write it but it's actually a big difference in that sometimes you don't need to care about caching anymore because your thing is fast enough already you don't need to care about parallelism you don't need to care about distribution it's just already fast enough I guess the last two things also are related to running on the Java virtual machine is that you get all the Java tools which are very nice so things like if I have a server in production somewhere and it's misbehaving I want to insert a profiler into it from my laptop and see what's taking up all the time because it's running a Java virtual machine I can google it find stack overflow answers of how to insert a remote profile onto my web server and it just works whereas yeah trying to yeah try to do the same thing in like python or go or like say JavaScript you can make it work sometimes but it's often much less much less standardized and much less common and much more difficult to get working interesting because it it compounds down to jvm byte code all the jvm tooling especially like what is it profiling and stuff or enterprise level tooling can be directly applied to this right so you don't have to do almost anything yeah or you don't have to create your whole new Scala tooling you just use a Java thing and it works great and the same applies for libraries so like if you have a small like university homework maybe don't care about libraries but if any big application you have like weird data formats that some guy wrote you'll have some weird like third-party service you integrate with and some weird SDK that you need to integrate operate with it and with like with Scala on the jvm you can often just use a Java library and the Java has a huge number of libraries all sorts of things like you want to read shape files you want to manipulate Microsoft Office documents you want to interoperate with Matlab you know all these weird things that you may not need but not everyone will need all of them but everyone will probably need some of them and different sums of them and if you're on Scala you don't need to write your own like Matlab interoperation library just use the Java one and it works great true yeah Matlab is actually all mostly in Java right the UI at least the UI is in Java yeah and the underlying is all sorts of high-performance stuff yeah possibly yeah i would be surprised if it is some yeah some Fortran packages at the back blasts and all that stuff yeah interesting no what one of the things he said that was really interesting to me was you know Java gets a lot of shit for a lack of a better term in in you know the programming world for being you know verbose and hard to write and slow i'm guessing the slope mainly comes from the fact that jvm is slow to start yes but you know when i start looking at people who are doing really high performance stuff or talking to people who are doing stuff where it's very critical to be super high performance i see a lot of people going back to you know Java or at least jvm based yeah so which is very interesting to me because i feel that you know i think it gets a lot of bad rap for being you know like something that's enterprisey and not so cool but for no reason yeah well i guess slow could mean two different things so one is startup performance and the jvm really does take a long time to start so for example i have a small one of the tools i built the ammonite ripple in scala runs on the jvm a few megabytes of like executable and it takes half a second to start even before you can't actually running the code the half a second just spent like loading the code into memory before you can start doing things so you compare to say python python starts in 30 milliseconds right so more than 10 times faster and you compare to something like bash bash starts in four milliseconds so 100 times faster so that's a real problem but if you're doing kind of backend systems maybe it's not that big a problem because the server starts and then hangs around for a while and once the server warms up it actually gets really fast so i think the normal benchmarks typically typically put it around like two times slower than c++ to maybe like five times slower than c++ for many things which is actually really fast yeah it is yeah like and i see that because of that there's a lot of this uh you kind of like what talk about ripples or or in program shells that people tend to use a lot because they don't want to keep restarting jvm's yeah i see this a lot in the java world i've never seen this so much in the other programming languages right but that's that's very interesting so other than that are there any other things we missed out about why what makes scala attractive i guess that's most of it like it's just a bunch of different properties somewhat unrelated but all quite useful if you're making a big application what about like getting people on board is it really is it a language that's hard to learn because you know if you look at looking at big teams one of things they always worry about is like you know how can i get all my engineers to learn this new new framework on your programming language um i think it's definitely harder to learn than many other languages and part of the reason it's harder to learn is because it's this hybrid language both object-oriented and functional and so there's a lot of different ways to do the same thing which is often problematic so if you have a team that's writing the very object-oriented side of things like basically using scala like java and you have a different team that's using scala like haskell they're not going to be able to talk to each other or interact with each other well the code can interact but the engineers will not be able to understand each other's code because it's so different it reminds you of pull you know it's like people write pull but everybody writes pull in a different way you can you can never understand each other's pull yeah so i think it's somewhat different in that you can usually understand your own scala because you write in a certain way and that way is reasonable whereas you often cannot understand your own pearl you come back five minutes later like it's not just different but it's also just hard to read very scala um what you'd have to do if you wanted to have a team working on it is you have to be pretty strict in saying this is a kind of scala we're going to write so you're not going to be writing that extreme or that extreme we're going to be writing this this point in the spectrum and we'll just standardize on it just because that's what everyone in our team is going to do when we can then understand each other's code much more easily are there are there tools in the scala ecosystem for doing things like linting or you know or somehow categorizing these kinds of dialects i would say i know however you want to go not really but i guess one thing that um differentiates things is what libraries you use so for example if you're writing python you can basically put in any library and you can expect it to work more or less the same way because everyone writes python more or less the same way or if you're writing go for example everyone writes go in about the same way and about the same for java on the other hand for scala you basically have the you have the neutral libraries everyone uses then you have the extreme libraries on either end which if you don't include in your project you probably won't end up on the extreme but if you do include those extreme libraries for example the more the more um more opinionated functional programming libraries then you better get everyone get everyone in your team on board with it before you include it should just include it as like part of a bigger people request and hope no unnotices yeah all right so now that we know a lot about the good things about scala and the differences uh what is scala not good for like what doesn't work so well sure so there's kind of two different questions so what what doesn't work so well is for one we already talked about how you can write a whole bunch of different kinds of scala in different styles and that while some people say it's a plus it's definitely problematic in practice um another thing that doesn't work so well is um the compiler is really slow so it's not the slowest compiler in the world i think like for example this the scss compiler is slower and the the rust compiler is sometimes slower and the google web tool compiler is sometimes slower but it still is definitely on the pretty slow side of compilation and it doesn't work for the same kinds of workflows that you do with python ruby or ruby so um for example if you're writing python ruby code you'll be running the code over and over and seeing the behavior at runtime and deciding how you want to change the code to make it behave um whereas it's scala you can't do that because every time you run it it's going to be like at least one or two seconds just to get compiled before it starts running um so you end up with a different workflow where you have to think a bit more before you run the code and the language helps you so for example rather than running the code to see what type of variable is you can just ask your editor hey what type is this and it'll tell you or rather than running your code to see is this did i pass in the right number of functions you just type it in and wait for the editor to tell you did you pass in the right number of functions otherwise it'll give you like a red squeaky underline um so you have to change your work so to get around the slow compilation and it works okay but definitely is a downside compared to something like python where you just like split up the code and run it and instantly does what you want or not um i guess the last thing is that some of the tooling surrounding scala is confusing so for example scala has a number of ideas but they don't they don't generally work as well as java ideas like java ideas really spoil you because they're so perfect everything works perfectly everything is so tightly integrated whereas scala ideas are a bit more like python ideas so if you've used like pycharm for example or you've used like wing ide or um it generally works maybe like 80 percent of the time and the other 20 it just can't figure out your code or doesn't work for some reason and it's still very helpful i use pycharm a lot at dropbox and many others do but it won't give you the polished super integrated experience that a java ide may give you um yeah in fact howie you also wrote a blog post which is more on the technicalities of scala programming language warts of the scala programming language so if you have a chance go read through it he actually talks about the language structure and the properties in the language and goes through the warts of it so that's that's another take on scala programming yeah so that blog post basically covers many of the more small low-level things like this piece of syntax is annoying unnecessarily or that piece of syntax is error prone so i think scala has many of these like many other languages and i guess the hope in writing that blog post is that eventually can build consensus and try and get them fixed right how does it work with the community is it um is it a community driven up to like language decisions and stuff like that or um i guess it's not quite fully community driven so if i were to describe it it would be kind of like a oligarchy sure so it's not one person in charge of the whole everything but it's a small number of big organizations who have the most say in what the language is going so you have the university which first created scala i think as etfl in Switzerland they are one big party you have um type safe which is a company that it works on scala commercially now called like band i think and you have a few other like big parties who have most of the most of the mind share and for most of the say in what the weather language is going right so if you're like a random person using scala you probably won't be like it's not like many others like russ where they have or python where they have big open like votes and stuff on whether you want to do it language features but there is a general consensus process whether big parties will try and find a consensus among themselves it's generally will work for them and if it works for them it'll generally work for most people because they're pretty disparate like you know one's an academic lab and one's a company and others are like product companies using scala for other things right yeah it's a different point of view but there is always a lot of conversation about this and they're open with hearing and piece of use so when you write a blog post like what you did yeah you can kind of get this word to them yeah so like me writing the blog post i don't get a vote but okay if i can get them to listen then these guys also because they are the ones doing all the work so it's since you're doing all the work you try to get them to believe what's worth working on and then hopefully they will do it right okay it's interesting to always know how language standards and are built for the next version so the next segment we are going to be talking about tools for scala and that's going to be a big segment i think so audience if you're listening to us drop questions for how we which we already have a few we have a few questions already questions but if you have more questions just drop them in the getter.im slash rebuild sg slash live and we will pick it up for how we later so let's talk about tools what are the common tools that you use every day in your development sure so um the most common id every new everyone uses is intelij yeah so i think it's the this like like java yeah so yeah so intelij supports java it supports python ruby phd javascript like basically almost every language under the sun and it also supports scala and within the scala community intelij is definitely the most popular choice i think at conferences they often have these surveys of what tools you use and intelij is usually something like 60 to 70 percent so it's quite a large number so for for intelij it's a plugin for the java id right as scala or is it a separate id it's the it's a plugin but there's no real distinction in intelij like the python plug-in and the python id are basically the same thing oh really okay yeah so apart from the 60 70 percent using intelij if i remember correctly the rest is split pretty evenly between people using in eclipse people using sublime people using bim and emacs people using atom so they all have scala support to varying degrees and there are people using all of them this is as uh not as many um so that's the i that's as far as ids go um as far as build tools go everyone basically everyone uses sbt which used to be called the simple build tool but people realize it wasn't so simple so it's been renamed to the scala build tool so that's i guess an ongoing pain point in the scala community because it's somewhat slow and it's very confusing um so there are people working on trying to make that better but it's taking up quite a while so that's so that's that's a equivalent of say maven in the java world or like setup tools in the python world or npm and gulp in the javascript world so in scala it's called sbt okay what about a package manager so scala uses the same package system as java so there are a number of managers that that can work with it for example gradle or iv or sbt itself um and it's a new one in scala called coracea which came to be faster and it seems to be pretty good um but generally the the scala packages are java packages so you you deploy you publish a scala packages the same like sona type maven central package repositories and you as a scala programmer can pull down java packages basically trivially and in the same way a java programmer can pull down scala packages packages if they wish to do so um so it's the same they're bunch of different like front end tools the package system but it's roughly the same package system as any java programmer would be used to okay all right uh what about hinting or linting um use something as far as linting is concerned there are a number so one's called warp remover which attempts to raise errors if you use certain language constructs in um in more error prone ways um there is uh there's a new there are a few automated format the code formatters so there's an old one called scala reform and a new one called scala format scala fm scala fmt that's how it spelt um and those try to like standardize the formatting of your code kind of like how go format will standardize the formatting of code um those as far as i know are the most popular ones um there are several other smaller ones that haven't gotten as much usage yeah all right so why don't we now talk about the tools that you are building you are building some scala based tools uh let's talk about amonite sure so amonite is used mostly for scripting purpose yeah so amonite is a scala REPL and a scala script runner so the REPL is kind of so scala has already had a REPL that lets you enter code interactively and that's used heavily for things like spark where you want to explore the code explore the database or explore the big data cluster interactively so the default scala REPL is kind of like the default python REPL like you type in python and you get the REPL it works but it's not very nice to use everything's black and white there's no code no code highlighting yeah there's no history in between REPL sessions oh dear that must be very painful so it's it's okay but it could be better and that's the scala REPL by default it's in a similar situation it works but it can definitely be better um so the amonite REPL is kind of like the scala equivalent to the ipython REPL so if you use the ipython REPL you know you get coloring you get multi-line editing if you want to define like a four line function you can go up and down edit your function you define if you define the value even if you didn't assign it to a variable it has a input has an input array and output array so you can go back and fetch like oh what's the variable what's the result of the computation three commands ago and just fetch it out it pretty prints the output so it's nicely formatted in multiple lines indentation so that's what amonite does for scala and i guess it's meant to serve the same purpose in that if you're using a REPL all day um you don't want to be trying to dig through unformatted black and white text you want it to be nicely laid out for you because computers are good at that and that's what amonite does um and also tell us about your new version of the amonite that you just launched like what features it has sure um so i i recently released i guess the 1.0.0 version of amonite and it didn't really have any new features at the previous like 0.9 for something versions didn't have um basically it's the same old version just labeled with 1.0 because it kind of stabilized versus what the old versions were right so the old versions are pretty experimental um so if you use a feature in the wrong way if you as a programmer made a mistake it give you like confusing error messages and big stack traces um some things weren't colored nicely so it's hard to read um there were some missing features that would have very simple to implement that would have made it a lot easier to use for example being able to like run a script and automatically rerun the script when you save the file that kind of really small like polish things that's basically what the focus of amonite 1.0 was so all the features are basically the same features that people are used to like a repel a script runner loading loading packages from the standard package repositories but all the small things like making sure error messages are understandable making the output nicely colored adding a bunch of small features to make it more convenient to use that's what 1.0 meant and i guess 1.0 meant that it's ready for you to use all this stuff is pretty solid and you don't need to worry about bumping into rough edges when using it cool what are your future thoughts about one point the future versions of amonite sure um so one major pain point currently is IDE support so amonite the repel doesn't need the id because the repel is just a repel that runs in your terminal um but it also provides like a script script running functionality so kind of like how you can write python scripts and run them without a big like package file sorry project file and id like package system um amonite also lets you run scala code just by putting some lines in the script and running it without worrying about like all that setup so it works but id is currently don't understand it so that means that when you're editing amonite scripts and id you lose a bunch of the nice things at scala that you people use scala for so things like being able to press dot and have the auto completely strapped out things like having your um if you import something doesn't exist having it show up as error message and if you press tab after half typing a variable name have it automatically completed for you that's just a repel way of uh yeah typing it so that works in the repel but it doesn't work in scripts and but it does work in normal scala code because normal scala code has good id integration the id understands the code so i guess one thing that i want to get working at some point is to make the id understand understand amonite scripts um there's no real like theoretical problem behind it there's no like difficult engineering like algorithms or anything it's just i need to get some time to or find someone who has time to go and like integrate it with all that intelligent like internal systems that they use and integrated eclipse integrated with like visual studio code and it's basically a bunch of plumbing work very hard plumbing but just plumbing but once i get that working it'll be very nice editing of scripts and id with the same like full id support you expect from writing scala or java all right cool nice yeah that sounds like a quite a useful thing that you um let's us talk about uh say using scala with web uh programming languages like say javascript yeah um what you want to know about it i think you have worked a lot with scala js yeah so scala js is a new back end for the scala language so traditionally compiles to java backcode runs on java personal machine now it also compiles to javascript code which can run on the browser can run node js you can run on your tesil javascript microcontroller if you so desired um so it's actually a bit surprising how well it works um the code generator is fast so it runs about one to two times slower than if you had written a javascript yourself which is often not a big deal and compare you write your code in scala and then yeah it will kind of compile it to javascript yes and then you can run in the browser you can access the dom the browser dom okay so front end as well front end as well as back end yeah and you can access third party libraries so i think the most popular front end framework with scala js is react js the the javascript react js library from facebook yeah and many many people are using react js like j query um all moment js all the javascript libraries are available from scala js as well as many of the scala libraries that you use in the skip that you would use when writing scala on the jpm interesting so so people have like wrapped around scala js around all these libraries or is there a easy integration or import functionality sure so i guess there are three ways you could use these libraries one is you could use them raw so you could if you use them dynamically you don't get any type checking and you don't get any edit integration but you can call any function you want and call any api you want directly and it just works if you it works if you use it correctly and if you didn't use it correctly it will fail at runtime so that's just kind of like what it's kind of disappointing coming from scala but that's how it works in javascript land anyway everything that blows up at runtime and you get no editor help so then the second way of using these third party libraries is you can define uh uh type stubs so if you use type script for example you can define dot d dot ts files it's don't contain the implementation code but they define like oh this function exists it has these arguments and returns this this like string or list or array or something it reminds me of the old school c header files yeah so it's basically the same and scala js also lets you do that the syntax is pretty similar to the or like the the way it works is pretty similar to how the type script header files work except in scala instead of type script and that basically lets you call the javascript functions the same way directly almost the same syntax as if you had called them dynamically but now that you have these header files if you make a mistake it'll get a compile error and if and it also means that you get like editor integration like press dot you can see the list of functions you can call you can press tab to autocomplete things then all the things you'd expect from normal scala code um and then there's a third layer sometimes people will go to is that to wrap a javascript library in a more scala friendly like wrapper so this is totally optional but for example many many things that you do in javascript you'd have a slightly different way of doing in scala indeed for example in javascript you use esx promises maybe for asynchronous return values in scala you'd use a class called scala concurrent dot future um which is basically the same thing but that's just the way people do it in scala land so people take third party libraries and wrap it to make it more idiomatic scala um or for example in javascript people return nulls or undefined if something doesn't exist and in scala people prefer to return option optional class optional class um the way it is in java java 8 so um in that in that way rather than write so you don't need to do this you could always use javas use the javascript library as if you'd use it from javascript but if you're using the library a lot or if many people are using the library which is a case for example for react j s then often someone will go and wrap in a more scala friendly wrapper to make it fit in better with your scala code right but if you really want to for example maybe there's a new function that hasn't been wrapped yet you'd always just call it directly dynamically and bypass all this wrapping gotcha all right all right that was a lot about scala now before we go on to the last question audience if you have any questions for how we drop them on to the live chat getter.im slash we will sg slash live so how we want last question on scala before we go on to the audience question sure what are what is the future of scala that you're excited about any upcoming features tools um so there's a few um probably the biggest improvement that people are working on is speeding up the compiler so that's definitely the number one pain point everyone complains about when using scala um and i think the the latest uh snapshot version of scala has something like a 20 speedup which is quite substantial like it means if something took five seconds it now takes four seconds and that's great if you're running the same code like compiling over and over throughout your work day do you know how they did it in the compiler code um it was a lot of hard work and profiling and experiments to see if things make things faster so often it's not very obvious why things are slow because like performance isn't just how much code you run but how you run it so for example like if you run if you run a bunch of code that creates and destroys objects very quickly yet that runs faster than if you create a run a bunch of code that creates a lot of objects first and destroys them all later um because of like memory and cache performance so that's kind of often very unintuitive because you're running the exact same code creating the same objects and destroying them but in the end the code just runs runs at different speed and it's often not clear why so i my impression is that the core scala team has spent a lot of effort building up benchmarking infrastructure and running all sorts of these experiments and see like empirically if i shuffle this around will it be faster or like where are the actual places where which are causing my code to take a long time um so that's performance um in terms of the language itself then there's a new version of scala coming out eventually it's not clear exactly when yet but they're calling it scala 3 provisionally um and code name dotty due to some like clever pun on one of the implementation details um but so that version of scala is meant to clean up a lot of the um i guess the craft that's accumulating the scala language so like many parts of language have kind of evolved over the years and weren't really designed so for example scala has inbuilt xml support because xml was really popular 10 years ago and scala came out like everything was xml at the time it was a json yeah and now like everything's json and in five years time there'll be something else and so in dotty they're trying to like get rid of this xml support and you replace it with something more general um then dotty also the scala um type checker and compiler has also had a lot of weird bugs in it due to how it's evolved like many parts of the compiler kind of hacked together until it works but no one really knows why it works and as a result it's very hard to debug bugs and you don't know why it works in the first place or you don't know like if it doesn't work like or if it's behaving if it is behaving strangely you don't know whether it's meant to do that or whether it's meant to do something else because you don't actually know what it's meant to do um so dotty is a complete rewrite that i guess is actually designed rather than evolved so they have a good like foundation of like how is the language meant to work and if something is behaving in a certain way you have a good idea of like is this a bug or is this just how it's meant to behave um and as a result they cleaned up like a huge number of bugs in the language um often more bugs that occur in more like obscure cases that you don't bump into day to day but still bugs that people will eventually bump into and cause problems so they've cleaned up all that or most of that stuff um i guess the last thing that i think is quite interesting is so scala has a new native code backend so scala compiles to java bytecode scala compiles to javascript as of three years ago and there's experimental new backend that compiles to x86 assembly or arm assembly or whatever using the llvm like backend um code generator so that is quite exciting because it solves some of the big pain points of using scala in some cases which is that it takes forever to to start and warm up so rather than taking say like 0.3 seconds to start and warm up or 0.5 seconds starting warm up um they have a bunch of new benchmarks using the new scala native backend and it takes 0.001 seconds to start which is like way better so so steady state is not going to be as fast as the jbm for quite a while but the startup time makes it so much better if you're creating a command line tools you know you run it you you run some command in the bash shell you don't have to wait half a second for it to run you just have to run instantly um and just like scala js and unlike many other like new languages scala native can benefit from like all the scala libraries which already exist so like for example they've ported the new scala metaprogramming library to scala native with basically no no changes to the code itself and the whole thing just runs immediately and you can imagine like all your scala like json parser scala serialization library scala html generator scala like whatever all this stuff does not need to be recreated you just like adds a flag to your configuration and cross-compile it to scala native and it should work out of the box so i think that's quite exciting because you basically have a whole new whole new native programming language but without all like the bootstrapping like um critical mass problems you get when you're trying to write a new language because almost out of the box you have the critical mass programmer so you know how to write it books that teach you how to use it and libraries and ecosystem and tooling of like that you'd want to use when you're actually using this language for real um for real work oh that's really cool so i think it's quite exciting and hopefully they continue pushing it and it ends up in a good place great so where should um scala programmers interest people uh go to check out these conversations happening is there some online forum or um so if you're interested in like work helping out with the scala language itself um i guess first if you're interested in just learning more about scala or like asking questions about scala like as a learner which many people will be then there's a user forum called users.scala-lang.org and that's like a i think it's a discourse channel which lets you sign up as a mailing list and you can go and ask questions about how to use scala why my your scala code is not working etc and if you're interested in then like contributing like you want to help push some library forward you want to end up helping contribute to the compiler the native backend the JavaScript backend then there's another forum called contributors.scala-lang.org and that's where all like the core team hangs out which you know the guy's working on the various compilers and various core platform libraries and if you want to ask questions like suggest suggestions um talk about your new your new project that you want to get people interested in that you know more advanced people who'd be able to contribute rather than just learn then that's the forum that you want to go to um and each of these projects has its own githa channel typically okay so there's like the scala-native githa channel there's the scala.js githa channel um there's a scala-scala githa channel and if you go to the the the projects github page it should be easy to find from google um you usually have a link to githa channel you can go and ask questions and generally talk to people about it all right great so audience don't worry we will put in all these links in the show notes yeah so you can just go to show notes and check them out check out what's happening in the scala land so uh chin may that was a lot about uh scala programming language yeah it was great audience questions right yes we have we have four audience questions for now and more if they come pop in so let's go to ayo polling all right so the first audience question is from Eugene and he says that he's not familiar with scala but he he wants to know if there is an equivalent to scikit-learn or pandas uh on in scala side of things and if there if he's someone who's familiar with r or python is can he pick up scala for doing data analysis and modeling um so there are equivalents but they are not nearly as uh ubiquitous or as popular as the python equivalents so um for i think for as a as a numpy replacement there's a project called nd4j or nd4s i can't remember what it stands for but it basically gives you like numpy style um big arrays that are big matrices which are fast and quick to work with okay um as far as the scikit style the scikit style library is like in terms of neural networks and pandas in terms of data frames i'm not very familiar with what what the equivalents are okay um yeah so is it a common use case though do people use color for these kind of things or is it not yet yeah like data modeling and data science stuff i my impression is that people do use color for it but i'm personally not that familiar with that side of the language so a lot of that stuff happens around spark um which is like the very popular distributed um data processing system that people use now and my impression is that they have all sorts of things for like running running regressions or hyperlog whatever in computations or deep learning or machine learning algorithms um but i'm not personally that familiar with exactly which library is at the most popular nowadays all right okay next question is from mike and mike asks are you a fan of the play framework um i think it's the java of play framework that mike is talking about it's kala it's all it's kala okay so play play play framework 1.0 was a java framework and then play with a scala plugin and play framework 2.0 is now a scala framework with a java front end for it so it can be used from both java and scala um now the internals are all written in scala because the guys who wrote it became scala fanboys after using the language um i guess it seems like a nice framework i i've used it a bunch in the past when it was quite new and it seemed to do what it did on the box um yeah it gives you nice things like live reloading in the browser nice error messages error formatting a bunch of good conventions um i guess if you if you're making a website using java sorry if you're making website using scala the play framework is a natural thing for you to start with and later on if you want to replace it with your own special web server like http4s or akaihtp or something you can go do that later and play frameworks good defaults good tutorials lots of material online and easy to get get going so i guess it's like the rails for ruby kind of thing yeah i think like the intention is meant to be like a rail style experience but just like way faster and safer of course yeah cool the next question is interesting eugene asks again um and i think the answer even i might know the answer to this he says i want to replace my shell with a scala shell any recommendations sure so like so he continues a bit just just like how one would use ipython for day-to-day file operations and scripting i think i might know the answer yeah so like the my amonite repl project has a shell shell module that lets you use it as a system shell there you go eugene yeah so you can ls you can cd you can sub process you can you can start your python shell from my amonite shell you can basically do anything you do in bash in amonite and there are some tradeoffs um the good points are that for one using scala is a much nicer language than using a shell using bash for example bash is good for trivial things like ls but let's say i want to ls the files and find the top 10 files of extension dot class in terms of sorted by um file size or i want to list the folders list the sub folders in my current folder and i want to find the top three sub folders who have the most number of files recursively within them so all of these things are kind of tricky for you to do in bash like there's probably a one-line command that does it but you probably will not remember what that is whereas with the amonite shell using as a using amonite as a system shell you can probably figure out just with a few like for loops or with like a few maps and filters exactly what your what command you want to run to get these um get these results get these results um so the downsides of the amonite shell are things like um it's scala it takes half a second to start up start up the first time and the scala compiler is slow so it takes about two or three seconds for the first command you run and takes about a quarter of a second for every subsequent command okay so once the command it starts running it can run really quickly so if you want to run like a gradient descent algorithm in your shell it will run way faster in amonite shell than in the bash shell but on the other hand if you're writing if you're writing like lots of really small commands just like poke around that stuff runs slower in amonite because of the startup overhead for every command all right it uses a lot more memory than the bash shell so i think it by default it will use up to about 400 megabytes of memory per shell instance to run scala because i'm guessing that's because gbm right you need one one instance of jbm per shell it's not just because jbm so jbm will probably go down about 50 megabytes if you're just a jbm but it's because the scala compiler is a pig and uses like all your memory and all your ctu so like i think practically you can probably make the scala compiler use maybe 300 200 megabytes but it's not going to get much lower than that the scala compiler is just really big really heavy and really resource intensive and like this core scala team is trying to make that better but that's the state of the world right now okay so those are the reasons why you would not want to use the scala use amonite scala as a scala as a system shell and the reasons why you would may want to explore using it yeah cool so i guess what what you said earlier with like using that as a way to access spark and then poke around data might be actually a very good use case yeah so if you're using it for to poke around like data structures and not your file system for example you have like this big like graph data structure that's in memory that's for example maybe your friend graph or you're interacting with a database and you already have scala code interact with the database from your production environment and you interact the database from your shell then that's ideal situation for using amonite perfect all right thank you for answering all our audience questions now let's move on to the next section which is called pics so the way we do pics is we go around the table so i'll start first and let's say any do it and then we'll give you some time to think about it how we sure we pick one to two things that are interesting to you that you just you know just figured out just found out and you would like to recommend to our audience to try out it can be anything can be blogs books apps tech you know or non-tech even foods meetups whatever so i'll start with something that i've been playing with it's a small table top or bench top oscilloscope you want to say it's like a small little board that i got recently from kickstarter yeah and it's super handy for doing simple debugging electronics kind of stuff so if you if you audience want to check out the open scope i will put the links this interface it runs on a browser right that's the coolest thing yeah that was the coolest thing about this was you the whole ui for the scope is actually on the browser okay so you have the the oscilloscope in as a small piece of hardware but it doesn't have any screens and all the ui happens in the browser i think this is a very interesting yeah like the hardware interface web ui i think this is a very good interesting direction and i'm super curious to see how well it works it works all right i think the web ui is very young so it'll take a bit of time to to move forward but i think at some point in time this will be a very cool sort of interaction mechanism so i'll put i'll put the links in the show notes if anybody wants to get it i think now it's out of kickstarter you can actually buy it already okay it's by digilent it's by digilent yep all right so i have a couple of picks very quickly one is a breadboard power supply by yw reward so you know whenever we play with digital hardware we need either five volts or 3.3 volts and i found this breadboard little tiny breadboard power supply super useful for prototyping my hardware stuff and my second pick is a book it's called deep work by cal newport i recently read this book and i felt as a developer or even as any creative people knowing how to do deep work like really concentrate at deep work for three to four hours is super important and this book kind of talks a lot about it so go ahead try out chinmez open scope or the breadboard power supply or even the deep work book howie what about you sure so um i guess this isn't really related to tech but no you can't i i recently found out that the new east coast park to chang yi bike bike cycling route has been reopened so they were doing a bunch of renovations around chang yi airport because they are doing terminal terminal 4 terminal 5 but it's open again now so you can start from east coast and cycle one way to either marina bay sands or you can cycle the other way and go all the way past the airport to chang yi chang yi village and if you wish you can cycle all the way back through like badouk and tampines and gailang and end up back at east coast park if you have to like return your bicycle there so that's actually quite fun if you're if interested in cycling because for one the route is really flat because it goes along the ocean so there aren't any like huge hills or anything secondly um it's really scenic and really cool because you have the sea breeze and you're by the ocean and lastly there's a very pleasant straight most of the basically all of it you don't need to go along the road most of its park connector so you don't need to be fighting with cars and trucks trying to like survive on the main expressway yeah so if you're if you're free and have a day and you like cycling can you easily spend like eight hours i think last time i took like six hours did it make one big loop maybe 30 40 or up to 70 km around that area and it's just really nice and really relaxing yeah the cycling movement is really really going strong in singapore and especially with the park connectors you can just cycle anywhere yeah i cycle a lot along the pongol area as well and by the way i i learned cycling this january yeah well i i learned cycling when i was 20 years old so yeah exactly so there is no better age to learn cycling than now and try it out whether you're in singapore or you're going abroad to explore the cities on a cycle that's a that's a great tip thank thanks howie yeah i guess that's it for me yeah yeah um let's talk about event the event loops that are happening all right um we want to talk about slightly about the singapore scala programmers they actually have meetups in singapore as well i have not attended it how we did you have a chance to attend it yeah i think going to it all cool yeah so they seem to be pretty regular they had like 40 over meetups and oh so what happens there uh like talks and the sharing yeah usually it's someone talking about their work and so most of them uh let's see there's a bunch of small companies using scala in singapore okay whether like startups or banks using it for spark or someone trying to implement like a new clever algorithm in scala um and so people come and share about oh these are some techniques i've learned using scala or this is some approaches i've done or these are some tools i've recently gotten experience with and then people come and talk and they'll give a talk presenting what they've learned and people ask questions and talk about oh you know how does that gel with what i've learned how is that gel with what i want to learn like but does it make sense for me to continue using the tool that you suggested right along with the url so for online links to scala go and attend the singapore scala programmers meetup and lastly i also want to mention make a fair singapore it's happening at the end of this month 22nd and 23rd july so make a fair is all about software hardware art science biology cooking it's really a mishmash of ground up kind of an open source open maker culture meetup so if you want to check out about this community i highly recommend you to go to the sign center it's happening in sign center this time it's happening in sign center on the 20 it's on a weekend 20 and 21st of july yes that's right so uh check it out me and chin may had the chance to solder some stuff yeah we we were helping out in one of the installation so we sold it a bunch of boards so you will you're guaranteed to find some inspiring projects that are going on there so go and head down to the singapore make a fair at the end of this month all right and the very last segment we have is electric plug plug plug plug all right how we how can people reach out to you um so i guess it i have a github account with my email on it so if you search me how we github you'll find it and you'll find my email and you can contact me by email um if you're using one of the projects i've worked on for example eminite or some of my libraries like fast parasol scala tags each of those projects in its own github channel so okay maybe not even me but there'll be bunch of people there who use a project and if questions about those someone will answer you um and i guess lastly i've uh if this is this is a plug section i'll plug my blog um says www.lihaoii.com um so i write a bunch of things about scala but also about other topics so i wrote a blog post about like um about working with singapore with singapore's um government data apis or a blog post about um a blog post about diving into unfamiliar code bases so if you're interested in programming and or interested in or particularly interested in scala um there's definitely worth taking a look and having a read yeah cool yeah it was very interesting i when i started researching for this episode i did read and it was a bunch of really cool articles so highly recommended yes very technical very long ones but it's totally worth yes very long that's very true yeah a bit too long probably how he takes the time to write his blog post yes yes definitely cool um maybe i will also recommend engineers.sg slash presenters how we uh also gave a few talks especially the ones that we talk spoke about uh yeah he spoke about singapore's open data he has a video on it uh there is also uh the one at the nus hackers the friday hacks diving into other people's codes so if you want to check out uh how his videos of talks uh this is where you go to we'll put all the links in the definitely yeah thank you so much how we for joining us on a saturday morning talking about scala and uh we hope the audience got some kick out of it like if you're a programmer and you want to just check out another new programming language scala is the one yeah definitely yeah absolutely all right thank you how we so much thanks that's it for this episode 48 of we will live we will get together again online another saturday morning another cool guest until then return zero