Conversations about Software Engineering

Conversations about Software Engineering (CaSE) is an interview podcast for software developers and architects about Software Engineering and related topics. We release a new episode every three weeks.

Transcript

Joy Clark: Hello everybody, and welcome to another conversation about software engineering. This is Joy Clark, and today on the Case Podcast we're going to talk about Scala. I would like to welcome Sophia Cole to the show. Sophia is a Scala developer at ITV. Welcome to the show, Sophia!

Sophia Cole: Hi, thank you for having me.

Joy Clark: Just to get started out, my first question would be what your journey was. You're a Scala developer, so how did you come about to start developing Scala?

Sophia Cole: I didn't really know anything about computer science or programming or anything until I started a maths degree in university. I really wasn't enjoying it. It was very intense, and someone suggested that I do Computer Science as sort of maths-light, which was a stroke of fate I think, because I really enjoyed it. That was the first experience.

Sophia Cole: We didn't do Scala on that course, we did Java and Python, and then I got my first job in London on a graduate scheme at Net-a-Porter. The graduate scheme is really great, because you get to try lots of different languages and different parts of technology... And I came across Scala on one of my teams. The team was learning Scala together, so that gave me a really good introduction. I really enjoyed it, and that's how I stumbled across Scala.

Joy Clark: Cool. Is it your favorite language?

Sophia Cole: Yes, and it's pretty much the only one that I've really done in-depth commercially... Which gives me a bit of a different viewpoint than some other people.

Joy Clark: For sure. Can you describe the language? What is Scala? What makes it what it is?

Sophia Cole: It runs on the JVM (Java Virtual Machine) and it's from one of the original Java compiler developers, Martin Odersky. He created it to be - from what I've read on the internet - a better Java, but I don't want to misquote anyone. That's basically what it can look like - it looks like a better version of Java in terms of it runs on the same ecosystem, but it's more concise and has lots of different features.

Sophia Cole: It's got a really great community around it as well. Because it's not one of the bigger languages out there, I think the community comes together. I love the community, it's one of my favorite parts.

Joy Clark: That's always an important part of any language.

Sophia Cole: Yes. I've got so much support from people.

Joy Clark: Can you tell me what kind of language it is? Is it object-oriented, or imperative, or functional?

Sophia Cole: It's a hybrid, you could say. It implements different concepts. It has some OO concepts, it also has some functional concepts, and I guess it depends on how far you want to go with it. I started off writing it like Java, and that was kind of the angle that we went in to learn, and then slowly introduced to more of the functional concepts into our code as I went along. I've also moved teams in that time, and the new team that I'm in is much more functional. But there are some developers who are happier seeking towards more of the object-orientated side of it.

Sophia Cole: Another thing about Scala is that it's general purpose, so you can do loads of different things with it, and the type system is one of its main benefits. It's got a very strong static type system.

Joy Clark: Does it have any other benefits compared with other languages?

Sophia Cole: I think the type system definitely is really powerful, and I think something that Scala developers really love about the language is that once you've got the code compiling, you're very likely to be there already. You can really rely on the compiler to do a lot of the work for you.

Sophia Cole: The compatibility with Java is something that people really enjoy, because you can make use of loads of Java libraries. There's also a way where you can start switching over your Java code, if that's the angle you want to take in bringing Scala into your team.

Sophia Cole: People like it because it's concise, people like it because you can choose how functional you want to be with it. I think those are the benefits. The flexibility... Some people say maybe it's a con that it can be written in so many different ways, but I like it. I think it keeps you thinking, it gives you a bit of a challenge.

Joy Clark: You can do both object-oriented and functional programming - do you personally mix both of them in a project, depending on what you want to do, or do you stick to one or the other?

Sophia Cole: I think it depends. I've seen people do as much functional as they can, and then kind of break some of the functional rules, so it would be more of the object-orientated ideas. You can be immutable in most of your codebase, but then there are parts that aren't, and that's okay with Scala -- well, it depends on your personal preference, but you can definitely do it.

