# COMP1531 Week 1 Lecture 2

**Channel:** UNSW COMP1531
**Source:** https://www.youtube.com/watch?v=NS9u9Gj1EFo
**Transcript page:** https://www.withtranscript.ai/video/NS9u9Gj1EFo

## Chapters

- 2:07 — Technical Setup and Lecture Restart
- 7:22 — Course Recap and Study Mindset
- 11:57 — JavaScript Learning Path Overview
- 15:24 — Arrays, Objects, and Storage Concepts
- 21:32 — Object Syntax and Array Internals
- 27:57 — Primitive Types and Nested Structures
- 33:50 — Functions, Overriding, and Controls
- 38:47 — Programming Judgment and Future Skills
- 51:03 — Why Git Matters for Teams
- 1:07:36 — GitLab, GitHub, and Repositories
- 1:13:52 — Clone, Edit, Commit, and Push
- 1:21:36 — Syncing Across Machines with Pull
- 1:28:34 — Branching and Merge Requests
- 1:34:41 — Hotfixes and Branching Scenarios
- 1:37:50 — Branch Workflow and Merge Errors
- 1:49:49 — Merge Review and Lecture Wrap-Up

## Transcript

**[2:07] Speaker A:** Sa.

**[4:05] Speaker A:** Let's resume from where we left it off. So just give me a second to see this technical issue that we had here.

**[4:31] Speaker A:** Oh cool.

**[4:37] Speaker A:** Okay, Share again.

**[5:13] Speaker A:** Okay, so I need. I think.

**[5:26] Speaker A:** Okay. So on Mirror Red. Okay,

**[5:29] Speaker B:** can you go back to Beta Ninja and Reshare if you ever like.

**[5:35] Speaker A:** Oh

**[5:35] Speaker B:** no, don't do that. Reconnect.

**[5:37] Speaker A:** Should they.

**[5:38] Speaker B:** No. So you have to reconnect this. Okay.

**[5:43] Speaker A:** Can I remove now?

**[5:43] Speaker B:** No, don't delete it. Just reconnect this first.

**[5:46] Speaker A:** Okay.

**[5:46] Speaker B:** Anytime you like. Disconnecting display, you have to re. Share the video into like.

**[5:50] Speaker A:** Oh, okay. So leave it.

**[5:53] Speaker B:** So can I just.

**[5:54] Speaker A:** Yeah, yeah, sure.

**[6:03] Speaker A:** Send it to

**[6:03] Speaker B:** you.

**[6:04] Speaker A:** Okay, so we need to open the teams now.

**[6:35] Speaker A:** All good.

**[6:38] Speaker A:** Is it working? Recording.

**[6:58] Speaker A:** Do it again.

**[7:16] Speaker A:** Okay, so sorry guys for this technical issue, but.

**[7:22] Speaker A:** All right, so I'll try to help you build a habit in this unit, like weekly. So what I did is I prepared this word document. You can see it, right?

**[7:41] Speaker A:** So just to help you prepare for the, well, the exam, understand the material of this unit. So as you can see here. So what we did. So I'm going to do quick recap of what we saw last time like in the last lecture and help you just build a mind map. Okay.

**[8:02] Speaker A:** So it's going to help you because like for me the way you need to prepare like for these 10 weeks and you have a final exam, so you need to remember everything. I'm not sure like I think you will be allowed to have a cheat sheet or something, but I'm not sure about that. Don't take my word. We'll talk about that later when the exam comes. But a good habit to understand and assimilate things on the go week by week, it's to have a mind map.

**[8:26] Speaker A:** So weekly or. Yeah, weekly recap. I'm gonna do that. So try to help you build that habit. So what we did last time, quickly towards the course outline. So we talked about like what you have, the resources that you had and of course the assessment. So you have quiz project and the final exam. Then for the software process, we talked about the difference between com sci and send. It's not just comps like computer engineering, computer science, software engineering, what's the difference? And we let you try to deduce an definition of this paradigm or discipline, Software engineering.

**[9:01] Speaker A:** There is an emphasis on the teamwork. Then we talked about the software development life cycle and why it's a cycle. Then we talked about the waterfall which is the traditional regular sdlc. Then we have the agile and iterative. After that we Started talking about the programming languages.

**[9:21] Speaker A:** And for programming languages, I told you that we are not here to learn about JavaScript. It's not about JavaScript. Actually, you will be using JavaScript for maybe three weeks. Then for iteration zero of the project, then iteration one and two, you'll be using TypeScript. JavaScript.

**[9:42] Speaker A:** TypeScript. So for JavaScript, actually I think there is something that I told you about is any programming language that you're going to learn. So we have somehow a clear pathway, if I can use this term, to learn a programming language. So it starts with the input output, then the logic, then some advanced concepts. So for the input output is how to read, how to write.

**[10:12] Speaker A:** For the logic, it's about the if else controls, then loops if you have multiple variables and what else collections. And that's what we're going to see today for JavaScript, by the way. So for collections we have arrays if it's the same type, and objects if it's variables of different types. What I did now is I intentionally did not use any slides and I told you about that. So you will be using different programming languages.

**[10:42] Speaker A:** So that's how you're going to learn how. That's how you start learning any programming language. Input, output, logic, then collections, which is if it's same type, arrays or different type is going to be an object. And we will spend some time, actually maybe around 30 to 40 minutes practicing about that. Yeah, we talked about the reasons why we started with JavaScript.

**[11:05] Speaker A:** The reason is for the simple fact that it's easy, tolerant, forgiving and it's good for fast prototyping. And it's actually commonly used like in the software engineering industry. Yeah. So these dots are for you to fill later on or next week. Following this way to have a mind map.

**[11:27] Speaker A:** I don't know if it's encouraging you. I did not use slides, I just told you I did it. It's going to be part of your DNA because you will be practicing and that's if you build it week by week, it's going to be easy for you to remember. Even for the final exam, you don't even need a cheat sheet if it's allowed. Maybe you're not allowed this time.

**[11:49] Speaker A:** Yeah. So let's resume for the JavaScript.

**[11:57] Speaker A:** Is this okay? Like for the sharing? Okay, so we talked about it a little bit then, as you can see, I'll walk you quickly. Yeah, so we told you that you already took the C. So we start. The disclaimer is we start from C and take you to JavaScript.

**[12:14] Speaker A:** C is very strict and elite programming language. So JavaScript is going to be super easy for you. Then I will show you quickly here.

**[12:27] Speaker A:** Input, output, talking about variables and printing, like the mind map I told you about. Then it's still about input, output. So we have strings, then the logic, control structures, if else functions. I missed functions. So functions is just part of the logic because, like, if you want to write a program, it has to be broken down into bits and pieces. And this actually takes us to talk about the second half of this lecture, which is teamwork, because when you would be developing a complex software, it's going to be multiple developers, each one working on their part. So functions is the basic concept that allows us to break down a complex software. So if I ask you now, guys, 15 times 17 minus 11. I know. Divided by 100, how are you going to solve that? If I ask you to do that, use the calculator, Right?

**[13:32] Speaker A:** Okay, if I ask you to do it without a calculator, so how are you going to do it? You need to write it down, right? Or try to remember it. Then you start solving it. How do you solve it? If you can think how the brain works to solve this arithmetic operation. I even forgot the numbers that I just told you.

**[13:53] Speaker C:** No,

**[13:53] Speaker A:** no, it's not. It's not an algorithm. It's just how do you solve it? Like in your brain?

**[13:56] Speaker C:** So by algorithm, I don't mean computer algorithm. I mean, like, you know that you have to take a number and then another number and there's a series of steps and minute steps that you follow to subtract them and then multiply them.

**[14:07] Speaker A:** Okay, so it's an algorithm in your brain that does the whole thing at once, or it breaks it down

