Tải bản đầy đủ - 0 (trang)
Chapter 1. Introduction to Computers, the Internet and the World Wide Web

Chapter 1. Introduction to Computers, the Internet and the World Wide Web

Tải bản đầy đủ - 0trang

Chapter1.IntroductiontoComputers,

theInternetandtheWorldWideWeb

Ourlifeisfritteredawaybydetail....Simplify,

simplify.

HenryDavidThoreau

Thechiefmeritoflanguageisclearness.

Galen

MyobjectallsublimeIshallachieveintime.

W.S.Gilbert

Hehadawonderfultalentforpackingthoughtclose,

andrenderingitportable.

ThomasB.Macaulay

"Egad,Ithinktheinterpreteristhehardesttobe

understoodofthetwo!"

RichardBrinsleySheridan

Manisstillthemostextraordinarycomputerofall.

JohnF.Kennedy

OBJECTIVES

Inthischapteryouwilllearn:



Basichardwareandsoftwareconcepts.

Basicobjecttechnologyconcepts,suchasclasses,objects,

attributes,behaviors,encapsulation,inheritanceand

polymorphism.

Thedifferenttypesofprogramminglanguages.

Whichprogramminglanguagesaremostwidelyused.

AtypicalJavadevelopmentenvironment.

Java'sroleindevelopingdistributedclient/server

applicationsfortheInternetandtheWeb.

Thehistoryoftheindustry-standardobject-orienteddesign

language,theUML.

ThehistoryoftheInternetandtheWorldWideWeb.

Totest-driveJavaapplications.



[Page2]

Outline

1.1Introduction

1.2WhatIsaComputer?

1.3ComputerOrganization

1.4EarlyOperatingSystems

1.5Personal,DistributedandClient/ServerComputing



1.6TheInternetandtheWorldWideWeb

1.7MachineLanguages,AssemblyLanguagesandHigh-Level

Languages

1.8HistoryofCandC++

1.9HistoryofJava

1.10JavaClassLibraries

1.11FORTRAN,COBOL,PascalandAda

1.12BASIC,VisualBasic,VisualC++,C#and.NET

1.13TypicalJavaDevelopmentEnvironment

1.14NotesaboutJavaandJavaHowtoProgram,SixthEdition

1.15Test-DrivingaJavaApplication

1.16SoftwareEngineeringCaseStudy:IntroductiontoObject

TechnologyandtheUML(Required)

1.17Wrap-Up

1.18WebResources

Summary

Terminology

Self-ReviewExercises

AnswerstoSelf-ReviewExercises

Exercises



[Page2(continued)]



1.1.Introduction

WelcometoJava!Wehaveworkedhardtocreatewhatwehope

youwillfindtobeaninformative,entertainingandchallenging

learningexperience.Javaisapowerfulcomputerprogramming

languagethatisfunfornovicesandappropriateforexperienced

programmerstouseinbuildingsubstantialinformation

systems.JavaHowtoProgram,SixthEdition,isaneffective

learningtoolforeachoftheseaudiences.

Thecoreofthebookemphasizesachievingprogramclarity

throughtheproventechniquesofobject-orientedprogramming.

Nonprogrammerswilllearnprogrammingtherightwayfromthe

beginning.Thepresentationisclear,straightforwardand

abundantlyillustrated.ItincludeshundredsofworkingJava

programsandshowstheoutputsproducedwhenthose

programsarerunonacomputer.WeteachJavafeaturesinthe

contextofcompleteworkingJavaprogramswecallthisthelivecodeapproach.TheexampleprogramsareincludedontheCD

thataccompaniesthisbook,oryoumaydownloadthemfrom

www.deitel.comorwww.prenhall.com/deitel.

Theearlychaptersintroducethefundamentalsofcomputers,

computerprogrammingandtheJavacomputerprogramming

language,providingasolidfoundationforthedeepertreatment

ofJavainthelaterchapters.Experiencedprogrammerstendto

readtheearlychaptersquicklyandfindthetreatmentofJavain

thelaterchaptersrigorousandchallenging.