Joy Clark: Can you tell me briefly what it looks like syntax-wise?

Sophia Cole: It looks quite similar to Java, the curly brace syntax. You can do a lot with it, it's quite liberal with naming and... What else? What does it look like? That's an interesting question. The ecosystem is very similar to Java. Again, as I said, it can vary in style quite a lot. If you're going to look at some code that's written very functionally, you could get intimidated by it; I get intimidated by it. You can write in a very concise, but not very readable way. There's definitely an in-between that people try and land on, so not too crazy. You want people to be able to read what you've written.

Joy Clark: How easy is it to read code that other people write?

Sophia Cole: Again, I think it depends on their style. We've really pushed in our team to keep readability a priority. You can do something in one line, but it doesn't mean you should do something in one line. It depends. I think it's a really important thing for your team to decide on.

Joy Clark: So like with all other languages, you just have to work hard to make code look nice...

Sophia Cole: I think in Scala, as opposed to Java, it's a bit harder to do that, because there is so much flexibility. But if you prioritize it, it's not a problem. I think Scala can be really nice to read most of the time, especially if you compare it to languages like Python or even Javascript; I think it's easier to read.

Joy Clark: Do you know what kind of applications are mainly written in Scala, or is it just all different kinds?

Sophia Cole: I think actually the word "Scala" comes from "scalable", and on the user side. I've used it for scripts, I've seen it used for big monoliths, although that's not something I've worked on... So yeah, everything. I know that people use it for big data, so you can use Spark with Scala. There's loads of Coursera courses that concentrate on big data. I know that functional programming as a concept is good for concurrency, because you get the immutability. Scala has futures and actors that help towards the concurrency, the concurrent programming. I know that people have used it for Android applications, and AWS Lambda... It can be really used for so many different things.

Joy Clark: Can you do embedded stuff with it?

Sophia Cole: Sorry, what do you mean?

Joy Clark: Well, I guess Android would be kind of embedded.

Sophia Cole: Yes. I've concentrated more on back-end systems, microservices...

Joy Clark: Yes, me too. But I always think it's interesting as far as what a language is good for; there's the big data aspect, and then there's people who want to write programs that run on a microprocessor, a Raspberry Pi, and they still have a great performance. I don't know... You probably can...

Sophia Cole: Recently I was writing some AWS Lambda, and I know people do it. Someone who used to work at ITV has actually made a toolkit, an sbt-aws-lambda toolkit, which is really interesting. But recently I had the task to do that, and I actually opted to use Node, which isn't something I write at all, but it just felt lighter. I think with Scala there's a certain durability to it... I don't know where I feel that from, but something like Node feels lighter.

Joy Clark: Can you maybe describe the kind of tooling that's available to develop Scala?

Sophia Cole: Yes, I guess the main tool everyone uses with Scala is Sbt, which is the built tool. It's very easy to use, so that is great. I use IntelliJ, the IDE, to write Scala, and that has plugins available, and that works really well. I've heard great things about Ensime, which you can use without the text editors; that's got great Scala support, as well. So there's lots out there.

Joy Clark: What library or frameworks are often used in Scala? Or what do you use?

Sophia Cole: When I first started Scala - there's a framework called Play, and I found that really good to get started with Scala. The documentation is great, but it is a bit heavy, when you know what you're doing, when you know exactly what you need from something... But perfect for beginners; that's what got me going.

Sophia Cole: There's an Essential Play book that is excellent, and that really gets you up and running with Scala very quickly. I'd say moving on from that I use http4s, which is another framework, the https - that kind of stuff. That works really well; very lightweight, and gets you what you need.

Sophia Cole: If you're going to move more towards the functional side of programming with Scala, I recommend using one of the helper libraries - you've got Scalaz or Cats. Those both give you a lot of the functional elements to coding that help you along. You can do it without it, but I find it quite useful. I guess if people are up for a challenge, something that's kind of hot topic at the moment is Shapeless. There's a book going around that everyone is obsessed with called The Astronaut's Guide To Scala, by Dave Gurnell. Everyone's raving about that, so if anyone uses Scala and wants a bit of a challenge, I highly recommend that.

