Bill Venners, Q&A with Alexy Khrabrov of SF Scala @Sungevity 20150224
Recording: Bill Venners, Q&A with Alexy Khrabrov of SF Scala @Sungevity 20150224
hello everybody this is SF Scola developer series and here we are on location at svity for an SF scal mup with uh speakers including Bill veners uh one of the authors of the regional scholar book and he's going to talk about uh testing and some some interesting developments in in Scholastic which is which is the library uh which came from uh pill's testing work but you know Bill's a very welln guy in the skull communia so we'll use this opportunity to to learn a little bit more about him and and his skull interest uh welcome bill it's great to have you here thanks Lexi uh and uh bill is also in his Bay resident so we're all here in Oakland you know very excited to be here in kind of uh the same habitat uh yeah and uh so I'll of course you know ask you what is your kind of uh scholar history how did you come to to scull in the first place and how did the scull book uh came to be okay that's um going back away so that was 2006 I uh somehow heard about it we were doing a a community website a programmer Community website r.com and we interviewed people we we posted news items did that sort of thing MH and sold ads so somehow we heard about Scola we posted a news item on Scala and uh that's how we first interacted with Martin ODI about that and he actually kind of corrected us we kind of said it was about XML literals yes yes so uh at some point we got the vibe from the you know just talking to lots of different people that uh that uh functional programming might be or like the mainstream programming community might be ready to to uh look at functional programming mhm and so we contacted Martin to see if he wanted to write some articles on our tea about functional programming just to explain it um but to use Scala as an example language okay so he said uh yeah but he also kind of wanted to write a book about Scala and and we said Well we'd like to publish a book about you know we want to publish books we were thinking about doing that so we'd have something besides ads to sell uh it's something that sld directly to the audience which was fairly substantial at that time and and uh so we just you know we worked out uh that he and Lex spoon would write the book and our Teo would publish it but it was such a huge task that we needed another author uh so I volunteered and the other reason I did that was so that I I'd have some credibility to go around and talk about schola because I needed to promote this book we poured so much into uh so that gave me credibility having my name on it but uh that's how that started um as far as Scola itself I really liked it because it had static typing and you know I I uh really really liked static typing and uh was a Java guy I just was tired with the verbosity of java and didn't want to give up static typing so Scola seemed like the One Direction actually what I liked about it too was that it it was binary compatible with Java yes but break Source compatibility I thought that was a good way forward right it's binary compatible jav but it was not binary compatible its own versions that's right the beginning yeah which the story changes you know now but yeah those interesting times so this is actually great this is the very interesting Insight uh how much writing kind of if you can talk about it in the original book was you and others because it's it's one of the the book won award for its Clarity and it's still one of the best uh programming books yeah we well thank you we uh we all of us were all over the place but it it was uh when I counted pages I think Martin wrote half mhm and me and Lex split the other half maybe but I it's really hard to say I mean everybody was all over place but it wasn't like one person's name was on there and they didn't do any work everybody just put an enormous amount of time into it who brought kind of the most or a lot of clarity like it really stands out as very rigorous uh book and there is not much repetition in it right so I think it's it's it's it's one the word uh uh for for that and it's you know I I would recommend it as a as a good program for any programming language right so I just wonder how how it became that way I think I think it was just lots and lots of hard work so Martin was motivated to work really hard because it was his language and he needed to he needed a good book I was motivated because it was our Tea's first book and I needed to be good yes and so we just poured more normous amount of time in it and Lex was just a nice guy and he just poured enormous amount of time into it and it's really just hard work I mean most you don't books don't make a lot of money usually and even this one is sold pretty well it's not I mean we're not it's not we can retire on it or anything mhm so it's just you know labor of love that we just sort of were motivated to uh make it as absolutely good as possible and and like an example is like reducing duplication like there's a lot of duplication when you write stuff it just takes time to kind of get rid of it and there's still like a page and a half that I couldn't figure out how to get rid of that's buried in there of kind of repetition but yeah but you know it's just hard work it came out really well and I think it's you know it's a real treasure you know I think personally I think that's one of the main assets of scholar community that we know we started with this book right and it's kind of set the tone and and of the level right it's it's not very common and very often you get a book A book like this so you know we're really looking you know to have this book in skull committee forever right we want to see it updated yes we do yeah we do we I don't Osborne myself but we very much uh are are well agree with that we need definitely do that that's great that's great because you know now there is there are even talks you know at SK conferences what's new second right problem is we're just all very busy doing things and and and so but we do need to uh to do that definitely so uh I'm curious about art so you you also publish other books like scol and and so uh What uh what's interesting for you in publishing how do you find that uh affecting your technical work and you know how did you come become a publisher um you know I was a writer I wrote a book uh way back when the early Java days mhm and then I wrote articles and you know was kind of came to it from writing um and then when the dot crash happened I said hey I should c.com that's a that was a real not the best timing but that's what we did so me and uh Frank Summers and and and some other folks we we did this uh small community website I mean it wasn't small in terms of a lot of people were coming to visit it uh but uh that was really how I got into editing and Publishing was through publishing on the web first MH and being an author how is the name Tima uh no Tima was uh back when I tried to start a company that was about educational software I took two letters from learn two letters from think and two letters from Imagine that's what that's that's a r t i m a and it was also uh didn't mean anything uh yeah it reminds me of a Greek goddess well yeah I know it's a little bit like one of the muses the missing of program but what does she what does she she's the M of programming music perfect maybe she use of testing right yeah so uh yeah that's it really meant it was like Kodak Kodak didn't mean anything but was supposed to be easy to say uh the one concern I had was you know there's an r in there so in Japanese it's it's little harder to say it will be Ultima right it will be like a car yeah so uh I mean this is a great name right um so uh how did you come to work with scholar Tess and like what's interesting in the Tess space so Scola test was in part uh I I was like Martin knew Scola pretty well MH Lex spoon uh knew Scola pretty well because he was a you know getting his PhD under Martin over there and uh I didn't know Scola at all I mean I was just KN very familiar with and so if I'm going to help with this book I really need to learn it somehow so I decided I'll I'll port a Java test framework that I had that was actually the original thing but I thought well I'll Rea people might cuz the other thing is I thought you know there there might be an opport that people would actually use it since it's a new language mhm uh but originally it was just for me to learn schola on something that was not Mission critical business critical or anything it's off to the side but it got a lot of users and it just has consumed my life for eight years now I mean it's just to spend enormous amount of time on scol test uh all that time and scalac grew out of that and then Super safe the the compiler plugin has grown out of both of those things so it's really uh uh you know kind of taking over my life a little bit too much maybe well this is a great contributions to the skull Kinja right I think I know most companies I know are using skolar test right so this is really powering uh test driven development for many companies we should my next question you know uh what do you think of this test driven development uh approach and how do you see you know companies using it is it really kind of driving a lot of development uh well I I I write tests first most at the time and I find that helps me make sure that well things work I remember years ago when I first heard about it I was I was interviewing like this I was interviewing back when I was doing the media website I said interviewed Martin fer yes and he said that uh and I thought well this is kind of crazy why would you write the test first you know and he said he talked to this friend who whose boss came up to him and asked him how much of his code was working MH and he said all of it because he would write a little test and then write just enough code to get it to run and then you know he do that thing and basically it at any point you're everything's working that you know that you know about uh so I find that works for me it doesn't uh you know I know a lot of people just don't want they don't want to do it because it's drudgery it's like a chore and so they'll put it off and sometimes they'll write a bunch of stuff first to get it working and then they'll write tests later and that that also uh works and some people don't don't write tests that are automated they just test it by hand and sometimes that works depends on the situation mhm but uh I don't I wouldn't say it everybody's doing it I think a lot of people aren't yeah I mean it's much easier not to do the test right and actually like some discipline well you can test it by hand and then then it works but the problem is you don't get the the the regression test for later that you get sort of as as a side effect a good side effect yes uh of writing tests first and doing a little bit at a time like that so uh I remember at the time you know when uh I did the Ruby Bas start Abu had you know 25,000 tests which were run for half an hour in Ruby and that you know was one of the reasons you know I really wanted to switch to Scola and obviously a lot of these test we checking things like you know is the function called with the right number of arguments or like are they you know uh strings all so so basically you don't need this in scolar and type system actually removes the need for many tests but so how how do you see you know type system interacting with tests yeah that's a great question so I my talk at scal is is kind of about that um cuz what what Scala test is like how is is uh quality through tests and scalac is quality through type so if you like the different ways of using types to uh get quality so one of the things you want to do is remove requirements there's actually something called requirements in scalac which is a macro that gives you a nice failure message if you fail a requirement it does the same kind of thing that scelus does with the macro analyzes the Boolean expression so if you say require that the anti pass is greater than zero mhm uh you'll actually you know a lot of times people don't write the air messages either if when they do requires MH so you just get this exception but it will tell you if you use the requirements require it'll tell you which one you know what the numbers were and whatnot um so but still if you can get rid of those that's better because now you don't have to test for it but also can't blow up so uh in Scholastic in 2.3 which will'll release before scholar dayss the next few weeks uh there's there's a a POS in type which uses a macro to ensure a compiled time that literals are actually positive so um it's using macros it's to to sort of uh check something of about the value at runtime and then uh allows you to just make sure basically when you take a pause in you don't need to require that it's positive it's in the type that it's positive and that sort of thing so I think there there's a lot of things you can do with types and you should when it's practical sometimes it's impractical um and that's because then it's a if it compiles you know that's true but then there's things where you can't and that's where you can write tests and the other side of that is I think static analysis is a little bit undervalued in in the uh the uh mainstream programming Community I think uh and so that's sort of the third prong that that I've started exploring recently with the super safe plugin which finds errors that pass the type Checker but at compile time yes and and things like uh you can ensure that your equals comparisons are sane at compile time even though insane ones like comparing an option of string with a string would pass the type Checker it's you know the type type checking allows it but a static analysis could you know cause it to fail to compile interesting yeah well definitely looking forward to your Scholastic talk uh uh today uh and uh I think I will you know close with kind of a big question right so uh so so you know in Scala tests basically is used to test a lot of scalar code and Scala communities go in in New Directions all the time so for instance when AA appeared right people need to test AA and then Scola JS appeared people need to see Scola to use scolar JS so what is your strategy and where do you see sculla going and kind of how do you decide what's important and you know where do you want to basically uh add capabilities to scholar test so hopefully it can test all kinds of of scolar code uh um well I think you just have to listen so scholar. JS I think is very very very promising and it's you know the JavaScript is a huge there's a lot of people writing JavaScript so that's a pretty huge potential M um so we are working on that in scholet test um there's a lot of things that are in scholet test the way it's written right now that don't work under scholar. JS but they're not unsolvable so we just we have to do a lot of work but um that's actually something we working on right now is is uh you know supporting scala.js and in short term we can just run it through they have an existing sort of spbt test something like the spbt test framework where you can get a console output but longterm what we really want to do is something like we do when when you Fork an SBT test run in the forked VM where the tests actually execute there's a like a piece of scholar test that sends events scholar test events across the network to the other part side of scol test so like a distributed scol test people don't know that's what's going on but that's what's going on and then all the reporting is done over here so like creating XML files for junit XML or or uh just our you know file output that's stuff you really can't do over here but you can over here so that's what we long-term need to have it's not that long term but it's it's a bit of work we can't do it right away that's what we're working towards where in the the JavaScript VM you're sort of running on this uh I don't know J Scola test.js thing it's communicating back to the jvm and you can get all the reports you want and all the features that you know You' like uh but testing your T running your test in in JavaScript okay uh and do you uh see contributions from Community to help you get there faster yeah um what the community really helps with is a lot of um smaller things which is really helpful um they fix a lot of little things they contribute things not that little but something as major as this we have to do sort of do it ourselves so we get actually we get funding from uh sometimes when we're fortunate we get funding from users customers they're not really customers they're we you know they use Skol test for free but they're they're interested in a feature they'll sometimes fund give us some money to help sort of pay for um doing these big things so we need a big schol GS customer who will help you get the F okay if you are using schol GS in production please you know count bill well it's great to have you here with us will we're looking forward to your talk you know always entertaining always deep so great to have you here with us in commit all right thanks Alexi thanks for doing this stuff by the way thank you