preparation for entry into .net bridging program (databases)

25
Preparation for Entry into .NET Bridging Program (Databases) In order to be successful in this program, it is important for you to have some theoretical knowledge of many concepts in software development. You should have an idea of what a database is and how it stores data. You should also be able to write a simple SQL statement to retrieve data from a table. Know about the relational aspect of a Database, how we can join tables and the difference between the Foreign and Primary keys. Be able to Create, Update and Delete records in a Database.

Upload: daxia

Post on 14-Feb-2016

66 views

Category:

Documents


1 download

DESCRIPTION

Preparation for Entry into .NET Bridging Program (Databases). In order to be successful in this program, it is important for you to have some theoretical knowledge of many concepts in software development. - PowerPoint PPT Presentation

TRANSCRIPT

Object Oriented Programming

Preparation for Entry into .NET Bridging Program (Databases)In order to be successful in this program, it is important for you to have some theoretical knowledge of many concepts in software development.

You should have an idea of what a database is and how it stores data. You should also be able to write a simple SQL statement to retrieve data from a table.

Know about the relational aspect of a Database, how we can join tables and the difference between the Foreign and Primary keys.

Be able to Create, Update and Delete records in a Database.1Preparation for Entry into .NET Bridging Program (Programming)For the C# programming part of the course it is important for you to understand the fundamental concepts (in any programming language):Variables and assignmentOperators like +-*/% as well as AND/OR/NOT etc.Control structures like decisions, iteration and loopingArrays-initialization, elements, indexing etc.Methods (functions)-parameters, return values etc.

It is also important for you to know the Microsoft Windows environment and be comfortable with files, folders, copying, moving and very basic knowledge of the Office products.2Preparation for Entry into .NET Bridging Program (Web)You should be familiar with the Internet, using the Internet, searching, finding information knowing the difference between good information and bad information.Be able to write a simple web page using Notepad, so you should have knowledge of the HTML tags like Paragraphs, Ordered Lists, Body, Table and Div, all the major ones.It would be helpful if you have used JavaScript in some way, perhaps to check the value inside of a textfield, or to cause a popup message. 3Object Oriented Programming using C#If you are a complete beginner to the OOP world, please review this entire slide presentation from slide number 6 onwards. You will need to run the presentation in full-screen mode (F5) in order to hear the audio. After the presentation you may follow the links given on slide #5 to view the two videos on the official Microsoft website.

For those with some exposure to OOP or to C# itself, please proceed to the videos, you may skip the slides in this presentation.4Microsoft Produced VideosPlease go to this url address:http://www.microsoftvirtualacademy.com/training-courses/c-fundamentals-for-absolute-beginners

Start with this video (towards the middle of the page):15 | Understanding and Creating ClassesThen watch this video:16 | More About Classes and Methods

Of course you may watch as many as you like, but we will be testing specifically on 15 and 16.5Prehistoric Humans & Communication

We will begin our journey of how OOP came into being by going back to the beginning. If you were to believe the fossil records and the evolution story, you would know that when man first appeared on the earth, his vocal cords were not fully developed. So how do you think man communicated.6Natural World

Well perhaps he just pointed to things. As you can imagine, man had a lot to point to, fruits, birds, trees, fishes, fire, rocks. Basically anything that Man encountered in his environment, he pointed to it in order to establish some sort of communication. The simple act of pointing meant that Man was establishing a way to identify what he saw around him. 7First Words?

UgghhGrrrrrrBrrrrrrArrrrrghhOver time, Mans vocal cords began to develop and perhaps his first words were merely grunts and guttural noises as he pointed to the items in his surroundings.8Language Starts

ThingSomethingThisThatEventually those grunts became just one word, perhaps that word was thing, something, this or that. In other words, one word can now be used for just about anything that man came upon in his prehistoric world.9One Word

ObjectObjectObjectObjectIn fact we can use an even more sophisticated word to identify or point out things in our world, and that word is Object.10Different Words

FruitBirdPlantFishFireRockBut as time went on, and language started forming, Man started to come up with different words to identify his surroundings. Fruit, bird, plant, fish, fire, rock and whatever else there might be in the environment, man can now create new words for them.11Nouns

FruitBirdPlantFishFireRockBut if you look closely at these words and the thing they represent, we can say that these are really nouns. Man had started to develop structure within his language. 12Adjectives

ColourSizeHeightWeightTemperatureTextureAs time went on, Man wanted to talk about his nouns to others. He had to find ways to describe his nouns, what colour was the banana, how big was the bird or how tall was the tree. The Adjective was born. Now man can describe his nouns using the properties that the nouns possessed.13Verbs

Be eatenFly, eat, walk, singGerminate, grow, dieSwim, eat, sleepProvide heat, burn, startPut outExert force on the earth, broken,provides shade for insectsSomething was still missing. When early Man looked at his nouns, he realized that they did not just sit there, they moved, they ate, flew, swam, they did something. Man now had to come up with a way to represent the actions that his nouns performed or that actions that could be performed upon them. He had to invent the verb.14Full Sentences