Joy Clark: Do people in the Scala community often use test-driven development, or are there other ways...? What kind of testing is done?

Sophia Cole: Our team is very much big on TDD and pairing, and I think those two work really well together. I find TDD to be far more popular now than it was maybe a year or two ago, but I feel like that's the main way people develop code nowadays. I think racing to green is a great TED/Pairing way to do things, so writing a failing test - maybe one of you can write the failing test and the other one can get it to pass, and I think that's nice, small stints of coding that help time go really quickly.

Sophia Cole: There's also Gatling, which has a Scala DSL which is great for load testing, and I think that's a nice way to squeeze some Scala code into your codebase if it's something you want to try... So that's always a good one.

Joy Clark: What’s Java interop like? You said you could use Java libraries in Scala - can you go the other way as well?

Sophia Cole: I'm not sure. I haven't tried that one. There are so many Java libraries out there that I don't think I've ever needed to go the other way. I'm not sure.

Joy Clark: So you just leave Java and like "I'm never going to go back to Java." [laughter]

Sophia Cole: Basically...

Joy Clark: "Unless someone forces me..." [laughter]

Sophia Cole: I do use Java libraries quite often just because, as I said, there's so many of them. You haven't got Scala alternatives for everything, but I would always choose a Scala alternative if I could.

Joy Clark: What kinds of Java libraries?

Sophia Cole: What's one that I've tried recently...? I think - is it AWS? Theirs is Java I think. RabbitMQ has a Java one, but I think ITV has open-sourced their Scala layer on top, so actually you can do that with Scala now. Those are the ones I can think of off the top of my head. We're slowly getting a lot of Scala ones instead.

Joy Clark: The type system in Scala is so much stronger than in Java, so I can imagine using Java libraries might not be as nice...

Sophia Cole: It's usable, it's okay. I think you can get it back into the Scala world very quickly from using the library. Have a layer that uses the library and then bring it back up to Scala as soon as possible. That's our way of doing it... But it's okay, I don't have any problems with using Java libraries usually.

Joy Clark: I just realized we talked a lot about strongly-typed, but didn't really talk about what that means... Could you briefly explain what it means to be a strongly-typed language?

Sophia Cole: Everything has a type, so you wouldn't necessarily pass around strings in your code, for example. You would get a type or you would create a case class that holds data and pass that around, and that is a type in itself. I'm not very good at the academics of these kinds of things... I just used it, and that's about it. And I love that it works, but I don't know the bits behind it. [laughter] I just know that typed systems mean that when I compile my code I'm fairly happy that it's going to work, because everything fits together.

Sophia Cole: When you develop something - a function and so on - you can basically write it through types. You know what you're getting in and you know what's coming out, and then you can get the function to do what you want based on the types, which is really something that can drive your development quite easily. I hope I explained that -- as I said, I'm not great at the academics behind these things; I just use it and love it and I appreciate it, but I should really learn more of the behind the scenes...

Joy Clark: Do you understand what a monad is?

Sophia Cole: Does anyone understand what a monad is?

Joy Clark: I'm not sure... [laughs] That's why I was asking...

Sophia Cole: There was a running joke a few years ago of "What is a monad?" and it was Burritos, and all sorts scattered around... I know how to use one.

Joy Clark: So how do you use a monad?

Sophia Cole: I'm getting tested now... It's something that you can map over or flatMap over, if anyone's aware of what those mean. It's getting inside of something. The visualization of a Burrito is a monad wrapping something up, and it means that you can work on the inside of something using Scala methods. I hope I did that okay.

Joy Clark: That's okay. I'm sorry, it's a really difficult question. I do functional programming as well, but I also can't describe what a monad is usually...