**[14:13] Speaker C:** step by step, but then at a faster pace, depending on how good you are.

**[14:17] Speaker A:** Okay, so what do you mean by step by step?

**[14:19] Speaker C:** So you. Like, for example, we've been taught that you move through a certain pattern. So you said, first multiply these two numbers. So we won't start by subtracting, we'll start by multiplying.

**[14:29] Speaker A:** Yeah. So this is from what you learned, right? I'm not looking for the correct answer here, but just what I'm looking for is the keyword of breaking it down step by step.

**[14:40] Speaker A:** And when you break it down, it's going to be components of your program. So the basic way to do that is through functions. Okay, it's confusing.

**[14:55] Speaker A:** Okay, so we talked about functions.

**[15:02] Speaker A:** This is confusing. What I can see here is not what I can see there. I think I'm ahead of myself. Yeah. So this is function.

**[15:10] Speaker A:** Then just like hold to that thought because like, remember that in the second half we'll be talking about how to break down a complex software using the collaborative work, which is the git concept that we'll be talking about.

**[15:24] Speaker A:** But the idea is even if I gave you this arithmetic operation, you have to break it down, right?

**[15:33] Speaker A:** So imagine you have a complex software, you have to break it down. Right? Okay, now so we talked about the logic, control structures, functions, then collections. So for collections, sequential collections, if they are the same type, associative, if they are of different types.

**[15:55] Speaker A:** What's that?

**[15:59] Speaker A:** Is it a sequential collection?

**[16:03] Speaker A:** So what you can see is same type, right? Letters, probe. Here. Oh, what's this? So you see different types. Name, age, height. I didn't even change the name of the previous lecture.

**[16:18] Speaker A:** Okay, so what's an array then? Like if we try to map it with sequential and associative, is it sequential or associative?

**[16:32] Speaker A:** Sequential. So what's the like if I ask you one question, why do we need arrays? Like this is a programming language question, like programming course question, why do we need arrays?

**[16:49] Speaker A:** Just first thought that comes to mind. Just throw it. You don't have to.

**[16:52] Speaker C:** Yeah, a great way to keep certain attributes regarding one particular object together rather than creating.

**[16:58] Speaker A:** We're talking about an array.

**[17:00] Speaker C:** Yeah, yeah.

**[17:01] Speaker A:** Just give me a basic concept, not advanced.

**[17:04] Speaker C:** Okay. It stores multiple things together in an efficient manner.

**[17:08] Speaker A:** What do you mean by efficient manner? So that's what I'm trying to crack

**[17:10] Speaker C:** here. Creating hundreds of variables that are nowhere related to each other and they can't be referenced together.

**[17:16] Speaker A:** Okay, you said reference. I'm looking for this keyword. Any other keyword important for arrays. Why do we need arrays?

**[17:25] Speaker A:** Yeah, so we have the size, so we know the size beforehand. Or maybe we don't know it. So that depends what we should choose. And you said referencing. There is another English word easier than referencing.

**[17:39] Speaker A:** Access. Easy access. If you have a collection of variables of the same type. You already did some programming courses, so this should be like the first answer that comes to mind when you get asked about arrays.

**[17:55] Speaker A:** So by the way, even when you get the degree and you start applying for jobs and you have the coding, not contests, but just coding tests, like in the first steps. Even for Microsoft and Meta, you will get this kind of questions. By the way, why do we need arrays? Very stupid question, but you need to have a convincing answer. Okay, well, so this refresher from programming course.

**[18:24] Speaker A:** Okay, so we're going to do Some practice, I will jump to objects. Why do we need objects?

**[18:34] Speaker A:** You got this question when you are applying for Meta Software Engineer.

**[18:40] Speaker C:** So objects, they again create entities that you can use in different scenarios in different functions.

**[18:48] Speaker A:** That's advanced. I'm looking for just a simple answer. Keywords,

**[18:54] Speaker C:** you have one thing and then the properties of each thing store as objects.

**[18:59] Speaker A:** So you have

**[19:00] Speaker C:** your one main idea and then properties of that idea.

**[19:04] Speaker A:** Okay, simplify, simplify. Guys, try to think storage. Even arrays are for storage. So what differentiates between arrays and objects? Both of them are used for storage. That's good. Actually, we skipped that. We should have talked about storage. Yeah, Readability. Yes. So storage, then you can access and read. Right. That's

**[19:30] Speaker D:** the code you write when you work with objects where you can use strings as keys. It's more readable than if you just use arrays where you use.

**[19:38] Speaker A:** Oh, I see your point. So you are saying. I think by readability you mean human readable format.

**[19:46] Speaker D:** Yeah, human readable.

**[19:50] Speaker A:** What do you think? That's very good answer. But is it the correct answer? I'm looking for? Close.

**[20:00] Speaker A:** Sorry. Different types. Yeah, so that's. I already said that earlier. It's a collection of different types. Thank you. So it's a collection for storage, for human readable format for different types. So that's the first differentiator between these two. I think maybe you thought it's already. We already talked about that and you started talking about advanced concepts like it's a human readable and these different properties.

**[20:24] Speaker A:** Okay, now maybe your answer is a better fit for this question. Why do we need objects?

**[20:32] Speaker A:** Why do we need them? Like why or what?

**[20:37] Speaker A:** What kind of things we need to store using objects? I think that's the question. Yeah, I'm trying to use plain English, by the way here. Plain English.

**[20:46] Speaker D:** I think instead of accessing the thing you store using index, you can use access them by the different types of stuff.

**[20:55] Speaker A:** You can access them by different.

**[20:57] Speaker D:** Yeah, different types. Like there are different categories.

**[21:02] Speaker A:** Yeah, you are roaming around the correct answer. We're going to see that now a minute.

**[21:07] Speaker A:** We have keys and values. So for objects, so for arrays it's easy to use index. So it's sequence. So it's easy to use just index numbers. But what you said and what you said, the human readable format, so you can use a key and go directly access the component that you need in the object that you are trying to.

**[21:28] Speaker A:** You are using in your software.

**[21:32] Speaker A:** Okay, so.

**[21:38] Speaker A:** Just trying to go quickly through that.

**[21:46] Speaker A:** Look at this code here.

**[21:51] Speaker A:** So we have the object.

**[21:58] Speaker A:** I think you're going to miss JavaScript after week three guys, because it's easy. So what do you gather from these two different black boxes there? Object Basic 1 and Object Basic 2.

**[22:12] Speaker A:** So we have an object. What's the name of the object? It's user data. Right, Let me see if you can see the mouse. Yeah.

**[22:20] Speaker A:** So it's user data here and user data here.

**[22:25] Speaker A:** Technically it's the same object, but the writing is different. So what are the difference? Can you explain the difference briefly, please? Simple English, that's the challenge for you. Maybe many of you know the answer, but.

**[22:44] Speaker A:** Thank you. So you can initialize it, just empty, right? You can initialize it just the interpreter knows that it's an object, empty object. Then you start adding one by one. As you can see here.

**[23:03] Speaker A:** How about this one?

**[23:09] Speaker A:** You define it all together, but you can change that so they are interchangeable. You can do this, that, and you can combine both.

**[23:19] Speaker A:** Okay, I think the access. Let's talk about the access now. So look at these two objects as well. Two black boxes. What's the difference?

**[23:39] Speaker A:** Actually your answer, right, you asked me how to access the object. So if you look at object.

**[23:51] Speaker A:** More two. So what's the difference between this one and this one?

**[24:00] Speaker A:** Okay, so what are these different ways? Object more 1. So how are you accessing the height?

**[24:10] Speaker A:** Just a dot. Right. And this is the commonly used in most, maybe all, I can safely say all programming languages. Okay. And this one, so you are using an index.