Mostpeoplearefamiliarwiththeexcitingtaskscomputers

perform.Usingthistext-book,youwilllearnhowtocommand

computerstoperformthosetasks.Itissoftware(i.e.,the

instructionsyouwritetocommandcomputerstoperform

actionsandmakedecisions)thatcontrolscomputers(often

referredtoashardware).Java,developedbySun



Microsystems,isoneoftoday'smostpopularsoftware

developmentlanguages.



[Page3]

ThisbookisbasedonSun'sJava2Platform,Standard

Edition(J2SE).Sunprovidesanimplementationofthis

platform,calledtheJ2SEDevelopmentKit(JDK),that

includestheminimumsetoftoolsyouneedtowritesoftwarein

Java.WeusedJDKversion5.0toimplementandtestthe

programsinthisbook.WhenSunmakestheJDKavailableto

publishers,itwillbewrappedwiththetextbookonthe

accompanyingCD.SunupdatestheJDKonaregularbasisto

fixbugs.TodownloadthemostrecentversionoftheJDK,visit

java.sun.com/j2se.

Computeruseisincreasinginalmosteveryfieldofendeavor.

Computingcostshavebeendecreasingdramaticallydueto

rapiddevelopmentsinbothhardwareandsoftware

technologies.Computersthatmighthavefilledlargeroomsand

costmillionsofdollarstwodecadesagocannowbeinscribedon

siliconchipssmallerthanafingernail,costingperhapsafew

dollarseach.Fortunately,siliconisoneofthemostabundant

materialsonearthitisaningredientincommonsand.Silicon

chiptechnologyhasmadecomputingsoeconomicalthat

hundredsofmillionsofgeneral-purposecomputersareinuse

worldwide,helpingpeopleinbusiness,industryand

government,andintheirpersonallives.Thenumbercould

easilydoubleinthenextfewyears.

Overtheyears,manyprogrammerslearnedtheprogramming

methodologycalledstructuredprogramming.Youwilllearn

structuredprogrammingandanexcitingnewermethodology,

object-orientedprogramming.Whydoweteachboth?

Objectorientationisthekeyprogrammingmethodologyused

byprogrammerstoday.Youwillcreateandworkwithmany

softwareobjectsinthistext.Butyouwilldiscoverthattheir



internalstructureisoftenbuiltusingstructured-programming

techniques.Also,thelogicofmanipulatingobjectsis

occasionallyexpressedwithstructuredprogramming.

Javahasbecomethelanguageofchoiceforimplementing

Internet-basedapplicationsandsoftwarefordevicesthat

communicateoveranetwork.Beforelongthestereoandother

devicesinyourhomewillbenetworkedtogetherbyJava

technology.Don'tbesurprisedwhenyourwirelessdevices,like

cellphones,pagersandpersonaldigitalassistants(PDAs),

begintocommunicateovertheso-calledwirelessInternetvia

thekindofJava-basednetworkingapplicationsthatyouwill

learninthisbookanditscompanion,AdvancedJava2Platform

HowtoProgram.AccordingtoSun'sWebsite(www.sun.com),

in2003,over267millioncellphonesequippedwithJava

technologywereshipped!Javahasevolvedrapidlyintothe

large-scaleapplicationsarena.Itisnolongerusedsimplyto

makeWorldWideWebpagescomealiveithasbecomethe

preferredlanguageformeetingtheenterprise-wide

programmingneedsofmanyorganizations.

JavahasevolvedsorapidlythatthissixtheditionofJavaHow

toProgramhasbeenwrittenjusteightyearsafterthefirst

editionwaspublished.ThiseditionisbasedontheJava2

Platform,StandardEdition(J2SE)version5.0.Javahasgrown

solargethatitnowhastwoothereditions.TheJava2

Platform,EnterpriseEdition(J2EE),isgearedtoward

developinglarge-scale,distributednetworkingapplicationsand

Web-basedapplications.TheJava2Platform,MicroEdition

(J2ME)isgearedtowarddevelopingapplicationsforsmall,