Sophia Cole: Do you know what a monad is?

Joy Clark: Okay, now you're turning the question back on me... [laughter]

Sophia Cole: I have said to other people - don't worry too much about the terminologies and the jargons... You get things like algebra data types, and monads, and all of these different words, and my advice to anyone who's like me, who struggles with those kinds of things is just use it, and then when one day somebody explains it to you, you're like "Oh yeah, of course I know what that is!", rather than trying to focus on definitions and things like that. I find those quite hard.

Joy Clark: I completely agree. I find it a bit -- especially in Haskell... It's like "Oh, but we need monads!" Like, "Really?" [laughs]

Sophia Cole: Yes, it's a tricky one. I know those kinds of things can make code really cool and work really well, and it's really impressive actually, to be able to use and explain, especially.

Joy Clark: I think that maybe monad is the easiest, right? Because maybe a monad either has something or doesn't have something.

Sophia Cole: We have a "either." Either something, or something else.

Joy Clark: So you can apply a function to the "maybe", and if it has it, then it applies it to the thing inside, and if not, it just doesn't.

Sophia Cole: Yes. Probably the easiest one is futures.

Joy Clark: Oh, are futures monads?

Sophia Cole: Are they? Oh, don't tell me they're not.

Joy Clark: I have no idea. They probably are. [laughs] I've just never really thought about it.

Sophia Cole: Yes, they're bound to be, I think... Oh, goodness... Anyway. Yes, I know "either" is, definitely.

Joy Clark: Okay, good.

Joy Clark: Sophia Cole:[00:20:07.07] But yes, you can work on the inside of an "either" without having to really worry about it.

Joy Clark: Okay. Again, I apologize for the difficult question. I was thinking we could help each other figure out how to explain a monad.

Sophia Cole: Yes, and I know it's really helpful to other people to -- I try to not worry about sounding silly, because I know it must be really useful to other people who feel like me, that not everyone knows the answers to things, but they're still okay; I'm still producing good code, I still have a job... [laughter]

Sophia Cole: Joy Clark:[00:20:43.14] I actually think that's great advice, just starting with functional programming. [laughter] Are you an active member of the Scala community?

Sophia Cole: I try to be. I try to get involved as much as possible. I love going to the conferences... Not just for hearing the talks, but to be involved in the community, talk to loads of people, hearing what everyone's up to, that kind of stuff. I try to blog, but I'm not great at keeping up with it. I try my best. I think it's hard when you have a full-time job and you've got other things going on.

Sophia Cole: The Scala community - whenever I go to a conference, it really inspires me to do more in my spare time. But you know, life takes over...

Joy Clark: You mean you actually want to have a life and program?

Sophia Cole: Crazy. [laughter]

Joy Clark: Well, I know you did do a couple of talks at conferences; we'll link those in the show notes.

Sophia Cole: Sorry, I'm on the side googling whether "future" is--

Joy Clark: "Is the future a monad?" - question of the week.

Sophia Cole: It's not clear, so there you go... Maybe it is, maybe it isn't. I don't think it is, actually.

Joy Clark: Maybe we need to write a Future Monad...

Sophia Cole: Blog post, there you go. Sorry. Did I miss your question?

Joy Clark: No. Is there anything in your city (I don't know where you're based), a local community?

Sophia Cole: Yes, it's London, so we have plenty. The London Scala User Group, we have Scala Central, there are the two main ones that pop out as meetups, and then we have the Scala Exchange Conference, which is in December; that's a pretty big one which is always pretty fun to go to.

Joy Clark: You said you started working at a company that was introducing Scala - were they just getting started with Scala in the company, or they just decided to add people to the team? Were they just adopting Scala in the organization or was it already pretty widespread?

Sophia Cole: There were one or two teams already using Scala, but there wasn't much expertise in the company. The team was quite small and they had a lot to get on with. We were based in a different building as well, so when they introduced Scala to our team, everyone in the team was new with it, hadn't used it at all. But that team did spend some time with us.