**[24:25] Speaker A:** This one is a bit specific for giving quirky languages. So it's like an access in an array. But you are accessing the. The key height and you will get the value from that. Yeah. So I think, pretty much.

**[24:48] Speaker A:** So I think maybe we can go to some practice now.

**[24:56] Speaker A:** But before that, this is an advanced concept. So we have arrays and objects. Right? But in the interpreter, in JavaScript itself, the array itself is an object. Does it make sense to you?

**[25:12] Speaker A:** It should, right? You did some programming. You did C. I told you, you can boast, you know, C. I've been teaching other universities, they didn't take C. Actually, actually, ce, they did computer engineer, they did C, but computer science didn't do that.

**[25:30] Speaker A:** So what's the difference? Not what's the difference? What does it mean that an array is an object?

**[25:39] Speaker A:** You already learned how to code using C. You can just translate that, as I told you, with the mind map, the pathway, how to learn programming language, any other programming language. But now what I'm trying to do, I'm just pushing you to think like about the concepts that are common across all programming languages, I would say why an array is an object.

**[26:05] Speaker C:** Like an array has different elements, an object has different properties. So just like you're accessing a specific property of the object using its name, you're accessing a specific element of the array using the index. So it's technically.

**[26:20] Speaker C:** Basically you can say the indexes are equivalent to the name of the properties in an object.

**[26:28] Speaker A:** That's not my question. Actually you are trying to see the analogy between arrays and objects. But the array itself in JavaScript, like if you see is an object by itself. If we look at any array here, let's take this one. Items.

**[26:46] Speaker A:** Items. It's an array. Right, but it's an object. What does it mean?

**[26:56] Speaker A:** If you have the answer for that, that means that you understand how programming languages work. It's not hard, it's just because when we create these concepts in the programming language, an array in the compiler is has to be an object because the object allows us to have features, properties and methods so we can manipulate that array. Imagine that you are creating a programming language. How would you code the array itself? Do you see where I'm going, guys?

**[27:32] Speaker A:** Trying to push you to some advanced concepts, to your future selves, software engineers. That's the thinking that, that we are looking for. Especially since AI can generate code. So your thinking, your understanding is what makes you ahead of an AI generated code?

**[27:57] Speaker A:** Okay, I think I'll go to one last thing.

**[28:06] Speaker A:** Have you seen that before in C? Primitive and non primitive.

**[28:15] Speaker A:** Data types. Primitive and non primitive. Okay, try to cheat and answer me. You can read that.

**[28:29] Speaker A:** Abstract. Struct. Struct.

**[28:35] Speaker A:** Ah, you are giving me the analogy of with other. Like it's a keyword. Struct is a keyword.

**[28:45] Speaker A:** Is it primitive or non primitive? Struct. The keyword struct.

**[28:52] Speaker C:** Object.

**[28:54] Speaker A:** So it's non primitive. It's a structure. So you use the primitive to construct.

**[29:01] Speaker C:** Yes, that's what I mean.

**[29:03] Speaker A:** Yeah, so you use the primitive to construct the non primitive. So you have to start from. So it's like language, natural language. You start from something primitive alphabets and you create words, then words, sentences, then from sentences to utterance, then utterance to what we have in like how the LLM works. Like how it starts from that.

**[29:26] Speaker A:** As simple as that. Guys, like 15 years ago I was doing NLP. We're just struggling how to read, you know the auto completion, your smartphone. So you write two letters and it completes that. It was huge deal back then.

**[29:44] Speaker A:** Then it's not just that you can write papers, books using LLMs start from that. So going from primitive to non primitive, I'm using the analogy. So you start from Alphabet to words to sentences, to books. Yeah.

**[30:02] Speaker C:** How come an array is not primitive but a string isn't?

**[30:07] Speaker A:** That's a very good observation. Yeah. So are you implying that a string is an array of characters? It could be. It could be an array of characters.

**[30:28] Speaker A:** But now I'll push you to think, why did we have the string as a primitive? So what advantage it gives us? What's the added value? Having it. So if you have an array, listen to this. If you have an array of strings or an array, listen to that guys. Array of, array of characters. Which one is faster?

**[30:55] Speaker A:** Array of strings. Right. So that's one way to look at it. Okay, having said all of that, JavaScript doesn't care about all of this. You can just write the name of your variable or constant and it predicts somehow the type or it guesses. Actually it's a guess of the type and that's why it's forgiving and quirky, as I said. So it's fast, it's good for fast prototyping. But when you will be, maybe you will like it. I was advocating a lot for it and for the choice of JavaScript. But you'll be using it for just for three weeks after week three will be, I think having our examples in TypeScript, even working on iteration one and two of the project on Typescript, you might go back to how bothersome C is when you write the code and you compile and you get the errors. So you need to fix the type.

**[31:58] Speaker A:** But you will appreciate it later on because it will not. Remember what I told you last time? Like it's on you. So you have to think about the logic and you have to avoid making mistakes.

**[32:07] Speaker A:** But if you have the control of data types, it helps you a lot later on. So it will spot the mistakes as bugs and you fix them and you'll, you'll be safe to move forward in the project. Okay. So yeah, primitive, non primitive. And JavaScript doesn't care about that.

**[32:27] Speaker A:** Yeah. Now I think one last concept, then I'll show you some examples. The last concept is how to link. How to tie. Tying things together.

**[32:40] Speaker A:** So how to link objects. Can we have an array of objects?

**[32:47] Speaker A:** Two last questions and we'll go to. So we can have an array of multiple objects. Because array is a collection of variables of the same type and the type is an object.

**[32:59] Speaker A:** So we did not. We are still respecting the rule Right.

**[33:07] Speaker A:** Can we have properties in the object as an array student and your marks like student. So you have name, age and marks and you will have your marks. Can we have that? Why are you saying no?

**[33:25] Speaker C:** Unless you're considering the age to be a string, maybe then you can. Otherwise it's an integer.

**[33:32] Speaker A:** Yes. So it's going to be. Okay, can we have an object having an array of objects within it and within the properties?

**[33:41] Speaker A:** So a property could be an array. Yeah, so that's the point of all the details are in the slides and they are shared with you guys.

**[33:50] Speaker A:** But just what I tried to do here in the lecture because you have lecture 210 lab and you have your own practice on your project. So just trying to provoke your thoughts how to think of programming language. Okay, so let's do some practice here.

**[34:10] Speaker A:** Okay, so last time we. By the way, you can access that code. It's already shared with you last time. Can you see that? Can you see the code or should I zoom in?

**[34:28] Speaker A:** Can you see it clear? Okay, so last time we did.

**[34:48] Speaker A:** Okay, So we have this function, the name is hello. And this function, the name is hello. Both of them have the same name. What do we call that in polymorphism? Right.

**[35:05] Speaker A:** Fancy name overriding. So we can use the same name for variables and functions. Right, so we have these two functions, ABC and ab. Then we called it here.

**[35:19] Speaker A:** So these are the names of the admin team, by the way. Okay, look at the call here and the outcome. So the outcome is the second function got called and the outcome is just the first one. So we know that this function got called not this one. What does that mean?

**[35:44] Speaker A:** I intentionally tried to add three parameters. Abc. Abc. What does it mean?

**[35:54] Speaker A:** Yeah, so js. It's part of quirky js. It always takes the last function. It overrides the whole thing and takes the last function. Okay, I think yeah, we left it off here last time.

**[36:10] Speaker A:** Now quickly we will go through controls.

**[36:16] Speaker C:** So just to clarify that you're saying that if we had declared hello AV above. Hello ABC, you would have done ABC.

**[36:25] Speaker A:** Hello.

**[36:26] Speaker C:** Sorry. If you take this function from

**[36:28] Speaker A:** this

