Hardware / Software Trends and Programming (In Chapter 1)
Total Page:16
File Type:pdf, Size:1020Kb
Internet & World Wide Web: How to Program by Deitel and Deitel Hardware / Software Trends and Programming (in Chapter 1) 1/19/2011 1 OBJECTIVES . In this chapter you will learn about: – basic computing concepts. – the different types of programming languages. – the evolution of the Internet and the World Wide Web. – what Web 2.0 is and why it’s having such an impact among Internet-based and traditional businesses. – what Rich Internet Applications (RIAs) are and the key software technologies used to build RIAs. 2 Chapter 1 Sections . 1.8 Personal, Distributed and Client/Server Computing . 1.9 Hardware Trends . 1.10 Key Software Trend: Object Technology . 1.11 JavaScript: Object-Based Scripting for the Web . 1.12 Browser Portability . 1131.13 C, C++ and Java . 1.14 BASIC, Visual Basic, Visual C++, C# and .NET . 1.15 Software Technologies . 1.16 Notes about Internet & World Wide Web How to Program, 4/e . 1.17 Web Resources 3 1 Personal, Distributed and Client/Server Computing . Personal Computing – 1977 Apple Computer popularized personal computing – computers became economical for personal or desktop business use – 1981 IBM PC . Distributed Comppguting – workstations could be linked together in computer networks (late 1980s) – Local area networks (LANs) . Client/Server Computing – servers offer data storage and other capabilities that may be used by client computers distributed throughout the network, – popular operating systems for C/S • UNIX, Linux, Mac OS X and Microsoft’s Windows 4 Hardware Trends . Cost of products and services – consistently dropping over the decades . Computer capacity and speed – doubles every two years (on average) » Moore’s Law . Microprocessor chip – laid groundwork in late 197 0s and 1980s for productivity improvements of the 1990s – hardware moving toward mobile, wireless technology • hand-held devices more powerful than early supercomputers • portability • wireless data-transfer speeds 5 Key Software Trend: Object Technology . Objects – reusable software components that model items in the real world (classes) – makes software developers more productive – do not have to “reinvent the wheel” – object-oriented programs often easier to understand, correct and modify than older types of programs 6 2 Key Software Trend: Object Technology (cont.) . Packaging scheme that helps create meaningful software units – large and highly focused on particular applications areas . Before object technology, programming languages focused on actions (verbs) rather than on objects (nouns) – programmers programmed (wrote code) primarily with verbs – made programs awkward, hard to read – the real world is filled with complex objects and simple actions 7 Key Software Trend: Object Technology (cont.) . Object-oriented programming – programmers work in ways that complement how they see the world – more natural process – significant productivity enhancements . Procedural programming – code was not particularly reusable – forced programmers to constantly “reinvent the wheel” – waste of time and resources . Objects (classes) – software modules – kept in libraries (electronic) – reusable – save time and resources 8 Objects . Have attributes – properties – characteristics – color,,,p,g size, shape, weight . Exhibit behaviors – operations – a ball rolls – a balloon deflates – a baby cries 9 3 Object Classification . Observe object behaviors . Study object attributes . Group objects with similar attributes, behaviors . Compare objects chimpanzees adult human baby lizard 10 Object-Oriented Software Design . OOD . Model software in terms similar to those used to describe real-world objects . Classes of objects have similar characteristics – cars, trucks, little red wagons, roller skates all have wheels – class convertible is a subclass of the class automobile 11 Objects Interact . People objects send information to other people objects by talking . A bank account object send a message to another object that an account has a negative balance 12 4 OOD . Encapsulates: ties together an object’s attributes and behaviors . Hides Information: The way properties or operations are implemented are hidden from a user of the object (a developer is a user of the object when she uses it in a section of code) . Interface: The means by which the object communicates with users of the object 13 Object-oriented vs. Procedural . VB.NET is object-oriented . C is procedural . Object-oriented programming: Programming in an object-oriented language – fundamental unit is the class – a class has properties and methods . Procedural programming: action oriented programming where actions are defined by procedures . Fundamental unit is the function or procedure 14 Classes, Fields, Methods . Class is a user-defined type – contains data • attributes, properties, fields – contains methods that manipulate data . Classes can be associated with other classes – relationships 15 5 Component . Software . Group of related classes . Reusable – employ it in multiple applications 16 Object-oriented Analysis and Design Process . Requirements – what is the system supposed to do? . Specification – how will the system do what it’s supposed to do? . Pseudocode: informal textual description of program flow and logic – OK for small programs/systems . Systems analysis and design software 17 Unified Modeling Language . UML . Most widely used graphical representation for modeling object-oriented systems . Ex tens ible: can be en hance d w ith new features . Independent of OOAD process used . A feature-rich graphical language 18 6 Software Engineering Observations Extensive class libraries of reusable software components are available on the Internet. Many of these libraries are free. Some organizations report that the key benefit object- oriented programming gives them is not software that is reusable but, rather, software that is more understandable, better organized and easier to maintain, modify and debug. This can be significant, because perhaps as much as 80 percent of software cost is associated not with the original efforts to develop the software, but with the continued evolution and maintenance of that software throughout its lifetime. 19 Software Engineering Observation . Reuse of existing classes when building new classes and programs saves time, money and effort. Reuse also he lps programmers bu ild more reliable and effective systems, because existing classes and components often have gone through extensive testing, debugging and performance tuning. 20 JavaScript . Offers object-based scripting for the Web . Attractive language for advancing one’s level of programming skill – object-based language – supports proper software engineering techniques – free for download – interppyppreter built into today’s most popular Web browsers – powerful scripting language • portable • programs execute interpretively on client machines when run through a browser – ActionScript and JavaScript are converging in the next version of the JavaScript standard (JavaScript 2/ECMA Script version 4) – universal client scripting language – simplifies web application development 21 7 What is Ecma? . Ecma International is an industry association founded in 1961 and dedicated to the standardization of Information and Communication Technology (ICT) and Consumer Electronics (CE) . Prior to 1994 it was known as ECMA - European Computer Manufacturers Association . www.ecma-international.org/ . Microsoft instrumental in the standardization of JavaScript by ECMA 22 Ready or not … Programming 23 Good Programming Practice Write your programs in a simple and straightforward manner. This is sometimes referred to as KIS (“keep it simple”). One key aspect of keeping it simple is another interpretation of KIS — “keep it small.” 24 8 Portability Tips It is easier to write portable programs in JavaScript than in many other programming languages. However, differences among interpreters and browsers make portability difficult to achieve. Simply writing programs in JavaScript does not guarantee portability. Research platform variations and write code accordingly. 25 Portability Tips When writing JavaScript programs, you need to deal directly with cross- browser portability issues. Such issues are hidden by Java Scr ip t librar ies (e.g., Dojo, Prototype, Script.aculo.us and ASP.NET Ajax). These libraries provide powerful, ready-to-use capabilities that simplify JavaScript coding, making it cross-browser 26 compatible. Error-Prevention Tips Always test your JavaScript programs on all sys tems an d in a ll we b browsers for which they are intended. 27 9 Good Programming Practice Read the documentation for the JSitiJavaScript version you are us iting to access JavaScript’s rich collection of features. 28 Error-Prevention Tips Your computer and JavaScript interpreter are good teachers. If you are not sure how a feature works, even after studying the documentation, experiment and see what happens. Study each error or warning message and adjust the code accordingly. 29 Portability of Programs Across Browsers . A great challenge – much diversity of client browsers in use – many different platforms in use . Difficu lt to – know capabilities and features of all browsers and platforms in use – find correct mix between absolute portability, complexity and usability of features 30 10 Portability Tips The web is populated with many different browsers, which makes it difficult for authors and web application developers to create universal solutions. The W3C is working toward the goal of a universal client-side platform. 31 Here