Podstrony
- Strona startowa
- Anne McCaffrey Smocze werble (2)
- Auel Jean M Rzeka powrotu (SCAN dal 948)
- Eco Umberto Wachadlo Foucaulta (SCAN dal 82
- Dziennik Trojkowej Bridget Jones czyli Brygidy Janoskiej red H Gizy
- Rutkowski Hipoteza frazy przedimkowej
- Grisham John Malowany Dom (2)
- Sonny Hassell & Ais Interludes (#3)
- Alex Joe Gdzie przykazan brak dziesieciu (2)
- Sandemo Margit Saga o Czarnoksiazniku Tom 6
- Roger Lancelyn Green Mity Skandynawskie (2)
- zanotowane.pl
- doc.pisz.pl
- pdf.pisz.pl
- black-velvet.pev.pl
[ Pobierz całość w formacie PDF ]
.(You llhave your hands full dealing with the Web issues already.)60 Thinking in Java www.BruceEckel.comJavaIf a scripting language can solve 80 percent of the client-side programming problems, whatabout the other 20 percent the really hard stuff? The most popular solution today isJava.Not only is it a powerful programming language built to be secure, cross-platform andinternational, but Java is being continuously extended to provide language features andlibraries that elegantly handle problems that are difficult in traditional programminglanguages, such as multithreading, database access, network programming and distributedcomputing.Java allows client-side programming via the applet.An applet is a mini-program that will run only under a Web browser.The applet isdownloaded automatically as part of a Web page (just as, for example, a graphic isautomatically downloaded).When the applet is activated it executes a program.This is partof its beauty it provides you with a way to automatically distribute the client softwarefrom the server at the time the user needs the client software, and no sooner.They get thelatest version of the client software without fail and without difficult re-installation.Becauseof the way Java is designed, the programmer needs to create only a single program, and thatprogram automatically works with all computers that have browsers with built-in Javainterpreters.(This safely includes the vast majority of machines.) Since Java is a full-fledgedprogramming language, you can do as much work as possible on the client before and aftermaking requests of the server.For example, you won t need to send a request form acrossthe Internet to discover that you ve gotten a date or some other parameter wrong, and yourclient computer can quickly do the work of plotting data instead of waiting for the server tomake a plot and ship a graphic image back to you.Not only do you get the immediate winof speed and responsiveness, but the general network traffic and load upon servers can bereduced, preventing the entire Internet from slowing down.One advantage a Java applet has over a scripted program is that it s in compiled form, so thesource code isn t available to the client.On the other hand, a Java applet can be decompiledwithout too much trouble, and hiding your code is often not an important issue anyway.Two other factors can be important.As you will see later in the book, a compiled Java appletcan comprise many modules and take multiple server hits (accesses) to download.(In Java1.1 this is minimized by Java archives, called JAR files, that allow all the required modulesto be packaged together for a single download.) A scripted program will just be integratedinto the Web page as part of its text (and will generally be smaller and reduce server hits).This could be important to the responsiveness of your Web site.Another factor is the all-important learning curve.Regardless of what you ve heard, Java is not a trivial language tolearn.If you re a Visual Basic programmer, moving to VBScript will be your fastest solutionand since it will probably solve most typical client/server problems you might be hardpressed to justify learning Java.If you re experienced with a scripting language you willcertainly benefit from looking at JavaScript or VBScript before committing to Java, sincethey might fit your needs handily and you ll be more productive sooner.ActiveXTo some degree, the competitor to Java is Microsoft s ActiveX, although it takes a completelydifferent approach.ActiveX is originally a Windows-only solution, although it is now beingdeveloped via an independent consortium to become cross-platform.Effectively, ActiveX says if your program connects to its environment just so, it can be dropped into a Web page andrun under a browser that supports ActiveX. (IE directly supports ActiveX and Netscape doesso using a plug-in.) Thus, ActiveX does not constrain you to a particular language.If, forexample, you re already an experienced Windows programmer using a language such asC++, Visual Basic, or Borland s Delphi, you can create ActiveX components with almost noChapter 1: Introduction to Objects 61changes to your programming knowledge.ActiveX also provides a path for the use of legacycode in your Web pages.SecurityAutomatically downloading and running programs across the Internet can sound like avirus-builder s dream.ActiveX especially brings up the thorny issue of security in client-sideprogramming.If you click on a Web site, you might automatically download any number ofthings along with the HTML page: GIF files, script code, compiled Java code, and ActiveXcomponents.Some of these are benign; GIF files can t do any harm, and scripting languagesare generally limited in what they can do.Java was also designed to run its applets within a sandbox of safety, which prevents it from writing to disk or accessing memory outside thesandbox.ActiveX is at the opposite end of the spectrum.Programming with ActiveX is likeprogramming Windows you can do anything you want.So if you click on a page thatdownloads an ActiveX component, that component might cause damage to the files on yourdisk.Of course, programs that you load onto your computer that are not restricted torunning inside a Web browser can do the same thing.Viruses downloaded from Bulletin-Board Systems (BBSs) have long been a problem, but the speed of the Internet amplifies thedifficulty.The solution seems to be digital signatures, whereby code is verified to show who theauthor is.This is based on the idea that a virus works because its creator can be anonymous,so if you remove the anonymity individuals will be forced to be responsible for their actions
[ Pobierz całość w formacie PDF ]