**[36:29] Speaker C:** one.

**[36:29] Speaker C:** No, from 8 to 11.

**[36:31] Speaker A:** Oh yeah.

**[36:31] Speaker C:** And you put it above the one from 4 to.

**[36:34] Speaker A:** Let's try, let's try.

**[36:45] Speaker A:** So I got called one one and take that.

**[36:55] Speaker A:** What do you think? According to the logic you just said

**[36:59] Speaker C:** according to that it should call 22 because it's the last function.

**[37:12] Speaker A:** What do you think? Second one.

**[37:17] Speaker A:** So it called the second one and we have return ab. So this one returns just a. Yeah, Stupid, right? Quirky stupid. This answers your question.

**[37:29] Speaker D:** Now it's time to use strip.

**[37:33] Speaker A:** I answered. Oh yeah, yeah, yeah, yeah. So I hope this answers your question of last time. So now let's quickly go through controls, try to skip things here.

**[37:54] Speaker A:** Okay, so for if else, There is nothing to show here, nothing different than C to show here. But if we go to.

**[38:11] Speaker A:** You do know that you have access to that, right?

**[38:16] Speaker A:** Yeah, actually this takes me to show you that. So if you go to the material here or even slides of today are available for you to access and for the code, just GitLab and it's here you can see all of these functions. Then we will see now how to use GitLab. We'll see it in the second half of the lecture.

**[38:47] Speaker A:** All right, any questions so far? Just recap, recap with the programming language that's easier that what you've been using.

**[39:12] Speaker A:** Okay, any questions? The most important concept today actually is.

**[39:24] Speaker A:** I don't know, actually it's. It's not just learning JS because we gave you a disclaimer. So it's not enough to learn JS in one week or in one lecture or two lectures, but just we gave you this kickstart and you have all of this material and it's easier than C just. I think the takeaway is the transferability of learning any programming language. Try to simplify that. I've been teaching Java I think for the last four years. I hate Java, by the way, and I'm teaching that I have to, to pay the bills. But even. Okay, question for you guys and your perception. Let's just your perception is C harder or Java harder?

**[40:09] Speaker A:** Yeah, I think since you learned C, I think any other programming language is going to be easier. And using the mind map that I just gave you, you can learn and crack any other programming language language. And after week three, you can put this to test by learning TypeScript, which you'll be using for your assignment. Okay. Okay. So what I did here, me and the previous team and the previous lecture, so we provided all of these codes to follow the slides so you can see case by case. Like for example, here you have this array and you can use while to print you can use for loop or you can use this advanced concept. Well this one like items. Remember like an array is. I told you that an array is an object. So the array is items. And since it's an object, so it has a property called length.

**[41:11] Speaker A:** So I can items dot length and I can use for loop. So it has different formats I in items. So what does this print, like my question for you, look AT line number 17.

**[41:28] Speaker A:** So this loop here, constant I in items. And I think it's the same one, right? Yeah, I think this is the same. Yeah. So what does this one print?

**[41:48] Speaker A:** Sorry?

**[41:49] Speaker C:** Every element inside items.

**[41:55] Speaker A:** So it's A, B, C, D, E. Right. So these are the values, but look at the outcome.

**[42:02] Speaker C:** All right. Is the integration because you've done in. If you've done off, then it probably would have.

**[42:08] Speaker A:** Okay, so what does it mean I in items? What. What am I printing here? So I'm printing the indices of the variables. If I change it to off,

**[42:21] Speaker C:** then abcd,

**[42:32] Speaker A:** Same thing. Oh yeah. Ibcd. Yeah. Abcd.

**[42:36] Speaker A:** Yeah. Okay, I think what should we talk about combining? Yeah, let's go to this one.

**[42:52] Speaker A:** So I think you have access to that code and you can see this here. So look at that here. So we created three objects. Student one, two and three. Then an array.

**[43:05] Speaker A:** Array of objects printed. Now the difference between approach one and approach two, I think this and you will conclude the.

**[43:24] Speaker A:** JavaScript. So what's the difference between these two approaches? I hope you can see both approaches.

**[43:29] Speaker C:** The first one is the more C style approach and second one is the JavaScript style.

**[43:36] Speaker A:** Conventional approach is one, not two.

**[43:39] Speaker C:** Yeah, because the first one follows the general format in most programming languages like C. The second one uses for.

**[43:48] Speaker C:** And that's more JavaScript. It's not there in other languages, I think.

**[43:53] Speaker A:** Do you agree.

**[44:00] Speaker A:** I'm being neutral today? I'm not vouching so hard for JS like last time. Which one is better from your perception? It can be subjective. And which one is the conventional? I liked your answer, by the way. The conventional one. Which one is the conventional approach one or approach two? Do you agree with him? Approach one?

**[44:23] Speaker A:** Just say it, guy. There's no right or wrong. Just say things. I think I should bring chocolate or something and throw it to you when you answer. Yeah, yeah.

**[44:34] Speaker A:** So what do you say? 1 or 2?

**[44:37] Speaker D:** 2 is more readable and you save like the interpreter some word.

**[44:43] Speaker A:** Nice.

**[44:45] Speaker A:** So it's more human readable. You mean easy to understand. Natural.

**[44:52] Speaker D:** It's also likely a little bit faster.

**[44:55] Speaker A:** Sorry,

**[44:55] Speaker D:** it's also likely a little bit faster.

**[44:59] Speaker A:** Elegant. Right.

**[45:00] Speaker D:** Depending on the interpreter.

**[45:03] Speaker A:** It's like more efficient. You're saying.

**[45:09] Speaker A:** See another perspective here. So the. The most commonly used one is approach one. Some of you said. But the most efficient one is approach two because of the.

**[45:22] Speaker A:** So this is another perspective that you need to look at. Thank you for your answer, by the way. So guys, I can be demoing to you and just writing this code or just discuss these codes for you so you can make informal choices when you be coding by yourselves. So approach one is the most conventional one for a reason. I want you to tell me what this reason is and approach two is more efficient. Do you agree?

**[45:55] Speaker A:** Yeah. Just say it.

**[45:56] Speaker C:** So approach one is conventional because it's allowed in all languages, or at least most of them. So you can do the same format in C, you can do it in B, you can do it in all the languages. But the problem is that it's longer and it's more tardy to remember.

**[46:11] Speaker C:** The second one is specific to certain languages like JavaScript, so people might not remember if they're switching from another language.

**[46:17] Speaker A:** Yeah, so you're talking from the programmer perspective. Yeah, so not from the programmer perspective. I'm going to take your answer and say most of programming languages are non as tolerant as js, so it works in all of them. But JS is more expressive.

**[46:38] Speaker A:** So this is another term that you will be learning in software engineering, the expressiveness of programming language.

**[46:45] Speaker A:** So approach to with this expressiveness allowed us to have a better way to code this function.

**[46:54] Speaker C:** Unless you're exclusively working with JavaScript, which I don't think anybody would be because anything you want to make with JavaScript you do need other languages to support your project.

**[47:03] Speaker A:** But most

**[47:03] Speaker C:** two just doesn't make sense to use,

**[47:05] Speaker A:** I think, unless

**[47:06] Speaker C:** you're exclusively.

**[47:08] Speaker D:** I mean, if you're using approach one, you're declaring variables using const and let and you are obtaining a list of a rate using dot lens. Those are not conventional in any other programming languages.

**[47:21] Speaker A:** He's not talking about conventional the way it's written, the way like you're going to parse the whole, you're going to parse the array and look for it.

**[47:29] Speaker A:** So that's the way it has been written is conventional. But the other one is straightforward. And because of the expressiveness of js, we could do that. But. Well, we can keep discussing that, but just my point is just to tell you that programming you can just write anything, like flush out ideas and write them in English like you do this analogy with programming, but it's not.

