week9 - EECS 280 Week 9 Discussion Notes Introduction to...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: EECS 280 Week 9 Discussion Notes Introduction to Object Oriented Programming: Classes 1 Prologue After reading, rereading and carefully analyzing the specification document the entire morning, you feel eager to start your new assignmenta back-end system for handling BankTwos financial transactions. However, before you can begin, you needed to know the implementation details for date data (you made a note of that along with many other things while reading the spec). The project had been divided and assigned to two teams, the date structure was the other teams responsibility. You slowly walk across the hall wondering to yourself, why would they assign three pro- grammers for the other team, while I have to work alone on the more complicated part. I guess a flashy user interface is more important than any security concerns. I know where I wont be opening an account... Alice who saw you coming, gave a courtesy smile and asked, how may I help you? Yeah, you see I need to know how you plan to implement the date thing, so I can get started, you say, getting straight to the point. Well, we are trying to decide on that. Alice says, maybe you can help us decide. You see I think we should store the date as a string, straight from the users input, we can manipulate it later depending on the specific use, plus outputting will be super easy. However, Bob thinks we should store it as an integer representing the number of days since Jan 1st, 1970, which would make comparison, and duration calculations easy, but requires more work converting to/from string form. Chris had a hybrid approach, storing the data as three integers day/month/year. What do you think? 2 Object-oriented Programming Wake up! Its the 21st century, Object-oriented Programming (OOP) is here. Knowing the OOP style will help you avoid such trouble. But what is OOP? Object-oriented programming (OOP) is a programming paradigm that uses ob- jects and their interactions to design applications and computer programs. It is based on several techniques, including encapsulation, modularity, polymorphism, and inheritance.-Source Wikipedia So OOP is not a programming language, but a programming style or principle. The goal is to break software into more fundamental units, while increasing maintainability (the ease of fixing/modifying a program) and re-usability (the ability to reuse common components in other software). Lets discuss the various principles in OOP. Encapsulation (aka information hiding) is the principle that the user only needs to know how to manipulate the object, and does not need to know how the object is actually stored, 1 or how each action is implemented. So the user is protected from any implementation changes in the object (and you can just say to Alice, I dont care how you implement it, just give me the interface!) Modularity is a concept that encourages breaking the task into fundamental blocks, and facilitates reusing code, and code maintenance (i.e. fixing/modifying the program). Thefacilitates reusing code, and code maintenance (i....
View Full Document

This note was uploaded on 04/04/2008 for the course EECS 215 taught by Professor Phillips during the Winter '08 term at University of Michigan.

Page1 / 6

week9 - EECS 280 Week 9 Discussion Notes Introduction to...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online