Transcript for:
Program Logic and Design

welcome back to program logic and design in this chapter we're going to be discussing structure our programming structure of our code first things first is let's discuss the disadvantages of unstructured spaghetti code now when you think of spaghetti you're probably thinking of our lovely spaghetti that we eat that is correct all right we need to make sure that we have a structured program a program that doesn't have spaghetti strings all tangled up Etc so when I talk about spaghetti code I'm talking about logically snowed or Twisted program statements they're often a complicated mess and the programs often work but are not difficult to read and maintain only problem is that they can get quite confusing and they are prone to error so to give you an example is we get some unstructured programs they do not follow the rules of structured logic and structured programs follow the rules of structured logic now a majority of you now being first students will probably have unstructured programs that you need to structure to apply rules to and that is why you're doing this course so let's go through an example yes spaghetti CED Logic for washing a dog we all know how to wash a dog and you all go yes we got to catch the dog if the dog runs away then we we go back to catching the dog again you'll see that this is all looks sort of correct but it is unstructured spaghetti coat it's all good if you know how to wash a dog and in that line of work but to someone who is not an animal person this program will never work flow lines should never ever cross this is pretty difficult to work and it's also difficult to maintain and read the logic is pretty hard to follow because you don't know whether at this particular Point here you don't know if you're going to go up to shampooing the dog or if you're going to go back down to rinsing the dog these sort of programs Never Last in production they get scrapped or abandoned I'm sure you can see why because you cannot update it's too messy no logic it costs money to update as it's actually wasting our time and it's a complicated mess just like your bowl of spaghetti now programs often work but are difficult to read and maintain and therefore as I said they are confusing and prone to error so let's get to the next video where we will be discussing some of the ways we we can actually structure our program and that is to understand the three Basics structure