Sophia Cole: I think the main thing that helped us was outsourcing some of our training and having someone with us all the time. That really worked very well. Yes, we were all very new to it, and it was a really interesting time to join that team.

Joy Clark: Did you ever try to sell it to a manager or to a company? Like, "Move away from Java! Try Scala!"

Sophia Cole: Fortunately not. I think the decision had been made before we got there by that other team, but many people -- I've done talks around Scala at conferences and it's the biggest thing that people come up to me afterwards and say "How do I get management buy-in? How do I get people to let me use this and try this?" It's a hard sell, but I think it's worth it; that's my own opinion, I don't know if management think that.

Joy Clark: Did you face any resistance from other teams who weren't using it?

Sophia Cole: We did. Our team was one of about three or four in a certain domain, and our team dived straight in, started making Scala microservices etc., and management tried to get the other teams on board. The developers that were originally from Perl backgrounds... There was a lot of resistance, and I think the main thing that they did was just to try and inspire and excite people with Scala. Our team was used as kind of a "Look what they're doing!" kind of thing.

Sophia Cole: We were very much working on greenfield projects, getting up and running really quickly. We were all very enthusiastic, and I think it did seep out into the other teams. Scala - I think the people who aren't in it yet can be quite daunting, because it has a reputation of being hard to learn, and it's not as mainstream as Java, and there's not a huge amount of jobs out there. And there's this question of "Is it going to last?" It is growing, but "Is it gonna last?" There's been other languages that have grown this far, but maybe not lasted the distance. So far we're proving everyone -- I don't know if we're proving them wrong, but we're proving that Scala's sticking around, for at least now.

Sophia Cole: Another thing I didn't say about Scala is that there's always more challenges to look at, and I think you never really rest on your laurels as such. Other developers I've met who have been coding for 20 years feel like they know the language that they're using inside out, and although I'm quite young in the language, I feel like the reaction from people in the community is always something else to look at. There's always another challenge around the corner, there's always something you can look at to keep you motivated. I really like that part of Scala, as well.

Joy Clark: Is the language also getting new features? I don't know what the development cycle of the language itself is like.

Sophia Cole: It feels like there's always things changing in the community... I think more so on the libraries that are being created. Scala 2.12 was a big release, and that's brought about some great changes... But I would say mostly concentrating on -- there's a really active community that's always writing new libraries, always something of interest around the corner, always a big announcement at a conference, and that's exciting.

Joy Clark: Are there any techniques a company can use in order to train their employees?

Sophia Cole: I've had some experience with this, as I said, bringing Scala into the last company I was at. I found loads of different resources through that. I think everybody talks about the Coursera courses, the Functional Programming Scala... That's got a great following.

Sophia Cole: There's also what everyone deems The Red Book, which is Functional Programming Scala -- I can't remember the authors, but I'll let you know after this. Everyone reads that. It's a very hard book to do, there's lots of exercises, but that's great. I think those two are best when you're already in Scala, when you're already comfortable with it. There's plenty for beginners. There's an organization called Underscore; they've open-sourced all of their resources, which is great, because I learned with one of the guys from Underscore, and he walked us through all of the books. They've got Essential Scala, Essential Play... And they're all available now. I highly recommend those for beginners.

Sophia Cole: Techniques - I would say the thing that helped us the most, as I said, was bringing someone from the outside in to help us, and having a project to work on where you had lots of space to make mistakes, lots of space to throw away code that you think you can now do better... Nothing with too much investment in it. I know that sounds hard, because you're going to be building things for a company, but we found having a little service that did something for us, that we still used, it was still really useful, but if we have to replace it or make it better, we have that space to do so without being worried about making mistakes.

Sophia Cole: Another one that I always like to suggest to people is Hack Days, because I feel like I've learned the most through Hack Days... Giving your team time to explore new technologies without too much investment - you can decide to try something without writing it in your production codebase - is really beneficial, because otherwise you just get so much tech debt and so many bad decisions... It's nice to be able to throw it away.

