Kap 1 Engelsk

  • Upload
    hoyala

  • View
    225

  • Download
    0

Embed Size (px)

Citation preview

  • 8/9/2019 Kap 1 Engelsk

    1/50

    2008 Pearson Education, Inc. All rights reserved.

    1

    1

    1

    Introduction toComputers and

    the Internet

  • 8/9/2019 Kap 1 Engelsk

    2/50

  • 8/9/2019 Kap 1 Engelsk

    3/50

    2008 Pearson Education, Inc. All rights reserved.

    3

    OBJECTIVESIn this chapter you will learn:

    Basic computing concepts.

    The different types of programminglanguages.

    The evolution of the Internet and the WorldWide Web.

    What Web 2.0 is and why its having suchan impact among Internet-based andtraditional businesses.

    What Rich Internet Applications (RIAs) areand the key software technologies used to

    build RIAs.

  • 8/9/2019 Kap 1 Engelsk

    4/50

    2008 Pearson Education, Inc. All rights reserved.

    4

    1.1 Introduction

    1.2 What Is a Computer?1.3 Computer Organization

    1.4 Machine Languages, Assembly Languages and High-LevelLanguages

    1.5 History of the Internet and World Wide Web1.6 World Wide Web Consortium (W3C)

    1.7 Web 2.0

    1.8 Personal, Distributed and Client/Server Computing

    1.9 Hardware Trends1.10 Key Software Trend: Object Technology

    1.11 JavaScript: Object-Based Scripting for the Web

    1.12 Browser Portability

    1.13 C, C++ and Java1.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

  • 8/9/2019 Kap 1 Engelsk

    5/50

    2008 Pearson Education, Inc. All rights reserved.

    5

    1.1 IntroductionInternet and World Wide Web How to Program: 4/e

    Walkthrough of Web 2.0

    Emphasizes structured programming and object-based

    programming

    Live-code approach

    - All concepts presented in full working program examples

    - Examples available at.

    JavaScript, XHTML and CSS

    - Introduced in earlier chapters

    - Provides solid foundation for computer programming and

    rest of book

  • 8/9/2019 Kap 1 Engelsk

    6/50

    2008 Pearson Education, Inc. All rights reserved.

    6

    1.1 Introduction (Cont.)Software

    Instructions to command the computer to perform actions and make

    decisions)

    JavaScript and PHP are popular software development languages for

    web-based applications.

    Computer development

    Computer use increasing in most fields

    Computer costs and size decreasing

    - Abundance of silicon drives down prices of silicon-chip technology

    Applications of this book

    Prepares for higher learning in C++, Java, C#, Visual Basic.NET as wellas object-oriented programming

    Allows development of applications with graphical user interfaces

    (GUIs)

    - Multimedia capabilities

    - Integration with the Internet and World Wide Web

  • 8/9/2019 Kap 1 Engelsk

    7/50

    2008 Pearson Education, Inc. All rights reserved.

    7

    1.1 Introduction (Cont.)

    Apply database technologies

    Applications that are not limited to the desktop

    Portability

    - Multiple platforms (i.e., different types of computers runningdifferent operating systems).

    Book structure Focus on Web 2.0 and rich Internet applications

    Chapters 1-20- Covers XHTML, JavaScript, Dynamic HTML, Extensible Markup

    Language (XML), CSS, Flash, Flex, Silverlight and Dreamweaver

    - For applications running on client side (typically Mozilla Firefox 2and Microsoft Internet Explorer 7)

    Chapters 21-28- Cover web servers, databases, PHP, Ruby on Rails, ASP.NET,

    ASP.NET Ajax and JavaServer Faces (JSF)

  • 8/9/2019 Kap 1 Engelsk

    8/50

    2008 Pearson Education, Inc. All rights reserved.

    8

    Fig. 1.1 | Architecture of Internet & World Wide Web How to Program, 4/e.

  • 8/9/2019 Kap 1 Engelsk

    9/50

    2008 Pearson Education, Inc. All rights reserved.

    9

    1.2 What is a Computer?Computer

    Device capable of

    - Performing computations

    - Making logical decisions

    Works billions of times faster than human beings

    Fastest supercomputers today

    - Perform hundreds of billions of additions per second

  • 8/9/2019 Kap 1 Engelsk

    10/50

    2008 Pearson Education, Inc. All rights reserved.

    10

    Programs

    Sets of instructions that process data

    Guide computer through orderly sets of actions specified

    by computer programmers

    Computer system

    Comprised of various hardware devices

    - Keyboard

    - Screen

    - Disks- Memory

    - DVD drives

    - Processing Units

    1.2 What is a Computer? (Cont.)

  • 8/9/2019 Kap 1 Engelsk

    11/50

    2008 Pearson Education, Inc. All rights reserved.

    11

    Every computer divided into six units

    1. Input unit

    - Receiving section of computer- Obtains data from input devices

    Usually a keyboard, mouse, disk, scanner, uploads (photosand videos) and networks (Internet)

    - Places data at disposal of other units2. Output unit

    - Shipping section of computer

    - Puts processed info on various output devices

    Screens, paper printouts, speakers

    - Makes info available outside the computer (e.g., Internet)

    1.3 Computer Organization

  • 8/9/2019 Kap 1 Engelsk

    12/50

    2008 Pearson Education, Inc. All rights reserved.

    12

    3. Memory unit

    - Rapid access, low capacity warehouse

    - Retains information entered through input unit- Retains info that has already been processed until can be sent

    to output unit

    - Often called memory, primary memory, or random access

    memory (RAM)

    4. Arithmetic and Logic Unit

    - Manufacturing section of computer

    - Performs calculations (addition, subtraction, multiplicationand division)

    - Contains decision mechanisms and can make comparisons

    1.3 Computer Organization (Cont.)

  • 8/9/2019 Kap 1 Engelsk

    13/50

    2008 Pearson Education, Inc. All rights reserved.

    13

    5. Central Processing Unit (CPU)

    - Administrative section of computer

    - Coordinates and supervises other sections- Multiple CPUs (multiprocessors)

    6. Secondary storage unit

    - Long-term, high-capacity warehouse

    - Stores programs or data not currently being used by other

    units on secondary storage devices (like CDs and DVDs)

    - Takes longer to access than primary memory

    1.3 Computer Organization (Cont.)

  • 8/9/2019 Kap 1 Engelsk

    14/50

    2008 Pearson Education, Inc. All rights reserved.

    14

    1.4 Machine Languages, Assembly

    Languages and High-LevelLanguages

    Three general types of programming languages

    Machine languages

    Assembly languages

    High-level languages

  • 8/9/2019 Kap 1 Engelsk

    15/50

    2008 Pearson Education, Inc. All rights reserved.

    15

    Machine languages

    Natural language of a computer (aka object code)

    Defined by hardware design of computer

    Generally consists of strings of numbers

    Are machine dependent Cumbersome for humans

    - Example: Adding overtime pay to base pay and storing the

    result in gross pay

    Slow and tedious for most programmers

    1.4 Machine Languages, Assembly

    Languages and High-LevelLanguages (Cont.)

  • 8/9/2019 Kap 1 Engelsk

    16/50

    2008 Pearson Education, Inc. All rights reserved.

    16

    Assembly languages Programmers began using English-like abbreviations to

    substitute for machine languages

    Represents elementary operations of computer

    Translator programs called assemblers convert assembly-

    language to machine-language

    Example:

    !# !# !# !#$#$#$#$#

    &%' "#&%' "#&%' "#&%' "#

    1.4 Machine Languages, Assembly

    Languages and High-LevelLanguages (Cont.)

  • 8/9/2019 Kap 1 Engelsk

    17/50

    2008 Pearson Education, Inc. All rights reserved.

    17

    High-level languages Developed as computer usage increased, assembly

    language proved inadequate and time-consuming

    Single statements can be written to accomplish substantial

    tasks

    Translator programs called compilers

    Allow programmers to write instructions almost like

    every-day English Example:

    ()"+,*"+-)&"+()"+,*"+-)&"+()"+,*"+-)&"+()"+,*"+-)&"+

    1.4 Machine Languages, Assembly Languages

    and High-Level Languages (Cont.)

  • 8/9/2019 Kap 1 Engelsk

    18/50

    2008 Pearson Education, Inc. All rights reserved.

    18

    High-level languages (II)

    Much more desirable from programmers standpoint

    Specific languages include

    - C, C++, Visual Basic.NET, C# and Java

    - Among most powerful and widely used languages today

    Interpreter programs developed to execute high-level programswithout compiling

    - Popular in program development environments

    Once program developed, compiled version made

    In this book, several key programming languages

    - JavaScript, ActionScript, PHP and Ruby on Railseach of these

    scripting languages is processed by interpreters

    Study markup languages

    - XHTML and XML, which can be processed by interpreted scriptinglanguages

    - Achieve their goal of portability across a variety of platforms

    1.4 Machine Languages, Assembly Languages

    and High-Level Languages (Cont.)

  • 8/9/2019 Kap 1 Engelsk

    19/50

    2008 Pearson Education, Inc. All rights reserved.

    19

    Performance Tip 1.1

    Interpreters have an advantage overcompilers in scripting. An interpretedprogram can begin executing as soon as it isdownloaded to the clients machine, without

    the need to be compiled before it can execute.On the downside, scripts generally run muchslower than compiled code.

  • 8/9/2019 Kap 1 Engelsk

    20/50

    2008 Pearson Education, Inc. All rights reserved.

    20

    Portability Tip 1.1

    Interpreted languages are more portable thancompiled languages. Interpreters can be

    implemented for each platform on which theinterpreted languages need to execute.

  • 8/9/2019 Kap 1 Engelsk

    21/50

    2008 Pearson Education, Inc. All rights reserved.

    21

    Software Engineering Observation 1.1

    Interpreted languages are more dynamic thancompiled languages. For example, server-sideapplications can generate code in response to

    user interactions, and that code can then beinterpreted in a browser.

  • 8/9/2019 Kap 1 Engelsk

    22/50

    2008 Pearson Education, Inc. All rights reserved.

    22

    1.5 History of the Internet and World

    Wide WebARPANET

    Implemented in late 1960s by ARPA (Advanced Research

    Projects Agency of DOD)

    Networked computer systems of a dozen universities and

    institutions with 56KB communications lines

    Grandparent of todays Internet Intended to allow computers to be shared

    Became clear that key benefit was allowing fast

    communication between researchers electronic-mail

    (email)

  • 8/9/2019 Kap 1 Engelsk

    23/50

    2008 Pearson Education, Inc. All rights reserved.

    23

    1.5 History of the Internet and World

    Wide WebARPAs goals Allow multiple users to send and receive info at same time

    Network operated packet switching technique- Digital data sent in small packages called packets

    - Packets contained data, address info, error-control info and

    sequencing info

    - Greatly reduced transmission costs of dedicatedcommunications lines

    Network designed to be operated without centralized

    control

    - If portion of network fails, remaining portions still able to

    route packets

  • 8/9/2019 Kap 1 Engelsk

    24/50

    2008 Pearson Education, Inc. All rights reserved.

    24

    1.5 History of the Internet and World

    Wide WebTransmission Control Protocol (TCP)

    Name of protocols for communicating over ARPAnet

    Ensured that messages were properly routed and that theyarrived intact

    Organizations implemented own networks

    Used both for intra-organization and communication

    25

  • 8/9/2019 Kap 1 Engelsk

    25/50

    2008 Pearson Education, Inc. All rights reserved.

    25

    1.5 History of the Internet and World

    Wide WebHuge variety of networking hardware and softwareappeared

    ARPA achieved inter-communication between all platformswith development of the IP

    - Internetworking Protocol

    - Current architecture of Internet

    Combined set of protocols called TCP/IP

    The Internet

    Limited to universities and research institutions

    Military became big user

    Next, government decided to access Internet for commercial

    purposes

    26

  • 8/9/2019 Kap 1 Engelsk

    26/50

    2008 Pearson Education, Inc. All rights reserved.

    26

    1.5 History of the Internet and World

    Wide WebInternet traffic grew Businesses spent heavily to improve Internet

    - Better service their clients

    Fierce competition among communications carriers and hardwareand software suppliers

    Resulted in massive bandwidth increase and plummeting costs

    Tim Berners-Lee invents HyperText Markup Language (HTML)

    - Also writes communication protocols to form the backbone newinformation system = World Wide Web

    - Hypertext Transfer Protocol (HTTP)a communications protocol usedto send information over the web

    Web use exploded with availability in 1993 of the Mosaic browser

    Marc Andreessen founds Netscape

    - Company many credit with initiating the explosive Internet of late 1990s.

    27

  • 8/9/2019 Kap 1 Engelsk

    27/50

    2008 Pearson Education, Inc. All rights reserved.

    27

    1.6 World Wide Web Consortium

    (W3C)W3C Founded in 1994 by Tim Berners-Lee

    Homepage at

    Goals Internet universally accessible

    Standardization

    - W3C Recommendations:Technologies standardized by W3C

    include the Extensible HyperText Markup Language(XHTML), Cascading Style Sheets (CSS), HyperTextMarkup Language (HTMLnow considered a legacytechnology) and the Extensible Markup Language(XML).

    not an actual software product, but a document thatspecifies a technologys role, syntax rules and so forth.

    28

  • 8/9/2019 Kap 1 Engelsk

    28/50

    2008 Pearson Education, Inc. All rights reserved.

    28

    1.7 Web 2.0

    2003 noticeable shift in how people and businesses were using the weband developing web-based applications

    The term Web 2.0 was coined by Dale Dougherty of OReilly

    Web 2.0 definition = companies use the web as a platform to createcollaborative, community-based sites (e.g., social networking sites, blogs,wikis, etc.).

    Web 1.0 (1990s and early 2000s) focused on a small number ofcompanies and advertisers producing content for users to access

    brochure web)Web 2.0 involves the

    Web 1.0 is as a lecture,

    Web 2.0 is a conversation

    Websites like MySpace , Facebook , Flickr , YouTube, eBay and

    Wikipedia , users create the content, companies provide theplatforms.

    29

  • 8/9/2019 Kap 1 Engelsk

    29/50

    2008 Pearson Education, Inc. All rights reserved.

    29

    1.7 Web 2.0 (Cont.)

    Architecture of participation

    Open source software

    Collective

    Rich Internet Applications (RIAs)

    Software as a Service (SaaS)

    Web services incorporate functionality fromexisting applications and websites into own web

    applications

    Amazon Web Services

    Maps web services with eBay web services

    30

  • 8/9/2019 Kap 1 Engelsk

    30/50

    2008 Pearson Education, Inc. All rights reserved.

    30

    1.7 Web 2.0 (Cont.)

    Future computers learn to understand the

    meaning of the data on the web = Semantic Web

    Deitel Web 2.0 Resource Center at

    www.deitel.com/web2.0/for more information.

    31

  • 8/9/2019 Kap 1 Engelsk

    31/50

    2008 Pearson Education, Inc. All rights reserved.

    1.8 Personal, Distributed and

    Client/Server Computing1977 Apple Computer popularized personal computing

    Computers became economical for personal or business use

    Machines could be linked together in computer networks

    Local area networks (LANs)

    Distributed computing

    Workstations

    Servers offer data storage and other capabilities that maybe used by client computers distributed throughout thenetwork,

    Client/server computing

    Popular operating systems

    UNIX, Linux, Mac OS X and Microsofts Windows

    32

  • 8/9/2019 Kap 1 Engelsk

    32/50

    2008 Pearson Education, Inc. All rights reserved.

    1.9 Hardware Trends

    Improving technologies

    Internet community thrives on improvements of

    - Hardware, Software and Communications

    Cost of products and services

    - Consistently dropping over the decades

    Computer capacity and speed

    - Doubles every two years (on average) = Moores Law

    Microprocessor chip

    - Laid groundwork in late 1970s 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

    33

  • 8/9/2019 Kap 1 Engelsk

    33/50

    2008 Pearson Education, Inc. All rights reserved.

    1.10 The Key Software Trend:

    Object Technology

    Objects

    Reusable software components that model items in the real

    world (classes)

    Makes software developers more productive

    Object-oriented programs often easier to understand,correct and modify than older types of programs

    34

    1 10 Th K S ft T d

  • 8/9/2019 Kap 1 Engelsk

    34/50

    2008 Pearson Education, Inc. All rights reserved.

    1.10 The Key Software Trend:

    Object Technology (Cont.)Object technology

    Packaging scheme that helps create meaningful software

    units- Large and highly focused on particular applications areas

    Before appeared, programming languages were focused on

    actions (verbs) rather than on objects (nouns)

    - Programmers would program primarily with verbs

    - Made program awkward

    - We live in a world filled with complex objects and simple

    actions

    35

    1 10 The Key Software Trend:

  • 8/9/2019 Kap 1 Engelsk

    35/50

    2008 Pearson Education, Inc. All rights reserved.

    1.10 The Key Software Trend:

    Object Technology (Cont.)Object technology (continued)

    Object-oriented programming

    - Programmers work in manner similar to how they see theworld

    - More natural process

    - Significant productivity enhancements

    Procedural programming- Not particularly reusable

    - Forces programmers to constantly re-invent the wheel

    Wastes time and resources

    Objects (classes)- Software modules

    - Kept in libraries

    - Reusable save time and resources

    36

  • 8/9/2019 Kap 1 Engelsk

    36/50

    2008 Pearson Education, Inc. All rights reserved.

    Software Engineering Observation 1.2

    Extensive class libraries of reusable softwarecomponents are available on the Internet.

    Many of these libraries are free.

    37

  • 8/9/2019 Kap 1 Engelsk

    37/50

    2008 Pearson Education, Inc. All rights reserved.

    Software Engineering Observation 1.3

    Some organizations report that the key benefit

    object-oriented programming gives them is notsoftware that is reusable but, rather, softwarethat is more understandable, better organizedand easier to maintain, modify and debug. This

    can be significant, because perhaps as much as 80percent of software cost is associated not with theoriginal efforts to develop the software, but with

    the continued evolution and maintenance of thatsoftware throughout its lifetime.

    38

    1 11 JavaScript: Object Based

  • 8/9/2019 Kap 1 Engelsk

    38/50

    2008 Pearson Education, Inc. All rights reserved.

    1.11 JavaScript: Object-Based

    Scripting for the WebJavaScript Attractive package for advancing level of programming language

    education

    Object-based language Supports proper software engineering techniques

    Free as part of todays most popular Web browsers

    Powerful scripting language

    - Portable- Programs execute interpretively on client machines

    ActionScript and JavaScript are converging in the nextversion of the JavaScript standard (JavaScript 2/ECMAScript version 4)

    - Universal client scripting language, simplifying webapplication development

    39

  • 8/9/2019 Kap 1 Engelsk

    39/50

    2008 Pearson Education, Inc. All rights reserved.

    Good Programming Practice 1.1

    Write your programs in a simple andstraightforward manner. This is sometimesreferred to as KIS (keep it simple). One keyaspect of keeping it simple is anotherinterpretation of KISkeep it small. Do notstretch the language by trying bizarre us-es.

    40

  • 8/9/2019 Kap 1 Engelsk

    40/50

    2008 Pearson Education, Inc. All rights reserved.

    Portability Tip 1.2

    Although it is easier to write portable

    programs in JavaScript than in many otherprogramming languages, differences amonginterpreters and browsers make portability

    difficult to achieve. Simply writing programsin JavaScript does not guarantee portability.Programmers occasionally need to researchplatform variations and write their code

    accordingly.

    41

  • 8/9/2019 Kap 1 Engelsk

    41/50

    2008 Pearson Education, Inc. All rights reserved.

    Portability Tip 1.3

    When writing JavaScript programs, you need

    to deal directly with cross-browser portabilityissues. Such issues are hidden by JavaScriptlibraries (e.g., Dojo, Prototype, Script.aculo.usand ASP.NET Ajax) which provide powerful,ready-to-use capabilities that simplifyJavaScript coding by making it cross-browsercompatible.

    42

  • 8/9/2019 Kap 1 Engelsk

    42/50

    2008 Pearson Education, Inc. All rights reserved.

    Error-Prevention Tip 1.1

    Always test your JavaScript programs on allsystems and in all web browsers for which

    they are intended.

    43

  • 8/9/2019 Kap 1 Engelsk

    43/50

    2008 Pearson Education, Inc. All rights reserved.

    Good Programming Practice 1.2

    Read the documentation for the JavaScriptversion you are using to access JavaScripts

    rich collection of features.

    44

  • 8/9/2019 Kap 1 Engelsk

    44/50

    2008 Pearson Education, Inc. All rights reserved.

    Error-Prevention Tip 1.2

    Your computer and JavaScript interpreterare good teachers. If you are not sure how afeature works, even after studying thedocumentation, experiment and see whathappens. Study each error or warningmessage and adjust the code accordingly.

    45

    1 12 B P bili

  • 8/9/2019 Kap 1 Engelsk

    45/50

    2008 Pearson Education, Inc. All rights reserved.

    1.12 Browser Portability

    Browser portability

    Great challenge

    - Great diversity of client browsers in use- Many different platforms also in use

    Difficult to

    Know capabilities and features of all browsers andplatforms in use

    Find correct mix between absolute portability, complexity

    and usability of features

    46

  • 8/9/2019 Kap 1 Engelsk

    46/50

    2008 Pearson Education, Inc. All rights reserved.

    Portability Tip 1.4

    The web is populated with many differentbrowsers, which makes it difficult for authorsand web application developers to createuniversal solutions. The W3C is workingtoward the goal of a universal client-sideplatform.

    47

    1 13 C C d J

  • 8/9/2019 Kap 1 Engelsk

    47/50

    2008 Pearson Education, Inc. All rights reserved.

    1.13 C, C++ and Java

    C

    developed by Dennis Ritchie at Bell Laboratories

    development language of the UNIX operating system

    virtually all new major operating systems are written in C and/or C++

    C++ developed by Bjarne Stroustrup in early 1980s

    spruce up the C language and provides capabilities for object-orientedprogramming

    Java

    developed by Sun Microsystems in 1991

    Sun saw the immediate potential of using Java to add dynamic content (e.g.,interactivity, animations and the like) to web pages

    Sun formally announced Java at an industry conference in May 1995

    Java is now used to- develop large-scale enterprise applications

    - enhance the functionality of web servers- provide applications for consumer devices

    48

    1.14 BASIC, Visual Basic, Visual C++, C#

  • 8/9/2019 Kap 1 Engelsk

    48/50

    2008 Pearson Education, Inc. All rights reserved.

    1.14 BASIC, Visual Basic, Visual C++, C#and .NET

    BASIC

    Developed in the mid-1960s at Dartmouth College

    Primary purpose was to familiarize novices with programming

    techniquesMicrosofts Visual Basic language

    Based on Basic

    Has become one of the most popular programming languages in theworld

    Microsofts .NET platform

    Provides the capabilities developers need to create computerapplications that can execute on computers distributed across theInternet

    - Visual Basic (based on the original BASIC)- Visual C++ (based on C++)

    - Visual C# (based on C++ and Java)

    49

    1 15 Software Technologies

  • 8/9/2019 Kap 1 Engelsk

    49/50

    2008 Pearson Education, Inc. All rights reserved.

    1.15 Software Technologies

    Agile Software Development

    Set of methodologies that try to get software implementedquickly

    Agile Alliance (www.agilealliance.org)

    Agile Manifesto (www.agilemanifesto.org)

    Refactoring

    Reworking code to make it clearer and easier to maintain whilepreserving its

    Design patterns

    Proven architectures for constructing flexible and maintainableobject-oriented software

    Open source code

    50

    1 15 Software Technologies (Cont )

  • 8/9/2019 Kap 1 Engelsk

    50/50

    2008 Pearson Education, Inc. All rights reserved.

    1.15 Software Technologies (Cont.)

    Linux Open source operating system

    Apache Most popular open source web server

    MySQL Open source database management system

    PHP Most popular open source server-side scripting language for developing Internet-based

    applications

    LAMP Linux, Apache, MySQL and PHP (or Perl or Python)

    Game programming Software techniques used in game programming Adobe Flash CS3

    Ruby on Rails Combines the scripting language Ruby with the Rails web application framework

    Developed by 37Signals

    Software as a Service (SaaS) Software runs on servers elsewhere on the Internet

    - Salesforce.com, Google, Microsoft and 37Signals all offer SaaS