Learn Programming with VB.NET - 10 - How did I learn programming

Hussein Nasser · Beginner ·🧠 Large Language Models ·10y ago
Full PlayList: https://www.youtube.com/playlist?list=PLQnljOFTspQX-XZChZg-b06MJ27nAJQS9 Really enjoyed recording this series you guys, but unfortunately it didn’t get enough attention I thought it will, and a lot of folks are asking me to resume my other series (ArcGIS C#) so time to put an end to this series and continue other one. I personally believe if someone followed and watched this series he will be able to start writing programs by himself.. I will always be here to help for sure! shoot me an email any time at hus.mhd@gmail.com That being said, and as I said in the video, if I get enough requests to resume this series I for sure will. Big plans to start the SOA series service oriented architecture.. For this episode we introduce loops and arrays and more polymorphism Final code in github https://github.com/hnasr/pizzabit C# Version of our Pizza bit! Thanks for Conor MacF1 for translating our project to C# ! Cheers https://bitbucket.org/cjbmacf/pizzabit Stay awesome! Hussein www.husseinnasser.com

What You'll Learn

The video series teaches programming with VB.NET, focusing on object-oriented programming concepts, such as inheritance, interfaces, and polymorphism, using tools like Visual Basic, Windows 95, and VB.NET, to create a pizza ordering system and manage ingredients and inventory.

Full Transcript

