Matakuliah Tahun : T0063 – Pemrograman Visual : 2009 Problem Solving and the Object-Oriented Paradigm CHAPTER ONE Objectives • • • • • • Understand problem-solving concepts. Formulate algorithms using pseudocode. Realize the complexity writing algorithms. Understand an event-driven environment. Describe how classes and objects work. Use and understand the terminology of the object paradigm. Bina Nusantara University 3 Objectives (cont.) • Demonstrate the difference between visual and nonvisual software components. • Begin understanding the relationship of Visual Basic .NET to the event-driven and object paradigms. Bina Nusantara University 4 1.1 Problem Solving • Use computer software to help solve problems. • Pseudocode (false code) is an outline style used to document the solution to a program. • Algorithm is the formal term for the set of steps used to solve a problem. Bina Nusantara University 5 1.2 The Event-Driven Problem-Solving Environment • Most of today’s computer applications are event driven. • Helps developer organize a solution into small segments of code. • One organizes a solution around a series of events. Bina Nusantara University 6 1.3 Using the Object-Oriented Paradigm in Problem Solving • Classes and Objects – Payroll System problem. – Procedural programming has separate data and program logic. – Object-oriented programming (OOP) combines the data and program logic. – Methods describe the behavior associated with an object. – Encapsulates means an object holds in its capsule both data and behavior. Bina Nusantara University 7 1.3 Using the Object-Oriented Paradigm in Problem Solving (cont.) – A class is a definition or template that defines how objects are created. – An instance of a class is another name for an object. – Special methods known as classes methods may be accessed by a class. – Each object instantiated from a class has identical data elements and methods. Bina Nusantara University 8 1.3 Using the Object-Oriented Paradigm in Problem Solving (cont.) • Class Hierarchies – The “is a” relationship may be used describe class hierarchies. – A UML (Unified Modeling Language) class diagram may be used to define classes. – A subclass descends from a superclass or base class. – A superclass contains data and behavior common to subclasses. Bina Nusantara University 9