**[47:52] Speaker A:** So if you train yourself to write a good code thinking of different criteria like efficiency and expressiveness, as I just said, your code is going to be. Because there's a question here, which code is better?

**[48:13] Speaker A:** Which code is better in your future jobs when you be applying for jobs? Many, many, many times. Well, I've been part of judges to hire people sometimes Your code doesn't work, doesn't give the correct answer that you are looking for. But we hire you. What's the reason?

**[48:41] Speaker A:** Your logic. And you think of multiple criteria. Efficiency, for example. We know we are looking for efficiency. So if you are like, you're thinking the way you code is good, it's not the code itself is good.

**[48:55] Speaker A:** Remember, AI can generate code. So these are the differences between you like to prepare your future selves. Yeah.

**[49:05] Speaker C:** So on that note, a small question. So I have appeared for like coding tests before for like internship and I see that through the coding rounds people generally just get auto eliminated based on the number of test cases that they pass.

**[49:20] Speaker C:** So do they actually look at each person responses?

**[49:23] Speaker A:** Oh yeah, I think yeah. Let's stretch a little bit like for two minutes, then we'll take a break. Guys. It's a good question.

**[49:30] Speaker A:** So for coding for your future jobs and we'll be competing for. So when you write a code sometimes we are looking for the correct answer. So we have automatic marking and that's what we do by the way, in this project, in this unit. And sometimes like yeah, actually in, in the academic setup we do the hidden test cases and automatic marking. But for your future jobs we look at the way you code.

**[49:58] Speaker A:** And in the near future, actually just by the year you will graduate, we will not be looking at your code, we'll be looking at your skills. Md like the way you describe how to write your code to AI. How to write your code. So AI is going to write your code. You have your intent to ask the AI to write your code.

**[50:19] Speaker A:** Listen carefully to this guys. I know it's not directly related to this unit, but it's related to your degree and your future jobs. So now you are learning how to write code to get the degree, whatever, like this in this unit and other units. But when you'll be allowed to use AI. So you, you will be taken from js, Python, C whatever to English.

**[50:44] Speaker A:** And the way you express your intent to write the code reflects how good developer you are. Which are these criteria that you are talking about? Okay, just I try to inject these advice every now and then about your future career and.

**[51:03] Speaker A:** Time for a break now. And after that we'll talk about the most important concept in this unit which is git working collaboratively to develop a complex software.

**[51:16] Speaker A:** Okay, time for a break guys.

**[51:20] Speaker D:** Really quick documentation reference for the declaration.

**[51:39] Speaker D:** Sam.

**[52:04] Speaker D:** Sa.

**[52:30] Speaker D:** Sam.

**[52:56] Speaker D:** Sa.

**[53:21] Speaker D:** It.

**[1:02:22] Speaker A:** Let's resume guys.

**[1:02:34] Speaker A:** Okay, so as I said earlier, so this is the most important concept that you need to learn and Practice in the upcoming weeks, like this term. So it's about git. So I'm going to say git, that's written there. But what do you gather from that? Like git, maybe some of you have already used it before, maybe not.

**[1:03:09] Speaker A:** But I'll start with the problem that we have. So as a software developer, it's going to be a team of engineers, developers working together to, I don't know, write a software or build an app or whatever. And this app. So it could be so they can work collaboratively or concurrently. I'm not sure if I pronounced it right.

**[1:03:43] Speaker A:** So what's the difference between concurrence and collaboration? So they could be working on different components or they could be working on the same thing. Well, the big picture, they are working on the same thing, the software. Right. But they can split tasks and they work on different things or work maybe on the same component like at the same time.

**[1:04:06] Speaker A:** So in order to manage that, if we can use simple file sharing, it's not going to be enough.

**[1:04:16] Speaker A:** I think that's the motivation behind using git. Now, before I move forward and talk about the details of this concept, when we got Google Docs and the cloud, like overall, then we got all of these services where you can share a document. So when you share a document, how is it useful? Google Doc, how is it useful?

**[1:04:49] Speaker A:** Yeah,

**[1:04:50] Speaker C:** you can allow someone else to work on the document after you.

**[1:04:53] Speaker A:** Okay, okay, you have two parts of your answer. You can allow somebody else to work with you, but you just, you said not with. You said after you.

**[1:05:06] Speaker A:** And this is very important. So you will be working together on a shared file, but you have to lock it work. Then somebody else will be working right now, if you are working together at the same time, what's going to happen?

**[1:05:24] Speaker C:** Your live edit won't necessarily reflect in time. And so what will happen is they'll make a different edit. That's not. The version won't be the same. Basically. I think that's the key word here. The version is not the same. So it's going to cause a conflict.

**[1:05:38] Speaker A:** Yeah, so there will be conflict. It's not straightforward. So in writing just documents and it's a bit messy if you are working on the same thing or the same file at the same time. So this solution, it is a solution actually still it allows us to write code together.

**[1:06:00] Speaker A:** But it's not enough because.

**[1:06:07] Speaker A:** I was just talking about that OneDrive and Google Docs and all that because of these two major reasons. The first one is we need to keep track of the nitty gritty details of the history of your work to keep track of the whole thing. So that's the first box there. Number one, version control. And the second part?

**[1:06:32] Speaker A:** Yeah. Oh, there's a mistake. See AI, this is AI should be 1, 2. It's one one the collaboration, concurrent programming. So as I told you, concurrent programming, it's not like just concurrent, it's collaborative or it could be like working on the same, same thing together at the same time.

**[1:06:56] Speaker A:** So in order to manage that we have this concept of git. So git actually it's something that runs in the back end. Like it's designed to manage code base when more than one. It's not like one or more than. Yeah, one or more like one software developer or more working on the same code base.

**[1:07:23] Speaker A:** So we have this git, it helps to manage the version control of that code base and it supports the cloud as well. So we can have like multiple users.

**[1:07:36] Speaker A:** Of course, that's the main reason. Now have you heard about this GitLab, GitHub? I think everybody knows GitHub what GitHub is.

**[1:07:49] Speaker A:** It's your profile, it's the card that gets your future job and BitBucket. So pretty much they are all the same thing. They are the. I would say it's like a front end. They are web apps that support the cloud when you are using git in the back end.

**[1:08:10] Speaker A:** Okay, we're gonna see with. Actually this, this part of the course needs to be like hands on. So we'll do it together now. But just what do you understand? So before I start, what do you understand from these GitHub?

**[1:08:25] Speaker A:** When you hear somebody talking about GitHub? So what's it about? Just say it. Just throw words, guys.

**[1:08:34] Speaker A:** So it allows collaboration between multiple software developers. That's one part of it, Another part. If you are looking for a code, you can. By the way there is something. Okay, for the sake of this setup here, it's a class, it's WTFJS.

**[1:08:52] Speaker A:** Look it up. It's a repository in JS. It shows you the funny mistakes of JS. It's on GitHub.

**[1:09:02] Speaker A:** So you can publish, you can post your code. Like if you have a code base and you have a project that you want, people see it and collaborate with you. You can do that as well. What else? What do you know about.

**[1:09:16] Speaker A:** Basically they all do the same thing. The most commonly known is GitHub. And here we are using GitLab. I know for different reason, I don't know why. And we extended that in other courses as well. We are using GitLab.

**[1:09:34] Speaker A:** So we going to see it like. We're going to see like how to use GitLab in as a single user, just how to version control your code. Single user, having multiple machines or different users. Okay, so we have keys. So the way we're going to do it, I think I will just jump to the hands on practice and that's what we'll be doing.

**[1:10:07] Speaker A:** So yeah, so we'll create a repo, then clone it working locally, push it and see how to collaborate. Fortunately, I'm not gonna be able to keep holding that. So I hope you can hear me here.