what's up yo this is a sin a sore from I geometry bringing you the 10th episode of object-oriented programming yeah so so as a summary for you guys this series has been really really fun for me to record and practice so the initial intention of the series was to be some sort of an by example approach to programming so for those people who find programming really difficult or challenging the reasons that we want to learn programming is that basically you go online to google and search hey I want to learn programming and you said one language you want program well the right and that's the confusion we we learn languages not concept of programming language and that's really the confusion why it's really difficult for people to grasp programming in general and are we recording yes we are so that was the reason why it's really challenging for some people to learn programming in general so and the reason personally I think it's because the current tutorials or websites are teaching you about certain you know certain about certain aspects of a programming language like how to do loops or how to declare variables on how to declare a race but they the thing is that you don't know when to use these concepts right these these tools you don't know how to use them you don't know when to use them so that's where I get confusing me okay why I'm doing this why I'm learning there is no purpose for learning how to do a loop if I don't know where to apply it that why that's why it's really confusing to learn program this way this method of you know teaching by tools is works for people who know programming like people who already know how to code and they want to learn another programming language say like Python so you go and see okay i want to write a program I know what I'm all right but I don't know how I don't know the syntax which is the language you know whatever whatever so that the language constructive you know language basically it literally yeah so how do you construct words how do you talk to this to the computer through this language right this is the syntax they call it and people achieve Lee works if you already know how to program but the problem is that if you don't know anything about the program or you're new to this to this realm of programming and you want to just like do something but that's the problem right so personally to me I think the way to learn programming I mean this is I how I learned it when I was 16 years old so I wasn't even know there was something so i got my computer when i was i think yeah 15 years old so that wasn't windows 95 yeah so and i I've been to my uncle place and he was he was doing some something with with a computer you know sir so he was writing some some commands and I was really interesting so I that's what are you doing so he told me I'm programming the computer so I told him what is programming what do you mean programming so I thought I also the computer comes like as a box and it does certain things so I didn't know that you can actually change its behavior so he said no actually you can make the computer do whatever you want you know and that really blow my mind away because imagine this machine and you can tell what do you want and it can do it for you so this idea really struck in me you know so i also i told him back I want to learn programming can you teach me is that ok I've got to give you a book and this book was cold vidual learn visual basic to using on Windows 3.1 with John socha which is the or soak I don't know how to pronounce them so that is what he was the author so this guy I mean although the book is really simple but this is how i learned programming seriously i was teenager ok so i'm gonna tell you how r by don't bore you of this but it's important to talk about this because this is like an introduction of programming why I did this right so so the reason is I just grabbed this book and I started following it you know so and so my uncle toby hey you would like a compiler to write your code own or an interactive development environment and ide to write your code on so i told mocha what I need he said take this it's called this is called visual basic ok it's this visual basic 5 at that time six wasn't even born but maybe it was there but I don't know I got this as the software i had and it was licensed so i installed it on machine and i had windows 95 and visual basic fly all right and the book was actually visual basic to who have windows 3.1 so it's an older it's an old book so i said i didn't pay attention to this so I just follow the instruction and imagine I was able to although the language almost different and I know I never knew anything right the windows interface is different obviously but I learn programming using this book so this book oh that's not even famous you know I assertion amazon it's not even there it's there but it's like it doesn't even have rating but this is how told you like this to tell you that marketing really can't change our mind you know I mean all about this advertisement like it shows you you know it makes make certain books really go up while they are really have no value but real books real value comes from you know honest box like this one so so I'm gradually what's what's so special about this book sir what is so special about this book is it doesn't teach you visual basic it teach you how to code that's it so first thing I open the book what is the first thing I wants to the authors stealing it I said hey all right so you're reading this book so you're interested in learning programming okay so we are going to build a clock how about that so we get them built a clock and we're gonna display it on the computer and I was wow we can do that isn't that I was first I was inspected skeptical of it there's a clock or ideal everybody's was ugly Macklin so he said we get a displayed and they were going to draw it by ourself and we gonna do a lot of fancy stuff so as a teenager I was so excited I mean okay we got to do that let's do that and of course drawing stuff as you can see I mean you're going to draw a clock right so there's a lot of math involved I mean there's an angle and you get a draw thanks for all point to another point and I just followed his examples and I was typing like a reading the book and applying totally different languages but I'm in the same language exactly but it's just the syntax was a bit odd but I was able to do it because he was not telling me if he started the book he said okay variables or loops or or functions I would be so [ __ ] lost you know because well those that why I'm doing this it's boring I'm not going to do that I'm gonna learn that it's really radical so that's the problem of the modern ways of learning a language so back to our so that was my story so and then after that we wrote a clogged and then I remember we were on a calculator and we did a lot of examples so he's teaching us by example that as we reach as we need a tool he's teaching guess that tool so I'm gonna I since then I just was amazing Lee I was amazingly baffled by this approach and I'm applying it all my teachings you know so and this is why I started this series object-oriented program so I'm going to teach you or talk about object-oriented programming using examples that's it an example we said back then Ram pisode one was to actually write a system or a program that it's a pizza ordering system so we don't have any single line of code and we started building that from webisode 1 2 episode 9 we had done tremendous amount of work just to do that software and we're getting there so imagine we did all that and that's that's why I want to know you guys if that approached was helpful or not I mean it worked for me so I want you buy this episode by the end of this episode tell me if this work for you I am going to continue this series if I don't get any responses i'm gonna start i'm gonna stop anyway at this episode number ten and if i don't get any response if i get enough responses to resume this episode I'm going to go ahead and resume it so that so so far we did we introduce how to create our own pizza and we change all these you know we introduce this class's polymorphism design patterns all these things you know and we were able to calculate the price of a pizza so I was planning you know caught uncle planning to do that next is actually to save the speeds as as an order in a database so and we're going to retrieve those we're going to do all fun stuff but if I get enough there's the deal if I get enough interaction from you guys on this series I'm going to resume it else there are other series that people are requesting me to continue like I'm doing a c-sharp with arcgis add-in so that's a very specific thing you know for it's a it's an ad in on top of an existing program called arcgis that's my specialty basically by the way so my specialty is a geographic information system i I'm a product engineer advisory and I certified software oh I am I work on the geo database team so I'm not gonna worry of the details but so we build the geographic location based software and what the top is actually our joyous so i'm currently on us on the series that help people extend our joy is to build their own software on top of that platform so here is basic programming only and I'm really enjoying this as a product in July don't get to do much coding I do a lot of testing and I enjoy that because I find a lot of stuff and I learn how the software will work in a bigger picture but I i miss programming so I come back here and program for you guys and enjoy this hope you really so alright so after this long introduction which hits I don't know how long it took us but really as I told you we're going to continue only if I so interact so this is the last episode as of now episode 10 will be the last episode of object-oriented programming and it's gonna be a long one so yeah there's a lot of stuff to do so let's get back here let us get back here what do we do we want to fix something really ugly here all right the problem that is following we have a lot of methods here so we have add onion add meet at chicken what else add whatever add meat and each one has his own method but what if I want to add a new ingredient like like I want to add I don't know I want to add a green pepper I want to add garlic will I keep opening my code and add this stuff it's ugly and this this this stuff is more uglier and so now want to get rid of all this crap and replace it with a nicely pulling more fitting approach a ton of this all right ward or not but we we're gonna replace it with inheritance yeah so we're going to introduce something cold we're going to deal with all this crap and introduced something called ingredient so hmm that's great a folder get rid the end when is this is all rights plank don't judge me guys oh damn it I think it's right yes I [ __ ] you yo well I was Valentine about that happy Valentine's Day yes what is he crying ingredient yes good spelling all right go back so i want to add an interface here so you guys know what an interpreter go to the previous episode I'm gonna call it I ingredient we call the previous one only yes I crust I'm i just called interface start with anything I you don't have to just the way I do it interface alright so what do we have an interface what do we have in an ingredient an ingredient of course has a name all right this it doesn't have public so remove their it has a name sorry three commas here say ingredient me well potato tomato mushroom all this kind of ingredient and of course more important prize an agreement has a price oh this place all right what did i do just just type property twice as double and your bogus having a hard time because i'm using a tracker price cry so the int what else what are we keeping here on the pizza add meat we are making that keeping track of how many meet portions right or the only importance all of this will go away so see this introduction of ingredient who can introduce using this we can introduce loops because we will get a neat loops here so we're going to do our first loop here finally all right but i didn't so imagine after nine up sorry we didn't need a single loop after night episode this is our first loop is just so popped up you know sometimes you can't write program that doesn't have doesn't have loops so imagine it's okay right so we have loops we're gonna have what else uhhhh see that's it ya gotta choose a race two arrays and loops that's it alright so we have ingredients so let's add our first ingredient is just a class so for simplicity i'm gonna make a chicken and chicken implements I ingredient and yeah that's it so what is the name of this since we have a constructor sub pop's of new and mhmmm name is equal chicken and the price of the chicken we can put it here what's the price of the chicken as we said it oh my God all this [ __ ] will go away finally one alright sweet set another ingredient meet implements I ingredient public sub M you when you create a new object by the way I put a nice explanation about class versus object it's a blog entry go read it's in the first episode of this series in the description enjoyed about this cupcake analogy well I don't like it but some people find it useful ok meet price is equal 1.5 yeah at 1.5 onion and cheese almost there guys all those that support that paizo point 5 yeah just add this thing okay get rid of the onion now so I got an idea all right so a lot of changes lots of changes so bye-bye cheese bye-bye onion we don't need private variables anymore bye bye chicken and bye-bye needs bye-bye portions I don't need to keep portions anymore i'm going to show you why in a second no price of that but then we have to get rid of a store price i think nobody's using it yeah bye-bye these portions chicken portions even to oh my god all this this will get a [ __ ] us up lots of stuff made hmmm what's gonna be more difficult than I imagined we'll see about that good good all this will be very simple alright so now you don't need portions all right side a method called public sub add ingredients so I'm gonna add a new ingredient in the pizza so I'm pins acquires I'm going to add in your ingredient and it's called p ingredient as I ingredient so I don't care what this ingredient is I'm just gonna add it now as we keep adding ingredients to this in pizza we need to keep track what are the ingredients of the speeds alright so this really simple so all we need to do is basically have a property here alright so we need to be Kurt to talk about a new type here which is called less or I raised all right so a list of array just simply a collection of the same thing so I can make a list of so as the crew here private list as list of integer so this means I declaring an object of type list which is the class and this list is of type integer don't overthink it very simple so all we have to do is to make this list as new because we need to declare an object of this so that's the new list now we have an object and you treat this as some sort of a container you add stuff to it add and it says listed add item what's the item number for add another item number 5 and another item number 7 and so on this is what's called lists all right so I'm going to use the same concept here but we're gonna make private ingredients as list off not integers I'm keeping a list think of it as a physical list right I'm keeping a list of actual ingredients and when ice initialize or create a new pizza I want this ingredient object being of new list of our ingredient this is just declaring a new object of this class which is happen to call the cold list all right guys all right of course we need a property to retrieve that class and do it later all right so when we add an ingredient we simply we said ingredients don't add and you need an ingredient we pass that ingredient to the function and this is the function so the client or so whoever is using this pizza class should pass an ingredient here i'm gonna add it so there you go very nice how about that we were placed five lipitor not be more so how do I know the quantity all right so I have a list now you told me that we have we are we're adding an ingredient and first of all we didn't talk about how to add an ingredient yet okay which is I guess most of you have figured it out already so to add an ingredient of course this form has already being changed all of this code will change this this is I'm not I'm not applicable anymore we need to use different approach but we might keep that all right so to keep the inventory of things but all right so how do i add for example certain ingredients to the speeds ago as well there's a lot of work we need to fix all right so for example how do i add cheese add cheese is a method right so let's fix that how do i add cheese to add a cheese says first you have to check if the cheese poor friends are still there right like if it's cheese portions is greater than zero then pizza add cheese and instead of add cheese we say add ingredient and then you need to add a cheese ingredient how do you do that good geez how about that how simple is this really guys so we just added a new ingredient here alright how do i add or less remove audience now or I don't want to change what did i do what did i do oh my god what did I do [ __ ] oh god freaked me out Wow alright so let's add a new class go down on the end get the solo and so we keep this consistent implement I ingredient and then public sub new name equal only in then price equal what's the price of the onion again for getting all I deleted that game it yeah say point one it's cheap okay good a volume so if we add onion very simple just add ingredient new onion or you can declare the onion as annoying gradient equals new audience and you pass this only the same thing right guys just it's exactly the same thing so whatever rocks your boat you're going to fix this error next we have an inventory of onion portions you have to make sure and contain that all right but yeah we can fix that okay there's a lot of things there's a lot of work we're introducing a lot of work here add meat same thing right Pat ingredient chicken was the chicken in Austria ok so here we were keeping track of how many portions of cheese do we have here we can still keep that variable I just our stupid just removed it we can keep it we could have kept it but yeah you can keep it and keep track of this paper but my point is that since we introduced the ingredient we don't really need that we can get the cheese portions and all these portions using a function to retrieve that but we're gonna come to it right so let's for now let's comment this out right we don't come up with like that ok let's comment these errors out guys so I did not prepare for this alright so I get just come actually like just came from Big Bear and I opened the wrapped up and literally just start talking so a lot of stuff I didn't prepare for so I'm actually fixing this with you as we speak I don't know what is going to happen so I just just my my my brain thinking let's just do anything calculate price obviously this is all wrong get price so it's just a piece of good point but this method and right man the n rice son ooh we don't have it we don't have anymore this will be my by the price of the dough which is fixed always buy though this is wrong the process the dough can change and we we can add the price of the dough plus the cross type that's polymorphism polymorphism design strategy design pattern right there guys and if size is equal large then we ll that's another of stupid ugly we can we you guys can fix this using the design pattern same thing exactly we're not gonna do this if you give this video enough likes I don't know how much enough really likes but I'm gonna go and fix all these things alright so we're not get a fix the ingredient thing all right how do I calculate the price yes so we run you don't have it as do we start arrows good okay please [ __ ] margaritas [ __ ] let's just comment it or you know add ingredients new cheese this ad ingredient on it poor cable all right mm-hmm save you have another rumor what do you have cheese portion what was that where are we oh that's just refreshing this again I'm gonna first they're gonna fix it some other time but now we're gonna fix one problem only all right crane your pizza create your own thin crust I will get that I add these things and there will be all the same price it's really bad why because we didn't write a code to get that so things are are getting added as we as well I as I call add cheese this add ingredients being cold and a new object is being added to that and every ingredient has its price right so how do i how do I calculate the price of this ingredient so then s really simple we do something called loop a loop is basically an isolation through with ingredients like so for example I say we add a cheese another cheese and onion and then we added a chicken so what's the total price of this so we can loop through this so this is how loop works guys okay first thing we introduce the loop that's the first time so first thing going to point the first location here right and you get the first object and you do something with it and then you go to the next one and you do something with it and you go to the next one you do something with it you go to the next one so that's a loop until this list is exhausted that's a loop and the loop we're going to introduce today's call for each so literally that's why i like vb visual basic its I mean c sharp has the same that's index but for each that's really for each key ingredient for each ingredient first let's declare and agree that you're right i'm going to declare an ingredient right variable here and for each ingredient n this list ingredients when i hit enter the next keyword was added so this is the loop this is called loop so for each ingredient so whatever we have added so let's add we say we add cheese cheese onion chicken so this would be say cheese it will retain cheese in this ingredients and and since is actually a class inherited in her or implementing then greeted the will this will cast easily so next is cheese and other cheese and then aronian and then chicken so that's what these are the things here so what do you want to do here very simple I don't care what's this ingredient here I want to add the price of each ingredient so the price equals the current price plus P ingredient that good price just don't price how about that guys this is polymorphism add at its core look at that so this could be cheese but I don't care could be onion but I don't care so the same code there's no [ __ ] of steak there's nothing so onion has the same price feel like celery swim your busiest guy hmm pizza tech to have one free okay all right back to reward all right so the cheese will have a price I'm gonna take that price so the method that will get executed is this right so this will get return if it's onion this will give written if it's meat this will get written if it's chicken this will get returned how sexy is this seriously guys hmm seriously love this stuff but I'm gonna add it now in a way that there's now it sure like I'm gonna add two cheese's one cheese to cheese one onion once you can conquer the price holy [ __ ] it's actually working if I get that kind of price again nice it's always getting me the most up-to-date price and I get running off a lot of code you know I don't have a much code to maintain now that's really good right guys good so cheese onion me chicken and let's add another portion of cheese oye oye nice ok so we introduced array with reduced loops how about that so I want to fix this problem right I want to show the inventory of things here I'm going to write a function called in the pizza class get ingredient counts ok fish or the pizza so this function public function get agreed ingredient count it returns an integer but it takes an ingredient what ingredients do you want to count right so who can help me write these functions and so simple or each we're going to loop through each ingredients the first way doing it greedy it as our ingredients so I've gotta do it in the same loop it's the same code right guys for each ingredient in the list ingredients what do you want to do I have to do a [ __ ] of a steady there is no escape right here what we have to do end up statement so these are like that the lesser evil right so we have to do and if it's dead in here if the ingredient name equal the ingredient ok this is confusing ah well you have the names of this something else because I can't name this being in radians be ingredient we're gonna call this PNG okay if the current ingredient that I'm looping through is the same as the ingredient this guy is passing the same name then I need a counter I need a counter me a counter and declares counters integer 0 and whenever I find like I'm counting cheese all right so I'm passing hey copy how many cheese's do you have as ingredient so for each ingredient first ingredient is the cheese is equal to cheese yes it does so it will execute the statement count equal count plus 1 and if you want to be fancy I can replace that gotta be fancy goes count plus one equals same same shape right so just being fancy all right same thing I really like to say county Qualcomm person but I just want to be fancy today okay all right so 0 and then it's cheese yes I'm comparing cheese to cheese yes so count which is zero equals zero plus one so it's one okay next go to the next one and give you a no stokes cheese okay it's cheese equal to cheese yes okay so one plus one equals two next audion is only liquid cheese name so go next is chicken equal to cheese nay all right then we say we'll turn count pretend that count if it didn't find gonna return 0 all right so this is very important function we just wrote here get count ingredient count all right here in the pizza again we don't care anymore of counting so we can actually do that right so we want the cheese portions we don't have cheese board right so we can't get ingredient count your cheese we can say that good so I'm going to get that cheese ingredient count how many ingredients of cheese do we have onion unlock that get you got God new onion some of you will say now here you didn't fix them for interest and what you're doing man try to try to track us at the same console right guys so you meet the myths the myth chicken uh-huh yo Jagger let them chickens mean oh why let's see if this works I want them then crushed on my chicken add cheese another cheese keypad inc Oh bad guys bug yeah we exceeded that damn inventory because I think we converted out some yeah because we are not deducting this [ __ ] so we're adding an ingredient of cheese but I think we should you know we should deduct or remove that that particular ingredient from the inventory so I think we're gonna end up doing that inventory ship too Wow ugly ugly code ugly [ __ ] code alright so what do you have we have ten portion of meats temperatures oh my god we're gonna place all this with a nice property cold ingredients inventory as can you guess list all I ingredient yes the same thing guys tap you reduce say ingredients all the list of all ingredients this is actual ingredient object but instead of doing that that's what I'm gonna do so how do i add ten portions of meat who is the smart guy who can tell me right thank gonna give you five seconds to cats okay 1q three four five times it up time is up this is how we do adding ten ingredients guys first of all we have to do that ingredients equal new ingredient list of angry i angry dude and then what we do is this sexy thing 40 but this for is different this is it called for but not for each as its account for so for let's declare a variable here go for i as integer start from 0 to 10 from one to 10 and then this is next this is the same Lou but it's different so this the difference between that loop and this one is just start with one and then when you say next it will add 11 to this I so will be 2 by 3 and forward until it reaches 9 you see the [ __ ] this is 9 and 3 10 it will continue but if it will reach 11 it will stop because 11 is more than 10 right so that's how it works alright so for i'm going to add 10 portions of meat how do you do that ingredients to add new meat mind equal blown tell me your mind is not blown right now yes not i'm gonna add already portion cheese cheese 10 portions of cheese what toughbook ok good sure about that check on how many only still have 14 only why 14 11 whites number making sense already 15 chicken portions ok this is my inventor right there right there do i need this crap now we don't know it outside we're gonna copy or steal a function that tell us how many ingredients cars they have although i don't like to do that and i can't enhance it but i don't want to now i'm gonna steal this function and copy it swear then mentally because it has the same exact code I want to count the ingredients for each ingredient think being ok alright so I'm cutting the ingredients same thing when you compile your girls obviously yeah of course I know I so we do that want the cheese portions of this cheese and since we why do we create three I mean we are creating the cheese object three times here so let's save some memory this is really wasteful jeez as you know cheese that's another way creating so that's why programming is confusing for something because there are like million ways of doing [ __ ] people really get confused of course they will get confused like million little ways of doing things I've every programmer have this on me kinky way of doing [ __ ] so you guys yeah don't be so hard if you're selling on yourself so this programming is really sometimes it's a lot of stuff every every person who are I to compile just introduces like million ways of doing things so yeah so you can do it this way you can do it equal meal with the new without you can do another statement sir oh man command damn do you own yin and you know how to write onion oh let's get ingredients count oh yeah the new ingredients oops oopsie oh that would be really challenging now just for I just I just oh my god i did i do what did i do what did I do dude dude so yeah there we are ingredients this is what feel what adding on over it okay let's do this even if i take two hours we're gonna do in the skies because i love you romance right there meet we meet that's a complex code right there man so i'm not saying that this code is the best code ever so don't take my word for it I mean let's really get an out of hand plus there are yeah it could be really something i canna can be really difficult to read like the sindh escape I mean I don't know if you if you can already guess that but it's challenging to read object-oriented code but it's really easy to manage so I hope Thanks don't get out of hand alright this is worth it give it to me I'm wharf at telenor fit or right so still we we are missing something really really we need miles and so this this will work I know but it's real still to show you something we write so yeah the ingredient you saw that the ingredient is being increased but the inventor is not decreasing why because we didn't decrease it right we didn't remove any ingredients from the inventory so that's what we should do next p inventory our inventory door to remove ingredients we need to add a method in the inventory to remove an ingredient from an inventory public conquered by the i'm gonna share the code for you guys so you don't write all this remove ingredi n remove this ingredient remove a ingredient from the inventory this ingredient [ __ ] really difficult man so let's make it as a sub because we're not even expecting anything right so how do we remove an ingredient from the inventory very simple ingredient we're going to find first we're going to find if there are there's the greediness there first or not so maybe we should return a function that returns a boolean was I able to remove it or not right so f inventory dot 0 we are going to f get ingredient count for this ingredient if we have at least if we don't have an ingredient if this is 0 then return false don't even bother right if this is if you try to remove it in Korea and it's already there is no ingredient just return false says hey you don't have any ingredients what are you trying to remove right else when I turn true obviously and now we're going to try to remove an ingredient from them so so now I'm sure that there is at least one ingredient of this type that this person sent right so how do i remove an ingredient you're going to look through it p for each ingredient so this is really tricky right how do i remove an ingredient i'm just thinking now so ingredients is a list there's obviously a remove functioning or which takes an ingredient but this one no more because this is this remove desert doesn't work this way it just takes literally the same object it finds the same object but obvious when these are all different objects so we cannot really remove it this way so how can we remove an ingredient a slink alright so again we're going to remove the first ingredient that we find all right by index so ingredients let's remove at a location let's try that but ok for each key ingredient as I ingredient in ingredients if you find that ingredient if you find this ingredient movie dance do the name that what we do wait say ingredients don't remove at all we still can do that ok I'm going to change the slough into something else for i as integer equals zero two ingredients that count minus 1 i'm going to loop through it but differently this is the same exactly but i'm looking through indices so each array has values right so when you say this the first values cheese cheese onion onion this actually has values and these values are like that so the index number one index number 2 and X number three they start from zero so we're going to start from zero to count which are four minus one two three that's why the other people gets confused that's even I get confused with this so just yes keep practicing guys I know you were like expecting some some tip or best practice but now keep practicing you have to remember some less stuff from zero sum would start from one this really annoying so ingredients oh and in c-sharp it's like that and maybe it's like that right so and off I so give me the eighth an ingredient and if that is equal to that then remove the eyes and just return true and obviously we do not need that but I've just in case so if there's no ingredient then this will be false right if there is an agree at least one gonna be there so I'm going to loop through it find it and remove it right so hopefully this will not return an error is ok so let's see add ingredient that's that's really good we can just do it here remove ingredient of the ingredients okay if you guys want to ask a question this feel for you right I'm not going to explain here but back some people say okay I said why didn't you just did that ingredients the three move where ingredients don't remove when you just pass the ingredient I'm just gonna tell you it will never walk this will never work all right but rugged I tell you why but even if you try to not work look I tell you but if you want to know the answer I'm gonna tell you right dad all right if I didn't forget alright so now hopefully help this one guys this is what I would be really embarrassed not really I know look at that guys we cleaned the [ __ ] out of this code and I please i want to do final thing I don't want to click this button anymore I'm really tired my hand hurts from clicking all these buttons so what I want to do is learn to something really sexy I want this to be calculated by itself every time in I can hmm can't do it I guess huh did you notice that this code now it's almost the same so that's the beauty of object-oriented it turns everything into the same code when it is barely the same code and we can we can I know we can do all this I mean we can do much much much more sexier stuff with this right but I think we're going to stop here guys as I told you right this will be the final episode for object-oriented programming until further notice we can go to the this is like this let's call this the beginner less the right f I got enough request I'm going to start the second series which is called the intermediate object-oriented programming all right and I don't have gonna be but it's going to be just pure object-oriented program so we are not allowed to do functional stuff pure object oriented as much as possible like like this case alright so we did everything in the object-oriented right but yeah how about that so we're going to continue only if that if enough people requested that right if not we got to do something else I have a lot of plans but once i finish i eventually get a return to this and I want to start another episode called service-oriented architecture that's my next goal hopefully our waste of recording yeah so service-oriented architecture SOA and I want to do sexy stuff on that so services rest and soap and all these beautiful things the next-gen stuff cloud all these things bad yeah but these was this is what necessary i wanted to have a series that i can refer you guys to to learn stuff all right so we can enhance this program i'm gonna use this program as a base as a library to to do other series like the services oriented architecture how to do w CF obviously you're gonna do rest and so so many so many good stuff alright guys that's it for me now this will be the end of this object oriented programming I'm gonna see you the next one hopefully I'm gonna go back to do some GIS with the GIS folks have been waiting for me all right guys you stay awesome see you and the next one goodbye
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from Hussein Nasser · Hussein Nasser · 13 of 60

