Scale By The Bay 2018: Kazuhiro Sera, 5 tips to build long lasting Scala OSS
Recording: Scale By The Bay 2018: Kazuhiro Sera, 5 tips to build long lasting Scala OSS
you okay I will I'm gonna show the long lasting scar open-source project by the way this is now this talk is not about reactive things are all but I believe that this what this session will be very helpful if you are interested in working on open source project and I my name is Cass I have been as car enthusiast for eight years and I came from Tokyo Japan and this is my first visit to San Francisco Bay Area I love San Francisco Bay do a lot and also I love open source software so I started my own project like skylake JDBC skinny framework arabesque are at zero and also I took over the maintenance of existing project like Jason boy has escalate and sometimes car drops today I will specifically talk about skylight JDBC this is my most long-lasting of source project I started I have been working on this project for seven years skelux JDBC is a relational database client library in scholar and concept is as it name shows the Scala like in other words six cover idiomatic way to talk to database and also like into built on protocol database library so it provides easy-to-use APs and also has less dependencies apart from JDBC API and also scholar on edge itself and I have been working on this project for years so does collectivist JDBC has now many functionality but the basic usage of it is still being quite simple you need to know only three steps to issue the reverse query firstly you built a secret object by using an extended string interpolation or typeset DSL so in this code example the sequel object cube is built with sequence operation that is safe very safe way to build sequence because they it is free from secret Injection Portability and secondly you define function to exploit necessary but is wrong jdbc resultset in a good example the top of our tools like to topple the function extra tuber is from two body ideal name from the result set now finally you can perform seeker execution or database operation with implicitly past data rescission so in the code example Q seek relief map to topple the list here is type of output so list single single means option or drop us off at 0 the final you can you can perform the side-effect by calling a bright method with session it's also possible to use all odd commit or transaction while session when you perform modification where it's like in certain degree it so that's the overview of the library and also there are many other options in the same field as you may know the most popular library in Scala is a sleek according to the number of guitar stirs number two it squirrel and number three is to be and scaligeri bass is going to Porter not bad so maybe but I think maybe most of you found out this travel today so please try her out the very simple in memory database example on the top page of scale actually we see websites collected pieces of pork and if you like it or if you have any feedback on questions to me please feel free to reach out to me at any time during this conference I'll be here all day today so as I said correctly the VC project term seven years so seven years it's quite long so we had many major upgrades we had a fire scar of binary or measured versions we started with scar to night one and accordingly the latest stable version is to twelve and I'm working on the preparation for 2:30 and also we have the five JDK Bojan start at seven and the client the latest on this 11 at the 12 will come soon and this is not measure person but we had three JDK APL upgrades and we dropped JDK 7 support maybe two years ago at a time we added a PR new API that were introduced since introduced into a JDBC to 4.0 or dedicate and also we experienced migration SBT migration the Schenectady Schenectady BC project provides an SPT priming which a mess scar source code from existence of database tables dice PD plugin spare beneficial are useful when you start a new scale project which has to talk to existing database table so we started the development of the SVD protein when SPG version was still 13 so we needed to migrate to a speedy one so that's a brief 50 and here are five tips I'd like to share today and I'd like to walk through these tips one by one first one is find your life of project this is not a technical tip and also this is not specific to ask our open source project but I think this is this kind of foundation or basis when you really want to ignore same thing for a long time and I hope you see many project terminated due to the many authors personal changes personal events or social change our life changes such as changing job so that many also no longer uses current work having a family they're having hobbies one of the best thing you know but I also families I also have a hobby so I can imagine the situation it's it's more difficult to secure time for open source projects and also if the author was student skilled school graduation is your big friend so but those big changes in the whole artist are inevitable so we need to like if we really want to learn on same thing for a long time maybe we should find that focus on them it's kind of rifle project also we should be aware of the difficulty to find appropriate successors of your project so even if your project has many users sometimes it can be challenging to find appropriate successors of the project so ideally we should consider how to continue with the project somehow ok so number two yes be careful to ask our dependencies yeah this is very unfortunate but I have to say this because this is very critical if you have so many scattered dependencies ok I'm assuming that you're creating some library or framework and if you have so many dependencies you you should be aware that you're in the same boat with so many other people so the SCARA major upgrades and also cross building can sit pretty difficult for example if you have so many so many scary dependencies and scarlet news kilometer version has been released in other case you have to wait for all the dependencies new version races before you release your world so if we it caused a significant delay for your deployment and also they very stressful very inconvenient for your users and regarding across built it's just situation can be more little bit complicated or can be worse so if just one of your dependents it doesn't do cross bills or doesn't do exactly the same prospect as you do you cannot do maybe you may have to compromise your cross build for example one wheel dependency does cross bills but only for scar 210 and 211 in other case you cannot do cross built to or 212 just one of the dependencies so it's very tough limitation so if you well if you want if you want to do cross build it you should be built very careful about adding new scar dependencies and what so well what can we do for to avoid those kind of situation I understand this is not very clear and you really don't like it but I'd like to suggest consider choosing jabo dependencies over skaara if you create library or framework because I think this is very realistic trade-off and it will bring huge benefit to to your Reverend Smith library maintenance and it by doing that you can make skirmish upgrades and crossbills what's easier but of course they are downside so you have to do a little bit dirty work but such as hundred new modules in your source code so this is quite simple example it shows how to deal with know this part shows that how to work with his car collection so it's a box object you can use scatter collection Java converters to convulse trouble correction trick to scale for each object pretty easy so just coding ask our method but you should be be very careful about the possibility to have new ring like this so new Aska can be also called and in that case as comically dozen or so even if this is scale crashing object this is little body with no so it's very the way the tempo of it for so you should use option everywhere and also the same things the similar thing can happen with primitives so this example shows that the party is a seven on integer and body is no the second line shows that expected autoboxing so you cannot detect these kind of things in a compilation phase so you should be you're very careful about it and also use option appropriately and a core that's the appropriate combustion bevel I think this is a little bit annoying but this is not very difficult so once you understand it you can do that pretty easy but it can kind of pitbull so next one is stake with binary compatibility so what is binary compatibility so for most cases so many other is a binary compatible so in that case we don't see any one time linkie zeros well otherwise if you break a binary compatibility the painful situation can happen so you will see painful runtime errors runtime exceptions like such no such method error funeral run time so it's not comparison later so you cannot detect the issue but compile it a thwart beforehand so you may see the situation in the production system or staging apparent so we should avoid that so I think there are two things to do if you are provider of some library or framework and okay at the beginning of the project you will commit a lot of changes so in the face of course you don't have to count the binary compatibility but once you reduce the very stable version it's about time to have explicit policy about binary compatibility guarantee to your users and I'd like to become oh sorry I think menu to have the poison like guarantee the binary compatibility among touch buttons they'll be very common and is very reasonable after define a policy to ensure you define a sure guarantee invalid compatibility you should use appropriate to that is Mima oops NEMA is very powerful to the NEMA stands for migration manager for Scala and Emma can detect syntactic incompatibility by comparing current source code in your video project with the previous already it is to purchase the fetching of Java files from maven central and compare the binary and the detect unexpected potential issues and Mima is was created and has been maintained by light panty brokers and I have been using me for years mmmm emma is very stable and very powerful to detect issues and this is very simple example - how to set up Emma in project so you just add a speedy protein after that you define the setting that this is this is a very essential part so you need to define which version or which artifact should be compared just we doing that when you don't test what you do compilation the memo automatically rounds number four provide crossbills and I also mentioned about cross building a number two but I think cross build is very important if you really want to ignore the project for long time and also some support as many as as many users as possible in a different situation so the reality is that we cannot always use the latest cover version so you can imagine the situation by thinking about what spark as you may know but spark take two years to support sculptor 12 the recently they supported Scott to 12 are since 2 to 4 0 but the same but a similar decision can help them to tell any other reasons so we should be aware of those kind of people and there are two things to do I'd like this I don't suggest to support latest latest measures conversion and also its previous one specifically the years car to travel to them at this moment and if you are already familiar with cross building maybe you are the you already understand how to use source main SCARA - why not it was like - 11 to 12 and but I'd like to encourage you not to have so many files under those directories because if you have 20 of 20 of code under those directories the testing all prospects can be very hard or very time-consuming because it's not only switching the binary version but also you need to test the quality of each different implementation by the way that that means you can have multiple different implementation for same VAP is doing using this boost of directories so yeah so continuously working across fields can be little bit difficult sometimes so if you only need to have so many files under those birthdays before doing that you should consider the fact an existing API zero or reconsider the structure of the modules the last one is how effective is your bills why do we need it I think there are two reasons the first one is to reduce the cost of requests if you're writing your framework or whatever are quite succeeded to acquire your many users maybe you will receive so many progressed from users or contributors so you need it's about time to think about save your time or improve your work efficiency to redo the course and after call Auto rebuke all you need tomorrow you will master progressed at this moment you need to have confidence to do that because the changes may bring some regressions or unexpected bugs or some incompatibilities like binary compatibility or cross building issues l0 so we need reliable evidence that which ensures there's no problem with it so two things to do sorry first one is very very basic but if you if your project doesn't have any prospers Arthur it could see I built you need an event anyway you can use Java C or Sarkozy I for free for open source project I always really appreciate it so there's no reason now to use it and after in a brunette you can automate everything apart from caller Ids we needed we need we have to do code word by code repealed by ourselves but apart from that we can automate everything in principle so checking binary compatibility consistency of course Styles across bills on multiple Jadakiss can be automated and there are so many patterns so to cover all patterns you can use metrics built on Travis CI Osaka CI what is much expensive this is quite simple example to show the real example of crossbills matrix build story so you can see the three scale major versions and the two JDK version the in this case the 3 6 pattern will be supported for all six patterns that the same pure script we are all wrong and not only that you can have additional patterns like this so these this combination this combination is not supported in the six patterns so you can add any kinds of different any any other patterns like this and also in this example not only compile running tests but also checking the source code but source coding consistency so you can everything indeed you can hang anything in a great part ok so does the practice I Drive by shared and priority to this presentation I created on SBT project template and which includes all techniques I share in this talk so I believe that the templates should be very good starting point for you if you are new to this kind of things and you can you can create your own project by a speedy new command and space by my people the poster is you give your apartment okay so okay I believe that you found that scary see today so we throw it out and if you like it please increase detail stuff or what's the one I don't know and also have this let me review so find your it's outdated but enemy so right right work project or be careful are installed condenses and finally compatibility across building and cereals the shadows kind of those topics are very basic but it's pretty important to continuously working updating those kind of things okay that's it thank you very much [Applause]