Home > Article > Accessible Objected Oriented Programming Concepts for Blind Students

Accessible Objected Oriented Programming Concepts for Blind Students

C:\ Program Files Java\ jdk17 o\binas shown in the installation instructionsdon't have any experience with Windows 7 yet, so I don't have any hints regarding windows 7 I don'thave any experience with any Linux version Therefore, I dont have any hints to offer there either1 423 The jdk documentationIt is very difficult to program in Java without access to the documentation for the JDkSeveral different types of Jadocumentationvailable online athttp://wwworaclecom/technetwork/java/javase/documentation/indexhtmlSpecific documentation for classesethods etc for jDk 7 is available online athttp://downloadoraclecom/javase/7/docs/api/Similar documentation for JDK 6 is available athttp://downloadoraclecom/javase/6/docs/apiIt is also possible to download the documentation and install it locally if you have room on yourhttp://wwworaclecom/technetwork/java/javase/downloads/indexhtm/lealsoshownonthepageatdisk The download links for JDK 6 and jDK 7 documentati43 Compiling and running Java codeThere are a varf ways to compile and run Java code The way that I will describe here is the mostbasic and, in my opinion, the most reliable

These instructions apply to a windows operating system If youare using a different operating system, you will need to translate the instructions to your operating systemby using your text editor to write your Java program into one or more text files, each with anwa(Files of this type are often referred to as source code filesthe source code files inhich nowhere on your disk Make sure that the name of thentaining thel learn about in a future modulele in which that class is(except for the extension of java on the file name, which does notn the class name1 432 Create a batch fileUse your text editor to create a batch file (or whatever the equivalent is for your operating system)containingthe text shown in Listing 1(p 5)(with the modifications discussed below) and store it in the same folderas your Java source code filesThen execute the batch file, which in turn will execute the program if there are no compilation errorsListing 11: Windows batch filedel * classjajava/javase/documentation/index htmlhttp://downloadoraclecom/javase/6/dejava/javase/downloads /index htmlAvailableforfreeatConnexions

CHAPTER 1 GETTING STARTEDpauseComments regarding the batch fileThe commands in the batch file of Listing 1 (p 5)willfor the folder containing the batch fileelete all of the compiled class files from the folder (If the folder doesnt contain any class files, thisill be indicated on the command-line screenAttempt to compile the program in the file naned hello javaAttempt to run the compiled program using a compiled Java file named hello classPause and wait for you to dismiss the command-line screen by pressing a key on the key boardIfthey will be reported on the command-line screen and the program won't be executedIf your program is named something other than hello ,(which it typically would be) substitute thenew name for the word hello where ite in the batch fileDon’tdethecommandThe pausethed-line window to stay on the screen until you dismiss it bypressing a key on the keyboard You will need to examine the contents of the window if therewhenttempt to compile and run your program, so don't delete the pause commandher operating systemThe format of the batch file in Listing 1(p 5)is a Windows format If yousing a differentperating system, you will need to translate the information in Listing 1(p 5) into the correct format for14

33 A test programThe test program in Listing 2(p 6)can be used to confirm that java is properly installed on your computerand that you can successfully compile and execute Java programsListing 12: A test programclass hellopublic static void main(StringL] argsSystem out println("Hello World")InstructiCopy the code shown in Listing 2(p, 6) into a text file named hello java and store in an empty folderCreate a batch file named hello, bat containing the text shown in Listing 1(p 5) and store that filethe same folder as the file named hello javaIf everything is working, a command-line screen should open and display the following textHello worldPress any key to continueCongratulatIf that happens, you have just written, compiled and executed your first Java prograAvailableforfreeatConnexions

If thathappen, you need to go back to the installation instructions and see if you can determinet properly installedor message similar to the following, that probably means that you didnt set the pathis not recognizedinternalexternal commandparable program or batch filBeyond that, I cant provide much advice in the way of troubleshooting hints15 Resourceswill publish a module containing consolidated linksConnexions web page and willupdate and add to the list as additional modules in this collection16 MiscThis section contains a variety of miscellaneous informationEGetting StartedRevised: 08/18/1object-oriented programmingaccessibleaccessibilityblindscreen readerrefreshable Braille displayOTE: Disclaimers: Financial: Although the Connexions site makes it possible for you todownload a PDF file for this module at no charge, and also makes it possible for you to purchase apre-printed version of the PDF file, you should be aware that some of the HTML elements in tmodule may not translate well into pdealso want you to know that I receive no financial compensation from the Connexions website everyou purchase the PDF version of the module

Affiliation I am a professor of Computer Information Technology at Austin Community Collegein Austin, TXAvailableforfreeatConnexions


GETTING STARTEDAvailableforfreeatConnexions

Chapter 2a Gentle introduction to javaProgramming21 Table of contentsPreface(p 9)isites(p 10)Figures(p 10)Supplemental material(p 10)d sample code(p 10)Introduction (p 10)Checkout counter example(p 11)Sample program (p, 14)Run them(p15)Resources(p 15)Miscellaneous(p 15)2

2 Preface221 GeneralThis module is part of a collection of modules designed to make object-oriented programming conceptsaccessible to blind studentsSeehttp://cnxorg/content/col11349/latest/-forthege of the collection Ifthere is a Table of contents on the left, side ofge I'm not sure how your screen readerwill treat that Table of Contents relative to the other partsThis module provides a gentle introduction to Java programming in a format that is accessible to blindavailableonlineat

CHAPTER 2 A GENTLE INTRODUCTION TO JAVA PROGRAMMING222 PrerequisitesIn addition to an Internet connection and a browser, you will need the following tools (as a minimum)toAn audio screen reader that is compatible with your operating system, such as the Nonvisual DesktopAccessprogram(nvda),whichisfreelyavailableathttp://wwwnvda-projectorg/A refreshable Braille display capable of providing a line by line tactile output of information displayednthecomputermonitorisrecommendedhttp://wwwuseritecom/ecampus/lessonl/toolsphp)TheSun/oracleJavaDevelopmentKit(jDK)(sEehttp://wwworaclecom/technetwork/java/javase/downloads/indexDocumentatifor the SJava Development Kit (JDKhttp://downloadoracleA simple IDE or text editor for useJava codeThe minimum prerequisites for understanding the material in these modules includAn understanding of algebraAn understanding of all of the material covered in the earlier modules in this collection223 Viewing tiprecommend that you open another copy of this document in a separate browser wiand use thefollowing links to easily find and view the figures and listings while you are reading about them2231 FiguresFigure 1(p

12),A checkout counter algorithm2232 ListingListing 1(p 14) Program named MemoryOlListing 2(p 14), Batch file for Memory01224 Supplemental materialrecommend that you also study the other lessons in my extensive collection of online programming tutorialsYouwillfindaconsolidatedindexatwwwDickbaldwincom23 Discussion and sample code231 Introductioall data is storedComputer programs do what they do by executing a seriesof calculations on numeric data It is the order and the pattern of those calculations that distinguishes onecomputer program from anotherThttp://wwwdickbaldwincom/tochtmAvailableforfreeatConnexions

Avoiding the detailed workFortunately, when we program using a high-level programming language such as Java, much of theetailed work is done for us behindMusicians or conductorsAs programmers, we are more like conductors than musicians The various parts of the computer representthe musicians We tell them what to play, and when to play it, and if we do our job well, we produce ato a pi232 Compartmentse computer program performs its calculations in the correct order, it is oftenry for it to storetermediate results someplacehen come back and get them to use them in subsequent calculatThe intermediate results are stored in memory, often referred to as RAM or Random Access MemoryA mechanical analogyWe can think of random access memory as being analogous to a metal rack containing a large number ofcompartments The compartments are all the same size and are arranged in a column Each compartmentcompartment also has a little slot, into which you can insert a name or a label for the compartment, No4%has a numeric address printed above it No two compartments have the same numeric address

Eartments can hheJoe, the computer programThink of yourself as a computer prograhave the ability to write values on little slips of paper andto put them into the compartments You also have the ability to read the values written on the little sliof paper and to use those values for some purpose However, there are two rules that you

must observeYou may not remove a slip of paper from a compartment without replacing it by another slip of paperon which you have written a valueYou may not put a slip of paper in a compartment without removing the one already there233 Checkout counter exampleIn understanding how you might behave as a human computer program, consider yourself to have a jobworking at the checkout, counter of a small grocery store in the 1930sA mechanical adding machinehe rack of compartments described aboveInitializationof the grocery store tells you to insert a naace a little slip of paper with a number written on it inside each compartment (In programmingld refer to this as initializationEach of the names on the compartments represents a type of grocery such asBeansNo tycompartment is allowed to have more than one slip of paper insideThe price of a can of beansAvailableforfreeatConnexions

Accessible Objected-OrientedProgramming Concepts for Blind StudentsRichard baldwinOnline

org/content/col11349/17/>CONNEⅩIoNSce University, Houston, Texas

content as a collection is copyrighted by Richard Baldwin It is licensed under theCreative Commons Attribution(http://creativecommons

org/licenses/by/30/)Collection structure revised: January 17, 2013PDF generated: January 17, 2013For copyright and attribution information for the modules contained in this collection,

able of contentsA GentlStartedIntroductionIntroductioMethods in java5 Java Data TypesIndexAttributions



Chapter 1Getting started1 Table of contentsPreface(p 1)Prerequisites( 2)Viewing tip(p 2)Listings(p 2)Supplemental material( 3)Discussion(p 3)Accessibility is the key word (p 3)MIDI sound (p 3)Writing, compiling, and running Java programs(p 4)Writing Java code(p

4)Preparing to compile and run Java code(p 4)Downloading the java development kit (JDK)( 4)The JDK documentation (p 5)Compiling and running Java code(p 5)Create a batch file ( 5)A test, progranResources(p 7)Miscellaneous(p 7)2 PrefaceThis module is part of a collection of modules designed to make object-oriented programming conceptsThis content is available onorg/content/m40791AvailableforfreeatConnexions

CHAPTER 1 GETTING STARTEDBlind students should not be excluded from computer programmingbecause of inaccessible text-books Because of its text-based nature, computer programming is fundamentally an accessible technologyHowever, many text books adopt and use high-level integrated development environments with graphical userinterfaces that greatly reduce that accessibilityThe modules in this collection present object-oriented programming concepts in a format that blindstudents can read using tools such as an audio screen reader and an electronic line-by line Braille displaythat provide sensory feedbac the student's interest, these modules make heavy use of programming projectsIn an effort to get andhigh school or college object-oriented programmingSeehttp://cnxorg/content/collof the collection Ifmain page, there is a Table of cs on the left, side of the page I' m not sure how your screen readerwill treat that Table of Contents relative to the other parts of the pageThis module explains how to get started programming in Java in a format that is accessible to blind122 PrerequisitesIn addition to an Internet connection and a browser, you will need the following tools (as a minimum)towork through the exercises in these modulesAn audio screen reader that is compatible with your operating system, such as the Nonvisual DesktopAccessprogram(nvda),whichisfreelyavailableathttpA refreshable Braille display capable of providing a line by line tactile output of informnthecomputermonitorisrecommendedhttp://wwwuseriteTheSun/oracleJavaDevelopmentKit(jDK)(sEehttp://wwworacle,com/technetwork/javadownloads/index(JDK)http://downloadoraclecom/javase/7/docs/api/b)A simple IDE or text editor for use in writing Java codeTheuisites for understanding the material in these modules include:g of all of the material covered in the earlier modules in this collection1

23 Viewing tipI recommend that you open another copy of this document in a separate browser window and use thefollowing links to easily find and view the listings while you are reading about them1231 ListingsListing 1(p 5) Windows batch fileListing 2shttp://cnxorg11349/latest/oracle com/technetwork/java/javase/downloads/index htmlhttp://downloadoraclecom/javase/7/docs/apiAvailableforfreeatConnexions

24 Supplemental materiarecommend that you also study the other lessons in my extensive collection of online programming tutorialsYouwillfindaconsolidatedindexatwwwDickbaldwincom13 DiscussionConsidering that, during the past fifteen yearspublished several hundred online programming tutorials(seehttp://wwwdickbaldwincom/tochtmmight wonder why I am taking the time and expendingthe effort to publish still another online progng tutorial131 Accessibility is the keywordWhen writing and publishing the earlier tutorials, I made no attempt, to make them accessible to blindstudents Some of themrobbyible, simply because I used a relatively simple HTML format andany inaccessible content such as images Howeverf the earlier tutorials nake heayse of images and will therefore be inaccessible to blind studentsIn writing this collection of modules(tutorials), I will make a concentrated effort to make thenaccessible to blind studentsSome of the earlier tutorials that include images do so because the purpose of the tutorial was to teachhow to manipulate graphic imagesOther tutorials, however, included images in sample programs simply as a way to provide sensory feedbackto the students and give them a feeling of accomplishment I believe that providing sensory feedback in samplerograms makes the process of learning how to program more interesting for the students13

2 Sound and musicIn this collection of modules, I will use sound instead of images tosensory feedback1321 Sampled soundIn sone cases the sound will be of a form that, is often referred to as三二d, In sampled soundthe actual waveform of the sound is sampled as a series of numeric valuack time those numericalvalues are applied in sequence to a device that reproduces the originaland feeds that, waveform tamplifiers, speakers, etc This is the type of sound that is commonlya music CD1322 MIDI soundes, i will use midi sound pronouncedigital interface MiDI is a standard adopted bytrolling devices, suchas synthesizers and sound cards, that emit musicis usually employedby digital key boards used in rock bandsWhile I am not a musician, I will show you how to write Java code to play some simple melodies Perhapsafter completing this series of modules, you can continue learning on your own to create serious music usingMIDdickbaldwinAvailableforfreeatConnexions

CHAPTER 1 GETTING STARTED14 Writing, compiling, and running Java programs141 Writing Java codeFortunately, writing Javastraightforward You can write Java code using any plain text, editor Yousimply need to cause the olfile to have an extension of javaThere are a numberlevel Integrated Development Environments(IDEs) available, such asEclipse and Net Beans, but they tend to be overkill for the relatively simple Java programs described in theseThere are also some low-level IDEs available, such as J Creator and DrJava, which are very useful forighted students However, I don't know anything about their level of accessibility I normally use a freeon of Creator mainly because it, contaa color-coded editor but, that, feature wouldn't be usefula blind studentSo, just find an editor that you are happy with and use it to write your Java code42 Preparing to compile and run Java codePerhaps the most complicated thing is to get your computer set up for compiling and running Java code inthe first place1421 Downloading the java development kit (JDKYou will need to download and install the free Java JDK from the Oracle/Sun website, As of Augustouwillfindthatwebsiteathttp://wwworaclecom/technetwork/java/javase/downloads/index

htmlWhile writing this module in Aug2011, I noticed that jDK 7 has been recently released Wexpect that it will work just fine, I havent tried it yet I am still running Java SE 6 Update 26 I plan tohold off for a few months before downloading and installing JDK 7Also there is a 64-bit version of the JDk, but I havent tried it yet, either because the computers in thelabs at the college where I teachsupport it I am still using the 32-1using the 64-bit version until the computers in those labs are upgradedWhether you elect to use JDK 6 or JDK 7 in either the 32-bit or 64-bit version is strictlyou Anyone of them should do the job very nicel1422 Installing the JDKou will find installationDK 7 athttp://downloadoraclecom/javase/7/docs/webnotes/install/windows/jdk-installation-windowshtmloandouwillfindinstallationinstructionsforJdk6athttp://wwworaclecom/technetwork/java/javase/index37561htMlThe installation instructions for JDK 7 are more complete than the installation instructions for JDKf you are installing JDK 6, I recommend that you read the instructions for JDK 7 and note theinformation that you will find there, particularly the information having to do with setting theronment variableA word of cautionupdating appen to be running Windows Vista, you may need to use something like the following whenIfng the path environment, variableC:\ Program Files (x86)\Java\ jdk1 60-26\binice oflecom/technep: //download oracle com/javase/7/racle com/technetwork/ java/javase/index -137561 htmlAvailableforfreeatConnexions