1 Extending ArcObjects (IGeometry) - 01 - Getting Started
Extending ArcObjects (IGeometry) - 01 - Getting Started
Hussein Nasser
2 Extending ArcObjects  (IGeometry) - 02 - The Document, The Map and The Layers
Extending ArcObjects (IGeometry) - 02 - The Document, The Map and The Layers
Hussein Nasser
3 Channel Update - New Book, New Job, New Videos
Channel Update - New Book, New Job, New Videos
Hussein Nasser
4 Learn Programming with VB.NET - 01 - Getting Started
Learn Programming with VB.NET - 01 - Getting Started
Hussein Nasser
5 Learn Programming with VB.NET - 02 - Classes and Objects (Part 1)
Learn Programming with VB.NET - 02 - Classes and Objects (Part 1)
Hussein Nasser
6 Learn Programming with VB.NET - 03 - Classes and Objects (Part 2)
Learn Programming with VB.NET - 03 - Classes and Objects (Part 2)
Hussein Nasser
7 Learn Programming with VB.NET - 04 - User Interface
Learn Programming with VB.NET - 04 - User Interface
Hussein Nasser
8 Learn Programming with VB.NET - 05 - By Value v. By Reference
Learn Programming with VB.NET - 05 - By Value v. By Reference
Hussein Nasser
9 Learn Programming with VB.NET - 06 - Variable size, 32 bit vs 64 bit
Learn Programming with VB.NET - 06 - Variable size, 32 bit vs 64 bit
Hussein Nasser
10 Learn Programming with VB.NET - 07 - Conditional Statements
Learn Programming with VB.NET - 07 - Conditional Statements
Hussein Nasser
11 Learn Programming with VB.NET - 08 - Inheritance
Learn Programming with VB.NET - 08 - Inheritance
Hussein Nasser
12 Learn Programming with VB.NET - 09 - Strategy Design Pattern
Learn Programming with VB.NET - 09 - Strategy Design Pattern
Hussein Nasser
Learn Programming with VB.NET - 10 -  How did I learn programming
Learn Programming with VB.NET - 10 - How did I learn programming
Hussein Nasser
14 IGeometry 2016 Retrospective - Channel Update
IGeometry 2016 Retrospective - Channel Update
Hussein Nasser
15 Javascript by Example - The Vook
Javascript by Example - The Vook
Hussein Nasser
16 Vlog - Keep your servers close and your database closer
Vlog - Keep your servers close and your database closer
Hussein Nasser
17 Vlog - Client/Server Programming Languages
Vlog - Client/Server Programming Languages
Hussein Nasser
18 Javascript By Example L1E01 - Getting Started
Javascript By Example L1E01 - Getting Started
Hussein Nasser
19 Persistent Connections (Pros and Cons)
Persistent Connections (Pros and Cons)
Hussein Nasser
20 Javascript By Example L1E02 - Building the Calculator Interface
Javascript By Example L1E02 - Building the Calculator Interface
Hussein Nasser
21 Happy new Year from IGeometry!
Happy new Year from IGeometry!
Hussein Nasser
22 Synchronous v. Asynchronous
Synchronous v. Asynchronous
Hussein Nasser
23 Javascript By Example L1E03 - Displaying the Digits on Calculator Screen
Javascript By Example L1E03 - Displaying the Digits on Calculator Screen
Hussein Nasser
24 Show Your Work. Blog, Vlog, Write, Create and Develop!
Show Your Work. Blog, Vlog, Write, Create and Develop!
Hussein Nasser
25 Relational Database Atomicity Explained By Example
Relational Database Atomicity Explained By Example
Hussein Nasser
26 Javascript By Example L1E04 - Operators, All Clear with Arrow Functions
Javascript By Example L1E04 - Operators, All Clear with Arrow Functions
Hussein Nasser
27 What Comes First, User Experience or Software Architecture?
What Comes First, User Experience or Software Architecture?
Hussein Nasser
28 Javascript By Example L1E05 -  Evaluate the Calculator Expressions with eval
Javascript By Example L1E05 - Evaluate the Calculator Expressions with eval
Hussein Nasser
29 Fastest Way to Learn Programming Language or Technology
Fastest Way to Learn Programming Language or Technology
Hussein Nasser
30 Javascript By Example L1E06 -  Fix Leading Zero Bug with Conditions
Javascript By Example L1E06 - Fix Leading Zero Bug with Conditions
Hussein Nasser
31 Stateful vs Stateless Applications (Explained by Example)
Stateful vs Stateless Applications (Explained by Example)
Hussein Nasser
32 Javascript By Example L1E07 - Running our Calculator on the Mobile Phone
Javascript By Example L1E07 - Running our Calculator on the Mobile Phone
Hussein Nasser
33 Advice for New Software Engineers and Developers
Advice for New Software Engineers and Developers
Hussein Nasser
34 Why JSON is so Popular?
Why JSON is so Popular?
Hussein Nasser
35 Building Scalable Software - SLA, HS, VS
Building Scalable Software - SLA, HS, VS
Hussein Nasser
36 Vlog (Istanbul) - Datacenter Proximity
Vlog (Istanbul) - Datacenter Proximity
Hussein Nasser
37 Should Software Engineers Learn Bleeding-Edge Technologies?
Should Software Engineers Learn Bleeding-Edge Technologies?
Hussein Nasser
38 Do Developers Build Bad User Interfaces/Experience?
Do Developers Build Bad User Interfaces/Experience?
Hussein Nasser
39 Learn By Doing.
Learn By Doing.
Hussein Nasser
40 I Wrote Bad Front-End Code That Broke Chrome
I Wrote Bad Front-End Code That Broke Chrome
Hussein Nasser
41 My Story
My Story
Hussein Nasser
42 Vlog - Horizontal vs Vertical Scaling
Vlog - Horizontal vs Vertical Scaling
Hussein Nasser
43 Can User Experience Help Build Better Rest API?
Can User Experience Help Build Better Rest API?
Hussein Nasser
44 Reverse engineering Instagram in flight mode
Reverse engineering Instagram in flight mode
Hussein Nasser
45 The Benefits of the 3-Tier Architecture (e.g. REST API)
The Benefits of the 3-Tier Architecture (e.g. REST API)
Hussein Nasser
46 Stateless v. Stateful Architecture (Podcast)
Stateless v. Stateful Architecture (Podcast)
Hussein Nasser
47 The evolution from virtual machines to containers
The evolution from virtual machines to containers
Hussein Nasser
48 Proxy vs. Reverse Proxy (Explained by Example)
Proxy vs. Reverse Proxy (Explained by Example)
Hussein Nasser
49 Canary Deployment (Explained by Example)
Canary Deployment (Explained by Example)
Hussein Nasser
50 No Excuses
No Excuses
Hussein Nasser
51 Synchronous vs Asynchronous Applications (Explained by Example)
Synchronous vs Asynchronous Applications (Explained by Example)
Hussein Nasser
52 What is an Asynchronous service?
What is an Asynchronous service?
Hussein Nasser
53 Difference between Client Polling vs Server Push in Notifications
Difference between Client Polling vs Server Push in Notifications
Hussein Nasser
54 Software vs. Hardware AdBlockers (Explained by Example)
Software vs. Hardware AdBlockers (Explained by Example)
Hussein Nasser
55 HTTP Caching with E-Tags -  (Explained by Example)
HTTP Caching with E-Tags - (Explained by Example)
Hussein Nasser
56 Simple Object Access Protocol Pros and Cons (Explained by Example)
Simple Object Access Protocol Pros and Cons (Explained by Example)
Hussein Nasser
57 Nodejs Express "Hello, World"
Nodejs Express "Hello, World"
Hussein Nasser
58 Reverse Engineering Instagram feed
Reverse Engineering Instagram feed
Hussein Nasser
59 Popup Modal Dialog with Javascript and HTML
Popup Modal Dialog with Javascript and HTML
Hussein Nasser
60 MIME and Media Type sniffing explained and the type of attacks it leads to
MIME and Media Type sniffing explained and the type of attacks it leads to
Hussein Nasser