memory-constraineddevices,suchascellphones,pagersand

PDAs.AdvancedJava2PlatformHowtoProgramemphasizes

developingapplicationswithJ2EEandprovidescoverageof

severalhigh-endtopicsfromtheJ2SE.AdvancedJava2

PlatformHowtoProgramalsoincludessubstantialmaterialson

J2MEandwireless-applicationdevelopment.



[Page4]

Youareembarkingonachallengingandrewardingpath.Asyou

proceed,ifyouwouldliketocommunicatewithus,pleasesend

e-mailto

deitel@deitel.com

orbrowseourWebsiteat

www.deitel.com

Wewillrespondpromptly.TokeepuptodatewithJava

developmentsatDeitel&Associates,pleaseregisterforourfree

e-mailnewsletter,TheDeitelBuzzOnline,at

www.deitel.com/newsletter/subscribe.html

WehopethatyouwillenjoylearningwithJavaHowtoProgram.



[Page4(continued)]



1.2.WhatIsaComputer?

Acomputerisadevicecapableofperformingcomputations

andmakinglogicaldecisionsatspeedsmillions(evenbillions)

oftimesfasterthanhumanbeingscan.Forexample,manyof

today'spersonalcomputerscanperformabillionadditionsper

second.Apersonoperatingadeskcalculatorcouldspendan

entirelifetimeperformingcalculationsandstillnotcompleteas

manycalculationsasapowerfulpersonalcomputercanperform

inonesecond.(Pointstoponder:Howwouldyouknowwhether

thepersonaddedthenumberscorrectly?Howwouldyouknow

whetherthecomputeraddedthenumberscorrectly?)Today's

fastestsupercomputerscanperformhundredsofbillionsof

additionspersecond.Andtrillion-instructions-per-second

computersarealreadyfunctioninginresearchlaboratories.

Computersprocessdataunderthecontrolofsetsof

instructionscalledcomputerprograms.Theseprogramsguide

thecomputerthroughorderlysetsofactionsspecifiedbypeople

calledcomputerprogrammers.

Acomputerconsistsofvariousdevicesreferredtoashardware

(e.g.,thekeyboard,screen,mouse,disks,memory,DVD,CDROMandprocessingunits).Theprogramsthatrunona

computerarereferredtoassoftware.Hardwarecostshave

beendecliningdramaticallyinrecentyears,tothepointthat

personalcomputershavebecomeacommodity.Unfortunately,

intheabsenceofsignificantlyimprovedtechnologyforsoftware

development,costshavebeenrisingsteadilyasprogrammers

developevermorepowerfulandcomplexapplications.Inthis

book,youwilllearnprovenmethodologiesthatcanreduce

softwaredevelopmentcostsobject-orientedprogrammingand

(inouroptionalSoftwareEngineeringCaseStudyinChapters

28and10)object-orienteddesign.



[Page4(continued)]



1.3.ComputerOrganization

Regardlessofdifferencesinphysicalappearance,virtuallyevery

computermaybeenvisionedasdividedintosixlogicalunits

orsections:

1. Inputunit.Thisisthe"receiving"sectionofthecomputer.

Itobtainsinformation(dataandcomputerprograms)from

inputdevicesandplacesthisinformationatthedisposalof

theotherunitssothatitcanbeprocessed.Most

informationisenteredintocomputersthroughkeyboards

andmousedevices.Informationalsocanbeenteredin

manyotherways,includingbyspeakingtoyourcomputer,

byscanningimagesandbyhavingyourcomputerreceive

informationfromanetwork,suchastheInternet.



[Page5]

2. Outputunit.Thisisthe"shipping"sectionofthecomputer.

Ittakesinformationthatthecomputerhasprocessedand

placesitonvariousoutputdevicestomakethe

informationavailableforuseoutsidethecomputer.Most

informationoutputfromcomputerstodayisdisplayedon

screens,printedonpaperorusedtocontrolotherdevices.

Computersalsocanoutputtheirinformationtonetworks,

suchastheInternet.