**[1:10:29] Speaker A:** Okay, so first thing, sorry, Go to the browser, create a project.

**[1:10:54] Speaker A:** So I'm in GitLab here. I'm creating a project. I'm going to call it 1.3.

**[1:11:04] Speaker A:** Git demo.

**[1:11:15] Speaker A:** Okay, read me file here. Create project.

**[1:11:23] Speaker A:** Okay, so we got our project here, here.

**[1:11:34] Speaker A:** All right, so as you can see, we just created it. It has one file, it's readme. Okay, now let's go local.

**[1:11:53] Speaker A:** You don't need that anymore. Create a folder.

**[1:12:03] Speaker A:** Let's give it a name.

**[1:12:14] Speaker A:** Okay.

**[1:12:21] Speaker A:** All right, so what we will do now, see that project that I just created here, I'll try to clone it and have a local version of it. Okay, the way to do it is clone with ssh. So just I took the ssh so I can access the cloud, go to the terminal. So here what I did is I'm in that, I'm in that folder, I open the terminal so as you can see, select your PC on the terminal. So I'm going to do is get clone.

**[1:13:06] Speaker A:** And this is like 1.3 git demo.

**[1:13:15] Speaker A:** Okay, so what happened is. So if you look.

**[1:13:21] Speaker A:** Oh no, I should have showed you like magicians. There's nothing in that folder. Then there is this. So what I did, it was empty. Then when I cloned it, got that. So it pulled that and it has just read me file as you can see here. Okay, so what happened is if we go to the slides, So we got it from the cloud to our local repo here.

**[1:13:52] Speaker A:** Okay, so what we will do is look in the terminal.

**[1:14:04] Speaker A:** Sorry, code, what's the name of the file here?

**[1:14:15] Speaker A:** I think let's see if it works. Oh yeah, because I'm not sure if it's going to call VS code or IntelliJ or any other one. Okay, so what I did is just like for this one, it's you link this code like in a shell with your ide. So I'm linking it with VS code. It was linked with Intellij but now I'm using VS code for the sake of this course.

**[1:14:41] Speaker A:** Okay, so we got that. And this is the readme file. So what we will do, just gonna edit that. So this all auto generated and that's a lot. Command A delete.

**[1:15:00] Speaker A:** Okay, let's say read. What should we say here?

**[1:15:09] Speaker A:** Look, it's being modified by Vector PC.

**[1:15:22] Speaker A:** Run this. Okay, so what I did here, I just changed the file locally and nothing happened here. So what should I do to make sure that this change is in the local repo and in the cloud?

**[1:15:41] Speaker A:** So I need to commit it and push it, right? So let's try that.

**[1:15:49] Speaker A:** Maybe use VS code.

**[1:15:58] Speaker A:** So you said git git. So what should we do? So there is a process in order to push from locally. Okay, so I'm going to repeat just quickly. We cloned like the English term cloned. So we copied from the cloud to locally. We have it now, we modified it. Okay, now we want to push it back to the cloud. These modifications should be pushed back to the cloud. The way to do it, so you write the code, you add it, you add all of the modified files.

**[1:16:32] Speaker A:** So in order to do that, so we can do add either just the file readme readme MD or the whole thing. So we have just one file here. So the difference is. Sorry, should have a space here. So if when I do that, so it means that I'm adding the whole thing.

**[1:16:59] Speaker A:** Oh, so what's missing?

**[1:17:05] Speaker A:** Okay, so what's this mistake here? Can you read it?

**[1:17:10] Speaker A:** Okay, so this one, it means that this file that we cloned here is not.

**[1:17:19] Speaker A:** Is not a git repo. Right. So what we should do is we need to initialize it first. Right? Okay, so it's empty.

**[1:17:28] Speaker A:** Then add.

**[1:17:32] Speaker A:** Okay, so what happened here?

**[1:17:37] Speaker A:** Oh, Sorry.

**[1:17:44] Speaker C:** Oh, I think it's because 1.3 git demo was itself repository and you created another one in.

**[1:17:50] Speaker A:** Yeah, yeah,

**[1:17:51] Speaker C:** yeah. CD Git 1.3.

**[1:17:54] Speaker A:** Okay, I think what we should do. Yeah, I know what the mistake is because what we did is stupid mistake. So we need to go inside that first. Okay, I think maybe cd.

**[1:18:19] Speaker A:** 1.3 let's copy the name just to make sure.

**[1:18:42] Speaker A:** Yeah, now it makes sense.

**[1:18:48] Speaker A:** Yeah, it's added now. So the steps is we added it, so we pulled it, we cloned it, we have it, we modified it. Now we want to push it to the cloud. So the steps are you add, then you commit. Right.

**[1:19:06] Speaker A:** What should we call it here?

**[1:19:12] Speaker A:** I push from or modified read me MD Lecture PC.

**[1:19:34] Speaker A:** So what am I doing here?

**[1:19:38] Speaker A:** See, modified readme Lecture PC. You will be marked, by the way. So we'll be working on your project. You need to give, like they should be significant, all of the messages when you will be using GitLab. Okay?

**[1:19:53] Speaker A:** Oh, sorry. Git commit.

**[1:20:07] Speaker A:** Okay, so it's commit now git status, Now git push.

**[1:20:27] Speaker A:** Okay, so see, let's see what happened now.

**[1:20:38] Speaker A:** So what just happened? Just. I'm going to walk you through it. So I cloned, I created the project in the cloud, cloned it locally, brought it here to this git demo, then I modified it locally. So it has been modified here. Then I wanted to push it back to the cloud. So the way to do it, you add, then you commit. So when you commit, you have to give a clear message to remind you or your peers later on what is it that you have done. Then you push. As simple as that.

**[1:21:16] Speaker A:** You add. And adding it means that you are preparing it to be pushed. Okay, so you add. It's like you put it in a box. Then you commit.

**[1:21:24] Speaker A:** So committing means that, okay, these are changes. So this is a milestone. Then you push it. That you push it and the milestone has a label that I just wrote there to modify that on the lecture PC.

**[1:21:36] Speaker A:** Okay, so far so good. Like it's basic. You'll be doing that like every, I don't know, maybe 10 times a week, working on your projects. So what we will do now, so we created that project, we copied it in a lecture PC. Let's have.

**[1:22:03] Speaker A:** Sorry, hate Mac, by the way.

**[1:22:13] Speaker A:** Let's create Laptop.

**[1:22:21] Speaker A:** Laptop.

**[1:22:26] Speaker A:** Now we can do the same thing. So we got the local version, we pushed it. Then if we copy, if we do the same thing again, what's going to happen?

**[1:23:06] Speaker A:** Just another run. But I'm trying to simulate that. We have. I have two different machines here. Two different machines or two different users.

**[1:23:29] Speaker A:** Okay, so if I go to laptop now, it's there, right?

**[1:23:38] Speaker A:** So what we'll do, where's the terminal? Okay, so I'm in this terminal.

**[1:23:51] Speaker A:** Okay, So what happened? I just extracted the latest version. Right? Are you following? So created in the cloud.

**[1:24:07] Speaker A:** It's in the lecture now. I pulled it, it's on my laptop. So what I'm going to do now I will add a new file. Let's call it.

**[1:24:20] Speaker A:** Test.js okay, function, whatever, any function here.

**[1:24:35] Speaker A:** Test.

**[1:24:37] Speaker A:** Always say add.

**[1:24:45] Speaker A:** Okay, interesting. Command this. Okay, so now I created this file.

**[1:24:57] Speaker A:** So what's the difference now? Just a checkpoint now. So we have two different versions, two different local Versions Lecture PC and laptop. Right. So this is the Lecture PC and this is my laptop, the Lecture PC. I have just the readme file on the laptop. I added this function, this file. Test GS. So I have two different repositories. Right?

