Kotlin - Ready for Production

0 0

[Music] anyway welcome thank you everyone for being here this is a talk on Kotlin it's a it's a very introductory talk how many of you here have heard of cotton used cotton okay so hopefully when you leave everyone uses cotton just go back and take boss we're going to rewrite everything in cotton why cuz it's awesome there you go that's the best reason to rewrite something because it's awesome I'm joking by the way anyway Colleen give you some background it was started by us in 2010 us being JetBrains back then we used to walk back then we still if you've heard of JetBrains we make developer tools and we've got two sides of the business one side is mostly Java and all of the IDE are built with Java and the other side is net and the Java stuff is all using Java so it make tools for all different types of technologies and languages etc but we're still using mostly Java to write it and we needed a language we need language it was a little bit more concise than what we had we need a language that was a little bit more expressive toolable and interoperable with all of the support and source code that we had which back then was ten years of source code right right now jetbrains at 17 years old so we we have a lot of legacy code and we want the language that was pragmatic now at the time we looked at multiple languages we discarded them for different reasons some of the things you'll see are probably very similar to Scala and you'll ask me why didn't you just go with Scala Scala is not a language that is easily toolable we know because we created tools for it and it's not a language and at the time it wasn't very fast now it's a little bit faster but it wasn't very fast then and also Scala is a very powerful language in that it allows you to do absolutely anything you want pretty much we thought that that could backfire at some point so we eventually decided to create our own language so first and foremost Colin was born out of need pretty much like all of the tools at your brains it's been developed under Apache 2 license on github ever since what is Kotlin it's a static language I always forget to mention that it targets the JVM JavaScript and we recently announced also native so native is already the first demo technology preview is already available you can download it I got it running on a Raspberry Pi which is quite nice without any of the JVM or anything and it works quite nicely current state it was released in February 15 2016 1 point 1 was released this year that was a 1.0 we have right now that slide is outdated in fact this is this is called goto is a very agile conference right there you go so next time I won't forget we've got 40-plus developers working on college that makes it the second largest team at JetBrains right Jeff brains were around seven hundred plus people 40 38 35 or so our IntelliJ IDEA Kotlin or no IntelliJ core and then the other ones and Colin is kind of like the second largest team right now at Jerry's right so we have a lot invested in in Colin over 100 committees it's used in more than 10 products now at JetBrains any new product that we create essentially is using Colin even our new dotnet ibe is written in Colin Java and.net who would've thought and I don't like name dropping unless it really benefits us so I will and so there's some external companies that are using Kotlin as well such as Expedia NBC News Digital Netflix Amex and a few more ok those are just some of them right where can you use it so anywhere essentially Colin was you know we create desktop tools and servers so we created Colin to be able to create desktop tools and servers but you can use it on any platform Android it's compatible with Java 6 so you can use it and it had a lot of uptick in the Android platform because of some of the new language features that it brought that Java 8 has brought to the JVM but still struggling on some aspects to bring to Android given that it's very similar to Java C sharp JavaScript groovy and pretty much put every language out there except brain F whatever it gives you a good ramp up time so the idea wasn't to completely move away from what you know but kind of use some of the knowledge that you know to be familiar with the language so I can promise you that if you know Java C sharp JavaScript Scala groovy all of these you'll pick up Kotlin in no time but that's on purpose and interoperability a big thing for us we wanted a language that was interoperable with all of the codebase because we just you know this isn't Silicon Valley you can just shut down for six months and rewrite in JavaScript we needed to interrupt with all of the source code that we have so we play a big part in terms of making sure that everything is interoperable how can you use it very very open right we make developer tools obviously we want you to use our tools but Kotlin is extremely open you can use it with anything you want you can use the command line you can use maven Gradle cobalt which is a new build tool similar to great on inspired by Gradle build using Kotlin and IntelliJ IDEA and does anyone still use ant I mean we do it J brains but I'm I thought we'd probably the only people in the world okay it's to us and Android studio eclipse we make a plugin for Eclipse and NetBeans we also make a plugin for net week okay that's it let's see some code any questions so far nothing I'm so good at explaining nobody nobody even had any questions now oh I'm sorry about that yes what platforms are we targeting for native right now it's called Raspberry Pi iOS but we're going to target iOS we're going to target OS X and Windows yeah probably they have some issues Linux already some of it works so any it's going through the LLVM so anything that works on that and so I don't know it does the flicker rate here the dot that's bad right it's bad so I wonder if it's the let's try this if I can do something about it that's much worse right oh is that better and we didn't even need a new cable let's make that thirty okay that's better right cool awesome so file new project now I've done this talk a couple of times which is an understatement and so there's various versions of it out on the web but I always like to give my audience something new because then it's not fair not fair on you it's not fair on me so we're going to do something slightly different so let's do my app for Chicago and Colleen comes with a very small runtime very very small really small like 700k also and a standard library so here's Kotlin ignore all of those are the files that was just in my source folder so I'll say sample and I create a file type main print line hello Chicago and that's about the only different thing you're going to see in this presentation over all of the different ones that are out there the name Chicago that's it okay I mean come on what did you expect me to now I'll do something's in different orders and that way it'll be slightly different okay so I'll run that and hopefully if that compiles we'll get hello Chicago there you go fantastic right don't hold back your emotions either and of course you can debug as well and I can do things like you know introduce a variable here and say variable message and then set a breakpoint on that and debug this and get all of the stack traces and everything so essentially you get all of the refactorings and all of that out of the box right you get all of that with Kotlin the tooling is top-notch trust me I'm not biased but I know by the way I work for JetBrains okay so one of the things that you're going to notice immediately is that there is no object there's nothing right so this is kind of like a just a file with a main entry point so that is the equivalent of in Java you would have a class and then public static void main the entry point for calling is just a function called main that matches this pattern okay so with Collin that's a good thing that I don't need to have all of these different functions as static methods of static objects I can just have functions in a file kind of like JavaScript and you move away from this idea of having like these utility classes and helper classes where you have all bunch of functions that you're adding because you don't know where else to put them right that problem completely disappears it was doesn't disappear now it goes over to files now you've got all of these different files and you don't know where to put your functions but hey we got rid of some characters in the process so I can have another function that says print message and then say message string and then print line message and I have string interpolation so a message is okay right so you know calling the function is very straightforward just print message and hello now a couple of things to notice is we're following the pascal notation where you have the parameter name and then the type okay and string interpolation as I told you you can do other things here for example do more complex things here's like say length and through operations you can do if else whatever inside of that as well yes question I think there are reasons behind it in terms of tooling and making it easier in certain aspects the ID question is why did we choose that notation as opposed to the John job also we wanted there was a there was a it was actually interesting to eat someone said oh these new languages you know putting their types after the names yeah except this was done like 40 years ago right it kind of is in line with those people from the JavaScript community of you think functional programming is this brand new paradigm that's just been invented okay anyway I'm not going to criticize the JavaScript maybe I should know I should right so let me show you a little comparison one of the things that we try to do with Colin is make it less more concise write more concise than Java now that's not saying a lot I mean it did you know Java is quite ferbos but to give you an idea let me go ahead and create a customer class so I'm going to create a customer class here and then I'm going to call it a Colin and I'll say customer right and it's going to be a class and I'm going to remove all of this I don't need that and I'll say well name string and let's go ahead and actually create a Val ID int and var name string and we can leave it at that right so this is essentially creating a class that has two properties and Colin there's no such thing as a field as such right these are two properties it has a property which is called ID which is read only because it's prefixed with it's got a vowel in front and it's got a property called name which is readwrite and this is also acting as a constructor right so I can express all of that in a single line now I'm going to go ahead and add something here modify called data right so that does a few things what does that do well let's go ahead and create a Java class and we'll call it customer Java right and we'll do private int I D and this is going to be read only it's not read only is it what is it final initialize add constructor parameter okay private string name add constructor parameter and then we're going to go ahead and create getters and set up for this for this one we're going to create a getter then we're going to come here and create a equals and hashcode and then we're going to come here and create two string and then we're going to come here and create a what else can we create override methods clone okay so that's Java that's called it okay so we try to be a little bit more concise now of course you're going to say big deal IntelliJ does that for you yes it does so essentially we're putting ourselves out of business no the point here though is that you don't know if this code is actually just standard template default generated by IntelliJ or your favorite IDE or if it's called something different or when you add a new field or a property you have to go and update that right it's a whole lot of boiler code that you don't need all of that is just essentially there for you with this single line now I did single the data is what's added the two string they're equals the hash code and the clone otherwise it would just be a standard class with two properties okay any questions right now let's close this off ok so what else do we have so functions functions are very simple as I said they're top level we have parameters that you've seen you have default parameters so this is again about cutting down boilerplate code so if I have two functions that take two different types of parameters one of them for instance is optional I don't have to create overload I could just pass it a default parameter so in this case I have a function with three parameters the last one has a default value of Smith if I don't call it without passing that value in it's going to default to Smith right given I have default parameters I also have naming of parameters so I can now call parameters using a name as a prefix so here I say that the default and optional parameters as you can see has three parameters and I say that the second parameter is X and the first parameter is y so I can change the order of it as well one of the good uses of naming parameters is if you have a code base where you have functions with a lot of parameters that you can't refactor you have to call it because it's third-party or whatever it gives you insight in fact if you're using for instance IntelliJ with Java you might have noticed with the latest version it also gives you kind of like a hint inside the IDE giving you information about the the parameter name okay then again going to conciseness so notice that the default return type in Kotlin is actually unit which is similar to void except it's an object so I can query on it as well and we'll see what an object is if I don't supply the defaults if I don't say unit by default it assumes it's unit so that would be the equivalent of void in Java if I want to return a type then I would just put the type here in this case I would be returning an INT one of the things big and calling again is type inference as much as we can infer we'll try to infer so if I want to create a parameter I don't have to say you know I'll create a parameter called my int which is of type int and it's equal zero I don't have to do that I could just say var my end equals zero I don't have to be explicit about the type the compiler will infer it and we try and do the same everywhere so here for instance I have a function that's on a single line essentially what I'm doing there is just saying x equals x times two so it knows what type X is and therefore it will return a type integer I don't have to put the braces or do things like return return return x times two and do that that would be the longer way to do it right if it's just a single expression that the function returns which many functions can be then I can just do it on a single line in that sense okay you can have functions with multiple parameters any number of parameters right and this gets quite powerful when you start to talk about some higher order functions which we'll see in a minute as well so here I can pass in a a b a b c as many things as I would like now one of the things that we try to remove in cotton is nulls right how many of you love knows it's like JavaScript there's always someone in the room that loves JavaScript there's one person they love note how many people love JavaScript now this poor okay same parts on the love note still have JavaScript at all so in column we we remove now by default the type cannot have the value null so when I declare a string here for instance of Val my string well this is caught this is Java maybe I should do this in common so if I say var var var my string equals blah blah right and I say var my string so I can modify it equals no right it says to me you cannot assign to a non null type right I can have null if I want but I have to be Excel it that this is can be nullable which is basically adding a question mark at the end so that means that this type is nullable so now I could do my string equals no right now when you're working with Collin you usually try and avoid notes because you know what's the point of null if everything is going to end up being if not now essentially but since we need to interoperate with Java we have to work with the concept of nulls there is a lot of the code that you're consuming is Java and Java can return a customer and that customer can be nullable right so how do I work with notes so here you can see that I have a typical Java code right if customer not null if customer gets first name is not null if customer gets first name starts with an A you know names with a are not allowed in the this is a security exception which is like the password algorithms on some websites so customer service in Java is like that now with Kotlin I can do something a little bit easier so what I'm doing here is saying I'm using this customer in Java but notice that there's no null checks because it's assuming that is not null so I don't ever have to check for null it's giving the developer the option of saying this type that you're consuming from Java isn't nullable or not right if it is not able I can actually say this type is not able and now I have to check for null so you see that here it's giving me an error and saying you can only do safe calls now instead of doing that if customer is not null then customer dot first-name I can just add this question mark which is like the Elvis operator and it just says if it's not null then call this if it is now then don't call it right makes it more concise if I want to shoot myself in the foot I can also do that and says I don't care that this is now call it anyway but this is a very important thing because when we first initially did this we saw okay the idea is that anything that I consume from Java is not able right potentially nullable so I will import everything as nullable what would happen we ended up with code bases of question marks everywhere so we thought okay that doesn't work why don't they annotate code bases and say okay an annotation processor will run and see if it's not nullable then it will mark that this question mark is obsolete this check is obsolete and therefore you don't need it makes it a little bit cleaner it didn't work out in the end either so the last option was do whatever you want right you know best whether the type that you're consuming is nullable or not if it is you add the question mark if it's not don't add the question mark and you don't need any extra checks so working with Colin you usually try and avoid nulls but working with Colin and Interop scenario you do have to sometimes deal with know some other things that we try to do to make it a little bit more concise so casting here is a person now notice that I have an open class here because by default classes in call in are final that means you cannot inherit from them unless you explicitly mark them as open and I have a class employee which inherits from person and the employee has a property vacation days I have a contractor that doesn't have vacation because what we all know we don't get vacation or at least paid ones here I have a function that takes a person and it says if the person is employee person vacation days is less than 20 notice what's missing there the casting right it's automatically casting that's why this is in green you probably can't see it but it shows up in green it saying that it's automatically cast this to a person an employee because it you've already told me you already made the check and this isn't it's immutable so I know that it's not going to be modified by some other thread therefore I can automatically cast this for you and it does the same thing often with nullable types as well now in terms of constructing a lot of times when you create classes again we try and be concise here you have the constructor in the actual same line as the name of the class definition right but you also have secondary constructors so if I want multiple constructors I can have them we just call them constructor with different parameters and then call the base constructor if you don't have secondary constructors and you want to do some initialization code you also have that option as well you create this block called init and inside init you initialize anything you want with the constructor but again often you find that this isn't really necessary so dependency injection how many of you know dependency injection right dependency injection one of the issues with that is that when I'm initializing code I have to make sure that it's you know it's going to be initialized at runtime so often when I declare type that type has to be nullable when I declare it because I can't initialize it with anything we have things for that for instance late in it which is a modifier which I can say you know customer val customer and and that would just insert well the syntax doesn't matter but it's the point being is that you can just say this is a late in it so I don't have to make this nullable I don't have to have explicit code to initialize this in the constructor and that goes to another level as well with delegation so here is an example of delegation now show you two examples the other one will go back to interfaces typical interfaces that you're used to I have a repository and then I have a pipe a generic type record get by ID that returns a tea or get all the returns list of tea the most incorrect ever implementation of repositories but that's what we all see in the wall and then I have a customer a controller class that takes a repository now normally what you would do here is this would be declared here and then you would say you know repository vow private field equals repository right initialize that and I would have to put that in in it or whatever in calling we have first-class delegation so what we say is that this value is kind of mixed into this class and delegated to whatever is passed in here is a parameter so notice that I have this function get all and I have get by ID and I'm not prefixing that with any field I'm not doing my private repository field dot get all my private repository field dot get my ID because it's represented by this line here it's saying those method calls are coming in from the parameter we're passing in as a constructor so it's kind of like a mixin if you're familiar with the mix-ins in ruby it's mixing in that functionality inside the class right now the question that might arise here is what happens if I have four different the dependencies being passed in where do I know what method belongs to what get yourself a nice IDE killing though if you have four normally that is another sign which is that class is probably coordinating too much so you need to break that issue down in a different way right don't pass in too many dependencies into your classes otherwise they still become God classes right now we've talked about constructing what about deconstructing deconstructing again we have things to try and make it more readable and more expressive so here for instance I have a function that returns a pair initially we used to have tuples so UO topples so you have you know tuples of three values of four or five then we reduced it to two pairs and triples and anything beyond that a data class because once you add more than two or three parameters you lose the semantics of what you're trying to do so if you need more than three values revert to a data class which is very easy to define but here I'm returning a pair how do I give that some semantic meaning so I could do something like for element in elements print line element first and second that doesn't give me insight into what that first and second element is but I can deconstruct and I can say for city country and elements then print country print city very similar to what you encounter in JavaScript okay and you can do the same when you're creating a type or anything and now in fact Kotlin also has throw away variables so if you've ever played with Haskell for instance you can actually deconstruct things and some of the the value that you're getting you're not using instead of getting hints that this variable is not used by the IDE I can just use the underscore saying I don't care about this value right how many of you love the singleton pattern how many of you know how to implement the singleton pattern how many of you have to look it up every time you implement a single pattern oh come on be honest if you are if you know the singleton pattern by heart then you are misusing your memory you should use it for something else like singleton patterns and regular expressions are not something you want to keep in here there's much more valuable things in life I always say that I want to go to my grave without learning regular expressions so here's the singleton pattern in Continent it's just an object there's a thing called a we have the concept of object as a first-class citizen so you don't only you don't need to create a class and then make sure that the constructor can only be invoked once and it's a private constructor blah blah blah you just declare an object now I'm not saying that this means you should all go and create singleton methods they're not that great if they're read-only they're fine staying neat a state they're not so good again but it goes down to try and make things as concise as possible right okay now here's some things that you probably haven't seen because a lot of these things you can see in multiple languages and as I said at the very beginning colin is inspired by many things all right but one thing that we have is extensions so what does this function do that function is hello can you see okay at the back they're too liberal eight for me to ask you now but anyway wait I'll ask you in ten minutes um what does that do that is a function hello except it's prefixed with string dot dot what does that mean well actually what it's doing is extending the string class with a new function right so I can come and in my main I can say this is me dot hello now any string class has that function this is me dot hello hello right the extension function is similar if you know c-sharp it's the same concept to see shop they call the method extension although in c-sharp e article your class with a static class and a static method and then pass in this is the first parameter here you just prefix it with the name of the class I can access the instance of the class I'm extending I can pass in parameters to the class I'm extending right now watch this this is Jo this should equal this if we come here that's understandable because I'm saying should equal takes a value and compares it to the actual instance and in fact this could be simplified like that right but it's got this other little thing here called M fix and that allows me to call it in this way this should equal this alright one of the key things we wanted to accomplish with Kotlin was the ability to create DSL Cecily deer cells that you can create easily simply in your sub domain and use them without having to understand AST s or a whole bunch of language theory and some of these things that you'll see now are what allow us to have this ability so the extension functions allow me to extend any class I can extend the Java class I can extend a call in class with any functionality that I want the infix allows me to create an that can be called an infix notation as long as it's a function that is an extension function on a member function that has a single parameter now the standard library comes with a whole bunch of things so here for instance I create and again look at the inference in calling you know that I don't have to be explicit I have a list of album list of tracks then I have multiple albums nothing around all of this explicit and surround types etc if I want to declare a list of numbers one to thirty if I want to declare an array of words array off and then all of the different type words capitals list off Madrid to Spain London to UK Berlin to Germany Washington DC to USA what is this - can anybody tell me what is it it's an infix function right where is this defined in the standard library so instead of me having to do this more explicit Madrid Spain pair this actually creates a pair for me makes it more expressive right and the standard library comes with a whole bunch of functions so filter filter you know on numbers we follow the groovy Convention as well that if lambda expression consists of a single parameter I can refer to that parameter using it instead of being explicit so I could say you know my even numbers equals numbers filter and then it would be a function that you know is divisor by two modulus to equal zero so the pair's but first of all in cotton in each of these funding expression this is a lambda expression right that's how you do a lambda expression : it could be multi-line right and if the first parameter is if it's a single parameter I can replace the explicit definition of it exclusive decoration of it with it so that's where that comes from okay that's like groovy I have all of these functions like map and if you look through the standard library the majority of these are extension functions on generic types so you get map filter flat map sorted sort by group by group all of these different things on all of the different correct collections are alias lists whatever you want applicate locates all of these different things this comes all part of the standard library so the high order of course I can create my own higher-order functions is all so here I have a higher-order function a higher-order function if you're not familiar with the term we've just used it with filter filter is a high order function higher-order function is a function that takes a function or a function and returns a function right now you know functional programming there you go a higher-order function this is a function that takes an integer and integer returns an integer right I invoke that I say print line func 2 3 how do I call that higher-order my sum I can reference functions by name similar to how you can do in Java now on a type so my son is a function that takes two parameters of type int and returns an int so match is the pattern that I'm expecting here now one of the things that I showed you around being able to do multi line with the lambdas one of the benefits that that has is that we try it again not only with the DSL which I may call it in extensible as much as possible and how many of you know they try with resources in c-sharp there's this thing called using which basically is similar I take an object that is I disposable and it automatically disposes it I say using this object open braces do whatever and automatically disposes kind of similar to try with resources I don't have that in Java I don't have that in cotton but it's very easy to create I create a function called using that takes an object that's closable and a body an action and I say try execute that action finally close it off right so when I want to use this I can do something like using my closable done right and it looks like it's a keyword right it looks like it's part of the language it looks like it's a construct of the language but it essentially isn't it's just a function and if you're familiar with a synchronous programming rx Java the keywords in c-sharp around the sink await we all of we have all of those in Kotlin as well they're called co-routines it's implemented in a generic way called co-routines and none of the solutions a sink await or any of these things that we provide yield if you familiar with the with the keyword yield then are part of the language they're just functions but because of the some of the conventions and the abilities that we have we'd call it it feels like it's part of the language so what else sequences a lot of the things that you saw like when I take a list of numbers and I do a filter and then I do a map that's all eager evaluation that means it's going to go through the entire list it's going to evaluate everything and then it's going to print out the result a lot of times now we want to work with laid evaluation which means basically process data until we find what we're looking for and then discard the rest you can do that in Java with streams in cotton used to be called streams and then because of Java coming out with streams we kind of changed it and we call it sequences so now I can take any collection and say a sequence and as soon as I do that any operation after that becomes lazy so it's lazily evaluated and last but not least in terms of coding algebraic data types okay so if you're familiar with this this is very common in languages such as Haskell for instance an algebraic data file type is essentially typed it could be of one type or another type boolean for instance right here I have a page result that can be a type success or type error so you see that the class success inherits from page result the class error inherits from page result if it's successful I want my class to contain some property called the URL if it's an error I wanted to return have a code and a message now forget the steal world sealed word here I'll tell you what that is so now when I do like when I do calling page result equals get page now when the result is with success print line URL and again notice that this is automatically casted to the return type when the result is error print line message right it's a much nicer cleaner way to do write code because I don't have to return an object that has everything whether it's a result successful or an error and then say if error on that property then you know make use of these properties if not make use of those other properties so this is just basically a subclass of the type page result what's the field keyword in here that's saying that this is it in a hierarchical way no other class is ever going to be inherited from page results yes no that's different that's open so open by default it's final right sealed means that no other class outside of these two are going to be inheriting from page result so it's limiting this the inheritance scope right now up to calling 1.0 you had to define it as part of the the class so like a child class but now you can actually put it inside the same file as long as it's inside the same file it's okay and if you combine this all of the condition all of this conditional statements like if when etc they all return they can be used as expressions as well so if I say return right because it's not I mean I have to say it says add else branch or add remaining branch recite well I don't even have a return type but if you use it as a return value if return a value from the wind then it becomes an exhaustive check because then you'll say you know you're not taking into account all of the different instance okay so that's enough food code let's go back to slides a little bit and just finish off with some things some other things that people are doing and Co is if you're doing Android development that's kind of like in a DSL for creating views without having to deal with XML Android extensions makes use of some other technology that we have in call them which is called the plugin for the compiler so what it does it actually gets information about your elements on your Android forms and statically typed them for you so you can refer to them by name without having to do a find by ID with the string etc spring boot spring is a very big advocate of Kotlin now they're using it extensively and spring boot now supports called in natively and you it has called in extensions it makes use of a lot of things Cobalts already mentioned this is the DSL for writing build in Kotlin and of course great old recently announced well recently no really a year ago announced that now they support cotton so you can write your Gradle scripts incontinent it's called Gradle cut Gradle script Kotlin instead of using groovy and they recommend Kotlin for any new plugins as well coming in 1.1 all of those things are there because 1.1 has already been released for you the next steps go to call in languor try call in languor and calling Cowen's you can download them offline play with them down the language books there's a whole bunch of books these are just two these already published if you're doing calling for android recommend the book on the left call it in action I've got an alrighty course if you're interested I also have a podcast now called talking Kotlin self-publicity their community is very very large very active very nice we've got about I think close to 7000 people now on our slack Don't Tell slack because they don't like open source projects on the free tier they'll love it on the paper of course so but yeah very active on the slack Channel right so you can join the slack channel and die with a thousand deaths of slack channels inside slack channels and also I wanted to mention with their permission try fork because they're helping organize this we're having a calling conference in San Francisco so if you're interested in that that's going to be a two-day event on November the second and third very cheap beautiful it's going to be big I promised I wouldn't do that anyway summary so I hope you get the essence of this the goal with this was to be a pragmatic language a lot of the choices that we have made is to make it easy to solve some of the problems that we facing daily development very easy learning curve the interoperability allows low risk adoption because you can add it to your codebase gradually you don't need to start with tests you know any java class can be called from colony calling class can be called from java and this is obviously a very subjective thing but empirical evidence based on my biases has proven that it is extremely enjoyable by everyone that I asked ok and Colin is here to stay and this is a very big important point because we have a lot invested in continent and we didn't make cotton to sell consulting around cotton or sell programming around cotton we create a column for us for our tooling and our tooling is our main source of income and you know we're going to continue to sell tools and Colin has now become one of our tools except we use it ourselves and we give it away free in the hope that you guys will all buy IntelliJ IDEA which eventually hopefully and to sum up you know someone tweeted and with their permission I I'm showing it the city research Colleen last night and then spending the morning looking amount in the boilerplate Java in Android studio I see why they did it pretty much that that's a good summary of why we did this thank you and we have one minute for questions no questions great thank you very much yes so the question is when I extend string where does that how does that impact so essentially as long it's based on a package level scope so when you define your package which by default is default package but you can explicitly define a package in Kotlin we follow the same conventions does Java you know the death by a thousand subfolders except you don't need to have them in subfolders but it's basically on the scope so when you're inside the ID if you write like you know a string dot hello the ID is going to pick it up and say oh there's a hello defining this package and I'll show you the intellisense then you hit enter and it will import the package for you all right class overrides can't remember function overrides the extension function so yes a data so the question of static versus instances everything I've done is essentially in a class as you know it in Java right a data class is a class in Java you have to create an instance of it yes I actually didn't show how to create an instance of something Val Val customer eCos customer there's no cute new keyword ok that's how you create an instance right the only thing that's not an instance is object I mean sorry the only thing that you don't create an instance of this object because that's already its own instance singleton ok yes yeah the question is when would you use Scala when would you use Collin general answer is if you're happy with Scala there's nothing for you in cotton simple as that right if you're unhappy with Scala take a look at cotton Scala is very powerful it allows you many things in column we don't we don't allow you to override any symbol define any of operator we limit you in what you can do we do that intentionally so that often we don't end up with the complexity this with that we do so question is around Java with Scala interrupts it's it's very very smooth and don't take our word for it ask on the internet ask on slack it's very very smooth because remember we had when we started we had ten years of legacy code we now have 17 years of Java legacy code like we're dogfooding this every day so we emphasize a lot the interoperability yeah so we're very if the question is around the explicitness around the types of functions right function parameter yeah yeah explicit yes yeah now we're explicit around that because that also helps in terms of optimizations and compiler speed times I think yeah go ahead last question because I think we gotta go yes you could the question is around testing you can use the existing testing frameworks absolutely in fact there's even more awesome frameworks one of them is called spread spec framework which you feel familiar with jasmine or mocha is essentially that and it allows you to do kind of like a very nice style of testing it is really really nice why cuz I'm the author for version and one of the now that's three of us maintaining it so you can see that I can do for example describe a calculator it should return it should return right but I'm going to be completely fair there's also another one called column test which is our competitor he's doing a great job as well the author and that is kind of like an implementation of Scala test in Kotlin so that also looked I did not pay for keywords there so that when they do call into spec shows up some some people actually do that so this is another one right and this this has its own kind of assertion framework right spec thousand we use hamcrest or a whole bunch of different things but this does have its own kind of expectations things right so there's already a lot of stuff around that area one of the things that we're going to do respect though is we're going to try and decouple completely from j-unit so that essentially you're going to be able to use spec when you target JavaScript native or jovian right that's it for time I'm here the three day so if you want come round and I'll be happy to thank you