3. Memoryunit.Thisistherapid-access,relativelylowcapacity"warehouse"sectionofthecomputer.Itretains

informationthathasbeenenteredthroughtheinputunit,

sothatitwillbeimmediatelyavailableforprocessingwhen

needed.Thememoryunitalsoretainsprocessed

informationuntilitcanbeplacedonoutputdevicesbythe

outputunit.Informationinthememoryunitistypicallylost



whenthecomputer'spoweristurnedoff.Thememoryunit

isoftencalledeithermemoryorprimarymemory.

4. Arithmeticandlogicunit(ALU).Thisisthe

"manufacturing"sectionofthecomputer.Itisresponsible

forperformingcalculations,suchasaddition,subtraction,

multiplicationanddivision.Itcontainsthedecision

mechanismsthatallowthecomputer,forexample,to

comparetwoitemsfromthememoryunittodetermine

whethertheyareequal.

5. Centralprocessingunit(CPU).Thisisthe

"administrative"sectionofthecomputer.Itcoordinatesand

supervisestheoperationoftheothersections.TheCPUtells

theinputunitwheninformationshouldbereadintothe

memoryunit,tellstheALUwheninformationfromthe

memoryunitshouldbeusedincalculationsandtellsthe

outputunitwhentosendinformationfromthememoryunit

tocertainoutputdevices.Manyoftoday'scomputershave

multipleCPUsand,hence,canperformmanyoperations

simultaneouslysuchcomputersarecalledmultiprocessors.

6. Secondarystorageunit.Thisisthelong-term,highcapacity"warehousing"sectionofthecomputer.Programs

ordatanotactivelybeingusedbytheotherunitsnormally

areplacedonsecondarystoragedevices(e.g.,yourhard

drive)untiltheyareagainneeded,possiblyhours,days,

monthsorevenyearslater.Informationinsecondary

storagetakesmuchlongertoaccessthaninformationin

primarymemory,butthecostperunitofsecondarystorage

ismuchlessthanthatofprimarymemory.Examplesof

secondarystoragedevicesincludeCDsandDVDs,which

canholduptohundredsofmillionsofcharactersand

billionsofcharacters,respectively.



[Page5(continued)]



1.4.EarlyOperatingSystems

Earlycomputerscouldperformonlyonejobortaskatatime.

Thisisoftencalledsingle-userbatchprocessing.The

computerrunsasingleprogramatatimewhileprocessingdata

ingroupsorbatches.Intheseearlysystems,usersgenerally

submittedtheirjobstoacomputercenterondecksofpunched

cardsandoftenhadtowaithoursorevendaysbeforeprintouts

werereturnedtotheirdesks.

Softwaresystemscalledoperatingsystemsweredevelopedto

makeusingcomputersmoreconvenient.Earlyoperating

systemssmoothedandspeededupthetransitionbetweenjobs,

andhenceincreasedtheamountofwork,orthroughput,

computerscouldprocess.

Ascomputersbecamemorepowerful,itbecameevidentthat

single-userbatchprocessingwasinefficient,becausesomuch

timewasspentwaitingforslowinput/outputdevicesto

completetheirtasks.Itwasthoughtthatmanyjobsortasks

couldsharetheresourcesofthecomputertoachievebetter

utilization.Thisiscalledmultiprogramming.

Multiprogramminginvolvesthesimultaneousoperationofmany

jobsthatarecompetingtosharethecomputer'sresources.

Withearlymultiprogrammingoperatingsystems,usersstill

submittedjobsondecksofpunchedcardsandwaitedhoursor

daysforresults.



[Page6]

Inthe1960s,severalgroupsinindustryandtheuniversities

pioneeredtimesharingoperatingsystems.Timesharingisa

specialcaseofmultiprogramminginwhichusersaccessthe

computerthroughterminals,typicallydeviceswithkeyboards



Tài liệu bạn tìm kiếm đã sẵn sàng tải về

Chapter 1. Introduction to Computers, the Internet and the World Wide Web

Tải bản đầy đủ ngay(0 tr)

×