**[1:25:23] Speaker A:** So what should I do so I can get this version, the test, like the readme and the test here on the Lecture PC.

**[1:25:35] Speaker A:** What should I do?

**[1:25:39] Speaker A:** So that's the first thing. So I need to push it to the cloud, then take it back here. So from here to the cloud, take it back. Let's do it. Yeah.

**[1:25:49] Speaker A:** Thank you. Yeah. Okay, so I think let's not repeat the same mistake. I'm already in the laptop, but I need to go to. What's it called?

**[1:26:10] Speaker A:** Okay, This one.

**[1:26:23] Speaker A:** Yeah.

**[1:26:26] Speaker A:** So first thing, it add the whole thing. It has been added. Then commit message.

**[1:26:48] Speaker A:** From laptop. Added function added tests, Tests js. Right.

**[1:27:08] Speaker A:** Okay, so it's committed now. Git push.

**[1:27:22] Speaker A:** Let's go back to the cloud update.

**[1:27:29] Speaker A:** See, so we pushed now. So that's the update you following. So created here. Actually, we cloned, modified, pushed, then created here. Modified, pushed.

**[1:27:45] Speaker A:** So I need to copy it back here just to make sure that I have it on Lecture PC. That's the Lecture PC. So what should I do now in order to get it? So we used push to put to the cloud. So if I pull.

**[1:28:20] Speaker A:** See? So we got it here. I pulled it now in the Lecture PC. All right. Clear.

**[1:28:27] Speaker A:** Easy. So this is going to be your abc, your ABC in your project when you'll be working as a team.

**[1:28:34] Speaker A:** So my advice here, I think we'll take a breather of two minutes, then we'll go to the teamwork.

**[1:28:43] Speaker A:** So let's go back to the slides. So that's what we did here. That's exactly what we did. We took it from the cloud, put it here, modified it, push it back, pull it here, modified it, push it back, pull it. So that's how you work as a team. Okay, so what I did now, I tried to simulate between having multi, like you have a single user. Like if you look at this slide here, either a single user, multiple machines, or it can simulate as well, like different users. Okay, that's what we're doing. Like working copy here and working copy here. And okay, quickly now.

**[1:29:32] Speaker A:** So you have this slide. So it has most of. The.

**[1:29:38] Speaker A:** Most of the commands, the git commands here. Then I think let's take a breather of two minutes, then we'll do the teamwork. So please give us feedback just like two or three minutes and we'll resume. Are you like, can you hear me? Like when I put the mic.

**[1:29:57] Speaker A:** Okay, cool. And hold it here.

**[1:31:10] Speaker A:** You push something.

**[1:31:44] Speaker A:** All right, so let's see the team usage. So as the name indicates, like it's different, people are working on it. Example. So if you look at that, so this, you have a master branch, then you are working on it. So you need to have your own working version.

**[1:32:05] Speaker A:** Then you push where is the mouse? Yeah, so you push back here to the master branch and somebody else is working on. So here the big picture, as I said, you are working on the same thing. Sometimes you're working on different components, sometimes you're working on the same component. So to avoid conflicts, we have this, all of this fuss off Git and GitLab. Yeah. So we have I think three concepts that you need to understand. So you need to branch out. So you are in the master. So you need to branch out and work on your own local version.

**[1:32:47] Speaker A:** Then once done, you're going to merge. So yeah, you want to merge. So in order to merge, sometimes we have direct merge. So you merge it directly and sometimes you have to request to merge. In your opinion, why do we have merge request?

**[1:33:05] Speaker A:** That's the most important concept in this lecture. In this part of the lecture, merge requests.

**[1:33:12] Speaker C:** Merge requests exist so that the person who owns the repository, typically in a corporate setup, you have like a PM so that person can review the changes that you making without allowing you to make it so that it does not properly change the repository. And therefore

**[1:33:26] Speaker A:** pretty much that's it. Yeah, so merge request. So in order. Actually, yeah, I don't know. Okay, let me try to put it in simple terms. Merge request. So it's a request that's not automatically approved unless somebody else human being approves it. Okay, actually now we can think of a scenario of agents. One agent writes the code pushes and the other agent, approved, like reviews it and approved. And agents, they do the whole thing. So what do you do as a software engineer?

**[1:34:07] Speaker A:** You orchestrate. Yeah, so this is another discussion, but in like for the basic concepts here, the merge request, it's always the safest option. So you have to review the code. It could be like if you are a team of say five, four or five, maybe you have code, a reviewer and you, you are coding this part and reviewing another part and the other one like the other member is coding that part that you'll be reviewing and they will be reviewing your part.

**[1:34:41] Speaker A:** Does it make sense?

**[1:34:42] Speaker A:** So you are coder, like it's. What's it called? There's a term for that pair peer programming. Pair programming, you know that. So that's what you do. So you'd be doing that. So GitLab allows you to do that. Okay, yeah. So we are using, by the way, there's a nice guide in Atlassian here, that link, so you can follow that.

**[1:35:09] Speaker A:** So look at this tree here. So you have trying to simulate a real world scenario. So you have the master branch, quick fixes or hotfixes. Because sometimes if you are in prod, you know this term in prod is in production. Like the app is Instagram. You're using Instagram and it gets patched, right? Or Uber or Didi. So what happens? So we have the master branch, we have quick fixes, hot fixes. Then we are trying to have a new release.

**[1:35:41] Speaker A:** Remember the SDLC that we love the maintainability. So we have a new releases. So you'll be working on new release in parallel. So you copy the master and you keep working on it. It's like master prime. So we have master and master prime. Okay, so this is like somehow a real similar to real world scenarios. Then you have adding features, developing other features, like still in the kitchen features, if I can use this term. So this is somehow a way to visualize how to work with GitLab. So now we're going to have a quick simulation on how to do like to branch out, work on a local version and merge it, which is this one.

**[1:36:26] Speaker A:** But before that. So just want to point your attention to this.

**[1:36:33] Speaker A:** So when we talked about branching out, it makes sense merging merge request. It makes sense that it needs to be approved by somebody else. But where do we need merge without merge request? Can you think. You answered all of the questions today.

**[1:36:51] Speaker A:** Very good job, by the way. Okay, I will give you the answer, but I need somebody else to jump in. Where do we need merge without requesting and requiring an approval? You have a hint there.

**[1:37:11] Speaker C:** Security fix that you need to really quickly.

**[1:37:15] Speaker A:** Like hotfix. You mean it's like hotfix, you want to patch it up and add it to your. That's a use case from the answer that I'm looking for, the general case. Yeah, yeah.

**[1:37:31] Speaker A:** As simple as that. That's what you were saying. Yeah. So local copy. So in your local copy, you want to copy the whole thing, Merge the whole master branch to your local copy.

**[1:37:41] Speaker A:** Thank you. Very good. So the hint is here in this slide. So we try to copy that local.

**[1:37:50] Speaker A:** Okay, so now we will run a scenario of that.

**[1:37:56] Speaker A:** So we check out this one. So the way we do It, I think laptop. Lactor. Laptop. Which one should we choose?

**[1:38:17] Speaker A:** Laptop. Okay, so what we will do now, try to branch out.

**[1:38:26] Speaker A:** So get the keyword is checkout. Then what should we give it a name.

**[1:38:36] Speaker A:** Remember you'll be marked on the names that you give.

**[1:38:39] Speaker A:** I'm insisting on that to make the job of the markers easier. So what should we.

**[1:38:51] Speaker A:** Take out?

**[1:38:55] Speaker A:** Yeah, item B. What should we give it a name? Just thinking of add in.

**[1:39:06] Speaker A:** Functions.