Fruit (Banana)Colour YellowAction - beaten ( )Bird (Eagle)Size Small, Medium, LargeActions - Fly ( ), Eat ( ), Walk ( )At this point we have nouns that can be described and perform actions. For example we can say that the banana is yellow, an action that can be associated with a banana is that it can be eaten. A bird may be described as being small, medium or large. Its action is that it can fly, eat, walk, sing and so on.15Objects with Properties and Methods

Thing -> Object -> Noun -> BananaAdjective (e.g. colour)=Property=YellowVerbs = Action = functionality (e.g. beEaten ( ))But remember all these nouns started out as being a thing, something or simply an object. Any adjectives we use, can be thought of as the properties of those nouns or objects. And finally the actions associated with each object can be referred to as the objects functionality.16Closer to Programming

ObjectProperties, fields, variables, dataFunctions, methods, proceduresAs we get closer to Object Oriented Programming with our evolution story, we can say that objects in general, are items or things that we have not yet fully identified with an actual name. Those objects may have properties, which in some computer languages are called fields or variables. Those same objects may also have functionality, so we say that they have functions or in some computer languages, these functions are also known as methods or procedures.17Representation

A StudentA Student Object00010100101010111011011100Student kim = new Student ( ) ;In actual computer programming, we try to represent objects in our world with computer code. As computer code is really just a series of ones and zeros, we can use computer language to represent our objects. Some objects are completely abstract and do not represent a solid form like a bird or a tree. In this presentation I am using a circle to represent the object itself.18Representation of a Student

A StudentA Student ObjectProperties1, Properties2, Properties3Function1, Function2,Function3

But these objects continue to have properties and functions. The question now is how do we represent an object along with its properties and functions using computer code. Please understand that not all objects have both properties and functions, some only have one or the other.19Representation using a Class

A Studentclass Student {Register ( )AddCourse ( )DropCourse ( )Graduate ( )}

string Namedate DoBfloat GPAThe way we create objects in the computer is by first creating a representation of that object. The way we represent the object is by writing computer code into something called a class. Recall that the object is composed of properties and functions or methods. So, our class also has to have properties and methods. Properties are the data elements of the class, recall these are also known as fields or variables. These variables usually have a type associated with them so a name having letters of the alphabet will have to be of type string. A GPA can only be a numeric value so this could be an int or more precisely a float. Methods are the functionality of the class, they represent the verbs of the class, what the class can do or have done to it.20Representation in General

A Studentstring Namedate DoBfloat GPAclass Student {Register ( )AddCourse ( )DropCourse ( )Graduate ( )}

Lets take this representation concept a little further. A blueprint is a representation of a house, a schematic drawing is a representation of something that has not yet been built and a picture is a representation of perhaps a place.21Representation of a Student

A StudentNameDoBGPAclass Student {Register ( )AddCourse ( )DropCourse ( )Graduate ( )}

So, lets create an example of an object, a student object to be precise. Think about the nature of a student what does all student have. Well, all students will have a name, perhaps a student id. They may have to give their dob at the registrar, so we have a dob property or perhaps just a number that represents an age. All college students will have a GPA. Now think about what a student does in the environment of a school, they register for programs, they add courses in the program or drop courses. They graduate, they also sign up for clubs, they receive a grade, these are all functions that can be coded.22Class becomes ObjectNameAgeGPAclass Student {Register ( )AddCourse ( )DropCourse ( )Graduate ( )}BobJaneLinJohn

newnewnewnewOnce we create a Class using C# we can then turn that class into an Object. In fact we can create unlimited number of objects from just one class, just like we can build many different houses in different locations from just one blueprint. In engineering designers will build design one concept using Autocad perhaps. That concept drawing is then turned into a physical object such as a car. Each car is then given a serial number, the VIN number, each house has a unique address. So to our student objects are identified by perhaps their unique student number.23Many ObjectsNameAgeGPAclass Student {Register ( )AddCourse ( )DropCourse ( )Graduate ( )}int CourseIDstring Namestring Professorclass Course {assignToCurriculum ( )removeFromCurriculum ( )assignToRoom ( )

}string RoomNameint RoomNumclass Classroom {addCourseTaught ( )removeCourseTaught ( )}

Following our analogy of the Student object, think about other objects related to a student. Perhaps we can have a room class, a course class and a perhaps a professor class. These classes once they become objects in the memory of the machine, can interact with each other just like in real life. So a student can call upon its register method and register for a Csharp course using the Csharp course object. That course has to be assigned to a room, so the room object has to be involved.24Relationships among ObjectsStudent objectCourse objectRoom objectStudent Object Registers ( ) for a Course ObjectCourse Object is Assigned ( ) to a Room Object

BobHistoryK144So once we turn these three classes into objects, we may have a student object with a student Name of Bob. The Bob object uses its register method to register for a Coruse object with a course name of History. That course object is assigned to a room object whose roomid happens to be K144. so in this way we have represented a real life situation using computer language. Bob is taking a History course in room K144.25