70 likes | 285 Views
CHESS PROGRAM. CS 85 PHP Programming Kristal McKinstry Diana Thai Khalifa Sangarie Sasan Shaye. Presentation Outline. Object Oriented Programming 1 Min Chess Game Demo 1 Min How Chess Program Works: 3 Min Khalifa: How Program Works Sasan: Database
E N D
CHESS PROGRAM CS 85 PHP Programming Kristal McKinstry Diana Thai Khalifa Sangarie Sasan Shaye
Presentation Outline • Object Oriented Programming 1 Min • Chess Game Demo 1 Min • How Chess Program Works: 3 Min Khalifa: How Program Works Sasan: Database • Ask 2 Questions: 1 Min
Object Oriented Programming • OUR CHESS PROGRAM uses the OOP method. • LOWER COSTS: One of the main advantages of OO programming is its ease of modification; objects can easily be modified and added to a system thereby reducing maintenance costs. • MODELS THE REAL WORLD: OO programming is also considered to be better at modeling the real world than is procedural programming. Applicable concept. • SOPHISTICATION: It allows for more complicated and flexible interactions. • EASY TO UNDERSTAND: OO systems are also easier for non-technical personnel to understand and easier for them to participate in the maintenance and enhancement of a system because it appeals to natural human cognition patterns. • LESS TIME: For some systems, an OO approach can speed development time since many objects are standard across systems and can be reused. Components that manage dates, shipping, shopping carts, etc. can be purchased and easily modified for a specific system.
3 “Greatness” About OOP • Inheritance – Instead of starting from scratch, you can easily create new objects from existing classes that were built by other programmers. This allows reuse of existing code with little or no modification, saving time and money. • Polymorphism - Even though classes are derived or inherited from the same parent class, each derived class or child will have its own behavior. Analogy is that even though Andre Agassi and Steffi Graff are the parents, their child could inherit their forehand and backhand moves but plays ping pong. • Encapsulation – Hides the objects’ data and methods from the rest of the world. The reason why this is great is that when design decisions in a computer program that are most likely to change, this protects other parts of the program from change if the design decision is changed.
HOW THE CHESS PROGRAM WORKS: • CHESS.PHP DOES: • (1) Loads Libraries – 1st 15 lines • (2) Instantiates Objects: • (1) OBJ to Build GUI • (2) OBJ to Connect MySQL • (3) OBJ for AIM Chat Feature • (4) OBJ to Test Legal Chess Moves, and A LOT MORE… • (3) Reads the variables from OCollectFormVars and determines how to execute. • OCOLLECTFORMVARS DOES: • Interprets user activity and variables & sends data, which CHESS.PHP reads to determine WHAT TO DO. • (2) Uses 2 Arrays: • I. Array 1 collects user information & variables to send to CHESS.PHP • II. Array2 gives data to CHESS.PHP to build GUI. • DATABASE DOES: • Retrieve who’s turn • Stores game details • Store snapshot of game board after • each legal move & MORE