**[1:39:10] Speaker A:** Yes. Can you say that?

**[1:39:20] Speaker A:** I think adding just. I'm trying to think of something easy to do.

**[1:39:27] Speaker A:** Add in function.

**[1:39:31] Speaker A:** Yeah, add in functions. That's what we'll do, isn't it?

**[1:39:38] Speaker A:** No, just add in functions. This is like a label name of the branch.

**[1:39:45] Speaker A:** So see what happened here?

**[1:39:49] Speaker A:** Can you see that? So now I'm not in the original origin branch anymore. I'm in a branch which is here. So it's visualized here.

**[1:40:02] Speaker A:** What we will do, maybe add a new file.

**[1:40:07] Speaker A:** Functions.

**[1:40:09] Speaker A:** JS.

**[1:40:18] Speaker A:** Function.

**[1:40:21] Speaker A:** Okay, subtract.

**[1:40:26] Speaker A:** Yeah, like this. So we created the file. Now, okay, functions, let's go for this.

**[1:40:44] Speaker A:** Okay, so now we created the branch, so what should we do? Once the branch is created, what should we do?

**[1:40:57] Speaker A:** How can I go back to the original branch? What's the keyword?

**[1:41:04] Speaker A:** If I just go for this git branch o2. So git branch, it shows that I'm in the add in functions. I have two branches, so the main one and add in functions. And I'm in add in functions. So if I want to switch, So how can I switch?

**[1:41:32] Speaker A:** Think. No, I think we can just go to git main.

**[1:41:39] Speaker A:** If I do that, what's going to happen? Oh yeah, my bad. Hyphen.

**[1:41:49] Speaker A:** Is that the keyword?

**[1:41:56] Speaker A:** So can you see here where I'm switching? Like it's showing where I am.

**[1:42:02] Speaker A:** Okay, so what I'm going to do now if I want to. So I branched out and I created these functions now. So what I want to do is merge.

**[1:42:19] Speaker A:** So how can I merge?

**[1:42:25] Speaker A:** Actually, I want to request a merge, not a merge because I'm in a branch, in a local branch. Working on it. But I want to merge to the original. So the good practice is to request a merge. How can I do that?

**[1:42:43] Speaker A:** So let's update here, see what's happening. But I need to push, right? I didn't push. I did not push the branch. Right.

**[1:42:53] Speaker C:** Also, sir, first you need to move functions for K to the. To the correct folder. Otherwise it won't allow the.

**[1:42:59] Speaker A:** Yeah, yeah. So I was working on the laptop, right?

**[1:43:02] Speaker A:** I was working on the laptop here.

**[1:43:09] Speaker A:** I Think I thought I'm in the laptop. Am I not in the laptop?

**[1:43:12] Speaker C:** Yeah, it went outside.

**[1:43:14] Speaker A:** Oh, I need to move it here. Let's see if I can do it.

**[1:43:26] Speaker A:** Easy, easy. Wig. Right. Okay, so I need to have the. To push it. So what should I do to push it? Add the whole thing and git. Commit.

**[1:43:55] Speaker A:** Added functions Js then git push.

**[1:44:10] Speaker A:** Did I push in the main branch or the. I think I pushed in the main branch.

**[1:44:17] Speaker A:** Let's see.

**[1:44:22] Speaker A:** I did push. Right, Sorry.

**[1:44:33] Speaker A:** I think it. Oh, I. I did, I did. I think. I think I did. Yeah, yeah, yeah. I think I was in the main branch. Okay. Another practice. We'll do it now. Yeah, yeah, my bad.

**[1:44:55] Speaker A:** Yeah, so I was on the main branch. So I'm gonna. We're gonna go back to function.

**[1:45:10] Speaker A:** Check out.

**[1:45:20] Speaker A:** Okay, I'm gonna check out functions. Right.

**[1:45:31] Speaker A:** What's the name of the branch? What did you call the branch?

**[1:45:58] Speaker A:** Okay, my bad.

**[1:46:15] Speaker A:** Yeah, adding for.

**[1:46:28] Speaker A:** So there is a mistake here.

**[1:46:36] Speaker A:** Are you following with me? Guys, can you help me spot the mistake?

**[1:46:44] Speaker A:** I think what I missed. I think check out.

**[1:46:54] Speaker A:** Okay, so now. Yeah, so we are now adding function. Let's create.

**[1:47:09] Speaker A:** Functions 2js. Okay, functions 2. Just copy that. Let's see. Choose 2.

**[1:47:33] Speaker A:** Just remove this one.

**[1:47:37] Speaker A:** Okay.

**[1:47:40] Speaker A:** Okay.

**[1:47:45] Speaker A:** Git and.

**[1:47:52] Speaker A:** Get status.

**[1:48:10] Speaker A:** Two.js.

**[1:48:18] Speaker A:** Push.

**[1:48:23] Speaker A:** Okay, so look at the error that I got here. Okay, quickly I'm going to run you through the mistake that I made. So I was thinking that I was pushing in the branch, but I switch it to the original and I was pushing. So it means that I did nothing. So I redid the whole thing. I created a branch, added a function, and on the branch I'm trying to push the whole thing from the branch. Now what we saw is pushing from the master branch without branching out. We saw that example. Now I'm pushing from the branch. So what's going to be in the cloud is the master branch and my branch. Right, how to do that? So I tried to push. I got this error. It was telling me that when you are trying to push that branch, you did not give what's the original branch for this branch.

**[1:49:21] Speaker A:** That's all.

**[1:49:22] Speaker A:** Where is the root and the branch. It was not clear to GitLab how to do that. So this is how to do it. Push, set upstream, origin, added function. So that's how we should do it.

**[1:49:36] Speaker A:** That's the error I got by doing this.

**[1:49:49] Speaker A:** So now it's added if I go to.

**[1:49:58] Speaker A:** Okay, so what do we got here? So we got the main branch that's the main branch and the branch that I just created that has functions too. So it has two functions. Okay, now merge request. So in order to merge, so I want to merge functions too from my branch to the master to the origin. So how to do that? So create a merge request. Okay, so just I can give it this name. Okay, Added functions two.

**[1:50:40] Speaker A:** And I know I just give it a title added functions 2. It has to be significant, remember? But it has. It's a good practice to learn and you will be marked anyway. Okay, then added a function branch with more functionalities.

**[1:51:07] Speaker A:** Anyways, let's say something like that. Okay, so I need to assign it to somebody. So I can assign it to somebody here. Okay, well, for the sake of example, I'm going to assign it to myself. Okay.

**[1:51:25] Speaker A:** And create merge request. Okay, now when I create the merge request, what I receive as a reviewer, I receive that. So.

**[1:51:39] Speaker A:** Okay, should I allow it to be merged? So I can either say.

**[1:51:51] Speaker A:** Mike needs more work. It's like comment from a tutor needs more work. That's a comment for example, right? That's a comment. Or I can approve it. So I can write a comment, you can receive it or I can approve it. Okay, then once it's approved so it's ready to be merged, either I merge it as a reviewer or maybe a leader needs to merge that. So if I merge.

**[1:52:26] Speaker A:** So what happened? Let's go back to git demo. I think if I go to main.

**[1:52:42] Speaker A:** More features just I want to show you one last thing and we'll end the tutorial.

**[1:52:49] Speaker A:** Okay. So can you see that?

**[1:52:53] Speaker A:** So I committed. I modified readme from the laptop, added the function, added the function in the main, then added the function. I branched out adding a function, then I merged it. And this is the repository graph. I think it's very useful to.

**[1:53:10] Speaker A:** Thank you. Thanks everyone and see you next week. So this was more hands on. All the best with your iteration zero. So for next week, heads up. So we'll have one hour talking about teamwork and iteration zero, which is the first step in your project. See you next week.
