1 / 26

Java for ColdFusion Programmers

Java for ColdFusion Programmers. Hal Helms halhelms.com. What we'll cover. Why OO? What is OO? Why Java?. Theory of Constraints. According to the Theory of Constraints, any system has only one current constraint that hinders the system from producing

candacej
Download Presentation

Java for ColdFusion Programmers

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Java for ColdFusion Programmers Hal Helms halhelms.com

  2. What we'll cover • Why OO? • What is OO? • Why Java?

  3. Theory of Constraints • According to the Theory of Constraints, any system has only one current constraint that hinders the system from producing • Working on anything other than that is misdirected effort and can actually be worse than doing nothing

  4. What's so great about OO? • The greatest threat to software—to both successful deployment and maintenance—is complexity • Object orientation offers us the best tools yet devised for managing that complexity

  5. Food for thought "Any intelligent fool can make things bigger and more complex. It takes a touch of genius—and a lot of courage—to move in the opposite direction." -Einstein

  6. What tools are available in OO for managing complexity? • Encapsulation • Polymorphism • Inheritance

  7. Fabulous prizes time • List as many data types as you can

  8. About data types • The primary goal of a type system is to ensure language safety by ruling out all untrapped errors in all program runs. [The] declared goal of a type system is usually to ensure good behavior of all programs, by distinguishing between well typed and ill typed programs.—Cardelli

  9. What is object orientation? • Object orientation (OO) is a way of constructing software such that an simplified, idealized model of the world under consideration is created in software components that encapsulate the statefulness and behavior of the inventory of the world and that may change their state or perform some behavior in response to a message sent to them

  10. What did he just say? • "…simplified, idealized model of the world under consideration is created in software components that encapsulate the statefulness and behavior …" PackageDeliverer route: Route assignedTruck: Truck hourlyPayrate: numeric hoursWorked: numeric deliverPackages():boolean collectCOD(): void completeTimecard(): void getPayDue(): numeric

  11. What did he just say? • … that may change their state or perform some behavior in response to a message sent to them doB() doC() route assignedTruck hourlyPayrate hoursWorked obj.getRoute() getRoute() doD() obj.hoursWorked doH() doE() doG() doF()

  12. Breathing life into models • Defining classes is done at design time • At run time, classes are instantiated, producing objects • An OO application is nothing but a number of objects sending messages back and forth to on another

  13. What's so great about Java? • The power of Java lies in object orientation • For most procedural programmers, OO takes time to penetrate • When learning OO, it's very important to lay good foundations • Java is simply a very good implementation of object orientation

  14. Java: Encapsulation • Data and behavior in a single software component: the class • A class is like a blueprint or cookie cutter from which objects are created Class Objects

  15. Encapsulation • Encapsulation allows the details of a component to be hidden from users of the component. In place of exposing its internals, a well-encapsulated component exposes an interface or specification.

  16. A specification • The Cat class has, as part of its specification, a play() method. When called, each Cat object will carry out its play method. We know only what it will do, not how it will do it. I can play()

  17. Encapsulation in Java • Let's build a simple class, Cat • The Cat class will have… • properties • name • color • methods • get/setName() • get/setColor() • play() • Remember that Cat is a blueprint. To create an actual Cat object, we'll use CatDemo.java

  18. I once knew a Greek girl named Polly Morphism but what you just said is Greek to me. Polymorphism • Polymorphism allows different objects to be treated as having the same specification and/or one object to be treated as belonging to different specifications

  19. Treating different objects as having the same specification • Java allows different objects to assume the same type • Java allows the same object to assume different types

  20. Polymorphism in Java • Let's build a simple class, RobotDog • The RobotDog class will have… • properties • voltage • batteryLife • methods • get/setVoltage() • get/setBatteryLife() • play()

  21. Interface • A specification without implementation • Acts as a data type • An interface is like a role that an object can step into • The object, joe, might be "born" as a Welder, but may also implement • Father • Son • Voter • PokerPlayer

  22. Inheritance • A special case of polymorphism in which one class is a specialized type of another class • HourlyEmployee : Employee • SportsCar : Car • TypicalManager : CluelessDolt • When one class inherits from another, it inherits all those properties and methods not declared to be private

  23. Why is OO a big deal? • If you're a programmer, you must know OO • OO gives you, the programmer, better tools for dealing with • changing requirements on current projects • maintaining existing code • team development

  24. But why Java? • So that you'll learn OO right • Once you learn OO, you can then use • CFCs • C#.NET • Visual Basic.NET • Ruby • Eiffel • etc.

  25. Food for thought "Students usually demand to be taught the language that they are most likely to use in the world outside. This is a mistake. A well taught student can easily pick up the languages of the world, and will be in a far better position to recognize their bad features as they encounter them." C. H. Lindsey

  26. To learn more… • Books • Head First Java published by O'Reilly • Java for ColdFusion Developers by Eben Hewitt • Training/Mentoring • Java for ColdFusion Programmers (halhelms.com)

More Related