Complete Intro to Computer Science Code Setup
Transcript from the "Code Setup" Lesson
>> This course we're gonna be doing inside of code sandbox. So, I put a box in here you can click and say edit on code sandbox. Let's just get you oriented a little bit. It might say that to you, it's fine to say some of the main branch.
[00:00:24] As you may notice this looks a lot like Visual Studio code. It's cuz it is very similar to Visual Studio code cuz it's embedding VS code in the browser. What you'll see here is you'll see, we have this project that is a GitHub repo. You can see here it's bt holds slash out of the algorithms exercises.
[00:00:44] So, if you find any mistakes, feel free to open a PR there. And we have these source documents. This is gonna be helpful for us when we're doing sorts and trees, they're kind of like little visuals. Visualizer helpers but for the most part, you can ignore the source directory.
[00:01:00] The stuff that you're most curious about here are gonna be here in the specs. These are gonna be unit tests that you and I are going to make passed together. So, if we look at the first one here, which is going to be bubble sort right there, you can see a bubble sort dot test dot j s.
[00:01:18] If I click on that one, I have a little exercise here. It's got a little unit test here that we're gonna make pass and then the code goes here inside of bubblesort. So, that's what you and I are gonna be doing all day today is just writing code that hopefully makes these unit tests pass.
[00:01:41] Now there's also here, the bubblesort solution. So, if I clicked on this, it would show me the actual solution to whatever I was looking for. This isn't a test, no one's grading you on this, if it's helpful for you, feel free to go ahead and peek over in the solution anytime that you need to like I'm not up here judging you for looking at the solution.
[00:02:03] Our number one shared goal together as you are just to learn what about these algorithms right? Please Google everything, please look at the solutions, please ask your friends. Ask your rubber ducky or dog or something like that. I don't care, whatever it takes for you to learn. That is the thing that you should be doing and if you're not doing the thing that's gonna help you learn, then you're doing the wrong thing.
[00:02:27] And again, the wrong thing to do is just to sit there and stress. If you're doing that, let's reevaluate or re approach the problem do something different. Now, the one thing I'm gonna say, is there's a lot of value in struggle. And when I say that I mean sitting there and just trying to reason through it, just using all of your brainpower to kind of power through reasoning through that.
[00:02:48] And it's hard and it's exhausting and this may not be what you want to do. But that moment of struggle is really where I think you can learn a lot. So, I'm just going to invite you to embrace the struggle a little bit. But don't embrace it so much that you get stressed out or too stressed out.
[00:03:05] It's a little stressful and we kind of have to deal with that. But you know yourself better than anyone else just listen to yourself and follow your dreams. This is really what I wanna say. Anyway, let's, go ahead and get started. It is possible to run this locally as well.
[00:03:27] So, this is actually all just running with jest. Yeah, sorry one more thing. Let's go back here. Back here in code sandbox before I forget. She just leaves us open all right, so here in code sandbox, you can see I have this browser. And then I have tests here.
[00:03:55] So if I click on tests, again here on the right side, this is actually running just for me and I can see all of my specs that are running. When I say a spec, I just mean a test file. I don't know why I'm stuck in that term spec.
[00:04:09] But like, I used to write ruby tests, which is our spec, and that term just stuck in my brain and I'm sorry, it's just not coming out I tried. Tried to shake the Ruby out of me and it just didn't come out. So, that's what that's why they're called specs.
[00:04:25] I think it's a Ruby term, or maybe it came from before that's why I know it, anyway, tests. So, this will show you all the tests here. This is where you can actually see where the tests are passing and where they're failing and why they're failing and things like that.
[00:04:40] You can see here there's 53 tests currently passing and there's 97 tests total that we're gonna try and make pass. Don't worry, you don't have to write 97 things some things have multiple tests on them. And then the last thing here is down here in console. This is actually like the console.
[00:04:58] So, if you want to do a console log here, it will show up here in the dev tools. Yeah, so it'll show up here in the dev tools as well. You can see here, this is actually logging out from the code here, but this gets pretty noisy because code sandbox puts a lot of stuff in here.
[00:05:19] So, I would say just use this one down here where it says console down here. If you're looking at this and say like, where all these numbers coming from, there's actually a, maze path finding lesson that we're gonna do. And it actually has like a little helper logger tool and that's where that's coming from.
[00:05:41] And we'll comment that out in just a second. So, that we can ignore it a little bit. Okay.that's good to know. You can actually clone this repo and run all the code locally and you can run it the Jest, that's all what these tests are run by is Jest digest.
[00:05:55] So, feel free to go say git clone, this repo and you can do NPM run test and it'll run everything. Last thing here on all of the tests. So, you can see here it says test dot skip. That means it's not gonna try and run this unit test.
[00:06:14] I do this so that just like it's not, you can see as soon as I do this, it's gonna say hey bubblesort is failing. Let's get rid of that for a second. That's because this test now it's trying to run a test on bubblesort it's not working. So, I would just say take this test by test and do it that way.
[00:06:39] One more thing here. I would go ahead and just fork this repo to your own repo. That's gonna help you as well because then you can save your work. And if you don't have a code sandbox account, probably makes sense to sign up for that as well.