Sophia Cole: And blog posts - looking at people's experiences online. Loads of people have really taken on writing blog posts, and reading about people's experiences has always helped me. I've done a few of mine, and I know there's loads online. I highly recommend doing that, too. It makes you feel not so much alone.

Joy Clark: Did you usually just kind of try and step out on your own, or did you do pair programming, mob programming, or anything else like that/

Sophia Cole: I've tried all of those, I think. The default was pair programming, which was great, because again, you didn't feel by yourself; you explore new things with someone else. But giving yourself time to make mistakes without feeling embarrassed is also important, too. I tended to do that more at home, or finding odd time throughout the day, rather than it be the default... Because too much of that can also be a bit demotivating, because especially if you're brand new to something, you don't tend to know exactly what you're doing. So a mixture of those.

Sophia Cole: I’ve also been in a training session, a workshop where we're done mob programming... It worked well for what it worked for. I wouldn't suggest it as a regular thing, because I think people who are a little bit quieter or a little less confident don't get to benefit from that as much. But it's interesting to see how it happens and how it works, and get everyone's personalities on board. It's definitely interesting, I wouldn't say it was a great way to learn.

Joy Clark: What would be your pitch? If you were to try to sell it to someone who's never used it before, what would you tell them?

Sophia Cole: I'd say it was an interesting challenge. I really like maths, and I really love problem-solving, and I feel like Scala gave me that kind of satisfaction in ways that Java didn't. I don't know if I can put my finger on it. I don't know whether it's the functional aspect or the cool little things that you can do with Scala, like pattern matching and "for comprehensions." I don't know how much detail to go in with those, but you can do all these neat little things that give me the same feeling that maths and problem-solving do. That's my pitch on how I find Scala to work with.

Sophia Cole: On a more "pitch to your team" or "pitch to your managers" kind of talk, I'd say that -- well, I went to a talk a few months ago now, and it was a really interesting one about how Scala can attract the best developers... And it's not mainstream yet, I would say; Scala is very much getting there, but I wouldn't put it up there with Java. You're getting developers that are interested in more of an academic-style language, a language that has a reputation for maybe being a little bit hard to learn, but has interesting challenges with it.

Sophia Cole: I'd also say that it's one of the challenges that comes with Scala, getting that buy-in from management, because there are less developers out there, but I think you get the really good ones... Although I'm very biased. I hope that answers your question.

Joy Clark: Yes, it does. I've been playing with the idea of trying out Scala and I haven't had the time, but I'm like "It sounds interesting!" It's on my to-do list. You've just convinced me now that I have to go and try it out. [laughter]

Joy Clark: I don't have any more questions. Is there anything else that you'd like to say about Scala?

Sophia Cole: That's a big question... Give it a go. There's loads of resources online. I saw one today - I think I've mentioned it before - where it's interactive on the browser, so that's really fun to just go and try, see if you like it.

Sophia Cole: The community is super welcoming, and we're trying really hard to be diverse and inclusive and interesting and challenging and all the good things... So it's a good place to be. I would say it's up-and-coming. I like it. It feels a little bit cool, I don't know why... But maybe I'm on my own.

Joy Clark: I don't think you're on your own.

Sophia Cole: People who like Scala really like Scala... That's always a good place to be.

Sophia Cole: Joy Clark:[00:35:50.17] That sounds good. Well, thank you so much for taking the time to answer all my question.

Sophia Cole: No problem, it was fun. I hope I answered them all... I'm going to have so many people telling me that I did things wrong, but I guess that's part of learning.

Joy Clark: Well, if you ever find out a great definition for a monad, let me know.

Sophia Cole: Okay, I will. I'm on the hunt. Thank you so much.

Joy Clark: Thank you so much for your time, and to all our listeners - thank you for listening.

Sophia Cole: Be kind to me!

Joy Clark: Yes, be kind to us. To all our listeners, until next time!