From the course: Agile Software Development: Pair and Mob Programming

Scenario: "Hello World" in Ballerina

From the course: Agile Software Development: Pair and Mob Programming

Start my 1-month free trial

Scenario: "Hello World" in Ballerina

- Well, welcome everybody, hi, Chiu-Ki. - Hi. - Hi, Yosh. - Hey. - And Steven. - Hey. - Great, well, we're all here today to work on a new to us language, Ballerina language. And when working as a mob or a group one of the tips that I would give is that we want to set up the environment. So I've done that so that we can get right into the code. So we're using VS Code, and you can see over here that I've installed a bunch of plugins. There's the Ballerina plugin, Docker plugin for something that we're going to do later, a mob timer, VS Live Share so Steven can join us, and VS Code Icons. But I know you guys, you want to get right into the code, don't you? All right, so let's look at our first lesson, and of course it's going to be what, you can see it up there it's... - Hello World. - Hello World, all right, so we want to run it. So, in order to do that, I'm going to go ahead and click over here, and then I'm going to open a Terminal window so we can just run this code. And, if you'd be so kind as to type, and you want to type Ballerina because that invokes the runtime and then Space and then Run and then Space and then 0, and that's the file name, and then Tab. You can see how it auto completes. - Nice. - So, yeah, go ahead and press Enter. (group cheers) - Hello World. That was too easy, wasn't it? So, you guys probably have questions even though there's three lines of code. Do you have any questions? - Yeah, I'm wondering what that args stands for. I've never seen that before. - Sure, that's a parameter on the main function or the entry point, and you can see that we've got a type called a String and then some dots and that means it can be one or more strings as arguments passed into the main function. - Got it, that makes sense. - But we are not using it right now in our main function. - Right, we're just passing in Hello World. Does that make sense? - Yeah. - Yeah, cool. Okay, so now we want to have Steve participate. Now what we've done is we've actually, using the Live Share add-in, we've signed in down here already, and we've already invited Steve, and he's accepted our invitation. And we can tell that because of the 1 down on the bottom. So he actually has control of our screen. - Oh. - I know, I know. (group laughs) - So, he's the mob master. So, we're going to make one small change to this code. So, what do you guys think? What should we change? - I want to make it speak French. How about we say bonjour? - Bonjour? - Yeah. - Okay, can you spell bonjour? - Sure, Steven, are you ready? - I am set. - B-O-N- J-O-U-R. - Awesome, now Steven, you can only see the code, you can't see the Terminal right now, right? - Correct. - Okay, so we want him to see the Terminal when we run this the next time. So, in order to do that, I'm going to click down here, and I'm going to share the Terminal, but I'm going to make it Read-only because we just want to keep control over here, not that we have any concerns, okay? So, can you see the Terminal now? - Yes, I can. - Great, okay, so now do you guys remember how to run this? Can you tell us how to run it? - Sure, yeah, it's Ballerina. - Okay. - Space, Run, and then it's the file name, which in this case is 0_hello_world. - It's not auto-completing when I type. - Why is that not happening? - Because we're in a different Terminal window, so just go ahead and type that out. We might not be in the right directory, so let's see if it can find it. - Okay. - I think you have a little typo there. - Heelo world. (group laughs) - Hold on, let's change it. - Yeah. - Hello_world.bal. - So, how do we find out what directory we're in? - I was wondering if you go back to the Explorer. - Yeah. - If you hover over, will it show us? - Right, if we look here with Learning Ballerina, and then we're in the Unit Tests. - Oh, okay. - So, actually, yeah, if you want to just change that directory. - Okay, so. - Yeah. Yep. - Let me go up and see, all right good, I don't have to type the whole thing again. - there you go, there you go. - All right. - Bonjour. - Bonjour. Yay, we speak french now. - We're you able to see that okay Steven? - Yeah, I saw the whole thing coming through live. - Great, great, well this was just a quick getting started, we have lots more to learn, so thanks Steven for joining us, and thanks Yosh, and thanks Chiu-Ki. - Thanks Lynne. - All right, thank you. - Thanks.

Contents