The video series teaches programming with VB.NET, focusing on object-oriented programming concepts, such as inheritance, interfaces, and polymorphism, using tools like Visual Basic, Windows 95, and VB.NET, to create a pizza ordering system and manage ingredients and inventory. The series covers topics such as data structures, loops, and inventory management, and provides practical examples and code snippets to illustrate key concepts.

Key Takeaways
  1. Create a new class for ingredients
  2. Implement the IIngredient interface
  3. Add a constructor to initialize the ingredients
  4. Create a list of ingredients
  5. Add a method to add ingredients to the pizza
  6. Use a for each loop to iterate over a list of ingredients
  7. Apply polymorphism to calculate the price of ingredients
  8. Remove an ingredient from a list
  9. Use a for loop to iterate through the array
  10. Use the RemoveAt method to remove an element
💡 Object-oriented programming can be used to create efficient and scalable programs, and tools like VB.NET provide a powerful platform for building real-world applications.

Related AI Lessons

LiteLLM is becoming much more than just an LLM gateway. Has anyone actually deployed its Datadog integration in production?
Learn how to deploy LiteLLM's Datadog integration for comprehensive LLM observability and cost management
Reddit r/devops
LLM Output Verification: Detecting Hallucinations and Injection in Production
Verify LLM output to prevent hallucinations and injection attacks in production environments, ensuring reliable and secure AI deployments
Dev.to AI
Claude Code and Anthropic models on AWS Bedrock: Lessons learned
Learn how to deploy Claude Code and Anthropic models on AWS Bedrock for efficient coding AI harnesses
Dev.to AI
Pair Nova 2 Lite with Claude for cost-optimized document processing
Learn to pair Nova 2 Lite with Claude for cost-optimized document processing and digitize scanned documents at scale
AWS Machine Learning
Up next
5 Levels of AI Agents - From Simple LLM Calls to Multi-Agent Systems
Dave Ebbelaar (LLM Eng)
Watch →