×

edutechional's video: There is No Foo Bar and Why You Shouldn t Use It

@There is No Foo Bar and Why You Shouldn't Use It
If you're a new or aspiring developer you may have come across that terms foo and bar whether you're reading a post on stack overflow or listening to some type of webinars or anything like that. And if you've never seen those terms before they might be kind of confusing you might think that those terms are reserved words in a specific language or they they actually represent something. But what I want to do in this guide is tell you that there is no such thing as foo and bar. I want to dispel the myth that you need to use those or even to know really what they represent and instead I'm going to show you that there are just placeholders and so hopefully they'll help prevent any confusion as you go along in as you see them on different posts that you're not going to think of what those words represent but instead you're going to see that simply use there as placeholders and the way that I'm going to do is I'm going to take some examples that I found on stack overflow and then I'm going to simply change them up. And if you're a more advanced developer so if you're going through this and you know that foo and bar don't really mean anything then I still think that this is a good exercise for you to go through because what I'm going to walk through is not just showing that foo and bar don't i'm also going to show how I don't use them at all when I'm teaching the students I've taught over 35000 students over the past five or six years and I never use the terms foo and bar and I don't think that advanced developers or teachers should use them because I've seen through the years they cause a lot of confusion. And so instead I'm going to show you what my approach is for creating placeholder functions. "So with all that being said let's jump into some code examples". For a code example I found a post here on Stack Overflow where someone asked how do methods use hash arguments in Ruby.large Now I'm just using this as an example you could use this with JavaScript, python, pretty much everyone seems to use this foobar kind of syntax for examples and if you scroll down right here to the accepted answer you can see that the answer includes the word foo. And if you look at some other answers then some of them will also use the word bar. And that's where the confusion comes in. For many students and I think for good reason because you see these kind of words so often if no one's told you that they don't actually mean anything that can be pretty confusing. So what I'd like to do is to just dispel the myth right here that this does anything and so the way you do that is I'm just going to copy all of this code right here large and let's open it up ourselves and start building it out. So I now have this code and if I save this and if I run this code then you'll see here at the bottom that it gives the output that it gave in the answer where it just prints out some text where it says regular regular argument gives a hash and then gives us a and b set of examples. large Now notice that the method that was created and you don't have to know Ruby to know what's going on right here this is just a method and the developer called this foo and then down here they are calling this foo method large so let's just show that foo as an actually mean anything. So what I do whenever I'm teaching or where ever I'm showing a student or another dev. An example I never use these kinds of terms but instead I try to pick out something real life that actually has a meaning. So I'll do something like say let's call an invoice method here. So down below we're not going to have foo. We're just going to say invoice.large This could be anything but an invoice is much easier to understand. You could call this anything you want. A lot of times all use a greeting method or anything that makes a little bit more real life sense. And then you also have these other words here you may think that regular is a reserved word but it's not let's just use something that everyone's going to know is not a reserve word. So here I'd say something like. Company name and then down below in the example I would say company name and change it up here as well. Company name and then coming down. I can say this is Google.large So so far so good. And now if you want to test us out we can run it again. So just run this code and you can see everything still works except now we have some output that is a little bit less abstract largewe have something where a student when they're looking at this is probably going to realize that the words like invoice. and company name are just things that we're making up they're not some kind of special coding construct. Follow me: Twitter: https://twitter.com/jordanhudgens Instagram: https://www.instagram.com/jordanhudgens/ GitHub: http://github.com/jordanhudgens Show notes: https://www.crondose.com/2018/04/foo-bar-definition-why-you-should-not-use-it/

120

29
edutechional
Subscribers
42.4K
Total Post
685
Total Views
1.2M
Avg. Views
19K
View Profile
This video was published on 2018-04-18 22:15:21 GMT by @edutechional on Youtube. edutechional has total 42.4K subscribers on Youtube and has a total of 685 video.This video has received 120 Likes which are lower than the average likes that edutechional gets . @edutechional receives an average views of 19K per video on Youtube.This video has received 29 comments which are lower than the average comments that edutechional gets . Overall the views for this video was lower than the average for the profile.

Other post by @edutechional