IMAT1604 Visual Web Development Topic : Problem Solving and Programming Week number :2 Session :1 Overview In this session we shall start to look at the question “What is programming?” We shall relate this to the subject of problem solving and you shall have an opportunity to solve some simple programming problems using a program called The Cards. What you should be doing in this class Make sure you have a plan on how you are going to obtain bonus marks either in a team or working individually Work on driving test 1 Work on your portfolio exercises For the portfolio work and driving tests o Get help from your tutor and your friends o Use the material presented by your tutor o Use the supporting examples in these notes o Watch the on-line videos on the module web site Contents The Cards................................................................................... 1 What You Need to Know ............................................................... 3 So what is Programming? ....................................................... 4 The Cards You have been provided with a Code Reference Book which contains short examples of all of the code you will use in the module. You have your own copy of the book and you may write in it as you see fit. Your hand annotated Code Reference Book may be taken with you as a reference in the phase tests. For this session you will use a program called The Cards which is available for download from the module web site. The Cards will present you with programming related questions like so... In this case “Display the message hello world in the text box called txtOutput.” 1 Each rectangle on the green board is a card... Cards And may be dragged around the board onto the area marked... To form an answer like so... If you think your answer is correct then press the button... Your tutor will split the class into teams of roughly equal size. The task of each team is to work together and answer all of the questions presented by the program. Each member of the first team to answer all of the questions will be awarded 2 module bonus points. Remember to keep in mind all of the tools at your disposal for solving the problems given to you! 2 What You Need to Know Take a little while to think about the kind of problems you have solved so far in your life. How many of you have travelled to Leicester from another town? How many of you have been on a long journey of any sort? Problem solving is a skill that you all possess but probably don’t think much about it. Consider going on a journey, say from your home town to arrive here at the University. The first step is to identify the problem that needs to be solved... “I need to arrive in Leicester to enrol at University during enrolment week. When I arrive in Leicester I need to have a place to stay and money.” You are here today, so that means you have solved (at least part of) this problem. (Obviously if you live in Leicester already, it becomes simpler!) Once you have identified the problem the next step is to identify the set of tools that will assist you in solving the problem. You will probably have used the following... Train / bus timetables Telephone to make arrangements Forms to apply for student loans Discussion with friends and family to get help and advice As you solve the problem you will constantly be comparing your solution and progress with the problem. “Have I used all of the tools to create a suitable solution to the problem?” Once you have solved the problem and everything is place you will then follow the plan that you have devised and the problem is solved. 3 We all have the skill of problem solving and we use it all of the time. Learning to program requires the same set of skills, however the problems we solve and the tools we use are different. So what is Programming? A problem Tools No Problem Solving Does the solution solve the Yes problem? A Solution? Programming always starts with a problem. This may be a problem you have found yourself or it could be from your tutor, boss or client. The first step is to clearly identify the problem and make sure that you understand it clearly. For example a client may decide that they want a web site that sells books. The problem then becomes “how to design a suitable web site.” 4 Once the problem has been identified and understood a programmer then enters problem solving mode. To solve problems we need to think and use our brains, however there are a number of tools available to us. One tool is the programming language that we are to use. In the case of this module we are using VB.NET. Understanding the programming language is actually not the most important skill to acquire. In twenty years time VB.NET will have changed and evolved into something different. The language specific skills you learn now will probably be redundant by then. The problem solving skills will still be valid whichever language you use. The programming language is simply a tool to help you solve the problem. Other tools that help you solve problems are such things as books and internet resources. By searching the web you may find that there are samples of code that do something similar to what you want to do. In programming it is good to recycle. Adapting existing code to your own needs is an important skill. (Obviously you must give credit to the original author.) Another tool that is at your disposal is seeking advice from other people. This may be fellow students or your tutor. When solving problems it is beneficial to work with other people to get help with the problem solving process. As you enter into the problem solving process you will start to move closer and closer to a solution. Question - How do you know if your solution solves the problem? Answer – by constantly comparing your solution with the problem. 5 If your solution is not suitable then you enter once again into problem solving mode. If your solution solves the problem then you send your customer the bill. 6