1 / 26

CS 160: Software Engineering November 3 Class Meeting

CS 160: Software Engineering November 3 Class Meeting. Department of Computer Science San Jose State University Fall 2014 Instructor: Ron Mak www.cs.sjsu.edu/~ mak. Unofficial Field Trip. Computer History Museum in Mt. View http://www.computerhistory.org/

Download Presentation

CS 160: Software Engineering November 3 Class Meeting

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS 160: Software EngineeringNovember 3 Class Meeting Department of Computer ScienceSan Jose State UniversityFall 2014Instructor: Ron Mak www.cs.sjsu.edu/~mak

  2. Unofficial Field Trip • Computer History Museum in Mt. View • http://www.computerhistory.org/ • Saturday, November 8, 11:30 – closing time • Special free admission. • Do a self-guided tour of the new Revolution exhibit. • See a life-size working model of Charles Babbage’s Difference Engine in operation, a hand-cranked mechanical computer designed in the early 1800s. • Experience a fully restored IBM 1401 mainframe computer from the early 1960s in operation. • General info: http://en.wikipedia.org/wiki/IBM_1401 • My summer seminar: http://www.cs.sjsu.edu/~mak/1401/ • Restoration: http://ed-thelen.org/1401Project/1401RestorationPage.html

  3. Unofficial Field Trip • The new Revolution exhibit is now open! • Walk through a timeline of the First 2000 Years of Computing History. • Historic computer systems, data processing equipment, and other artifacts. • Small theater presentations. Hollerith Census Machine Atanasoff-Berry Computer

  4. Unofficial Field Trip • Babbage Difference Engine, fully operational. • Hand-cranked mechanical computer. • Computed polynomial functions. • Designed by Charles Babbage in the early to mid 1800s. • Arguably the world’s first computer scientist, lived 1791-1871. • He wasn’t able to build it because he lost his funding. • Live demo at 1:00 • His plans survived and this working model was built. • Includes a working printer! http://www.computerhistory.org/babbage/

  5. Unofficial Field Trip • IBM 1401 computer, fully restored and operational • A small transistor-based mainframe computer. • Extremely popular with small businesses in the late 1950s through the mid 1960s • Maximum of 16K bytes of memory. • 800 card/minute card reader (wire brushes). • 600 line/minute line printer (impact). • 6 magnetic tape drives, no disk drives.

  6. Tesla Headquarters Visit Bourne Joseph student Computer Engineering Caires Debra professor Computer Science DhillonGurleen student Computer Engineering DimovDima student Computer Science Estell Khalil student Computer Engineering Flores Pedro student Computer Science Gallegos Kevin student Computer Engineering Inzunza Oscar student Computer Science Joshi Hardik student Computer Science Kang Jack student Computer Science KannanPrakasam student Computer Science Koumis Alex student Computer Engineering Long Camille student Computer Engineering Mak Ron professor Computer Science NarahariSrikanth student Computer Science Nguyen Duy student Computer Engineering Patel Jay student Computer Science Shah Shukan student Computer Science Thorpe David student Computer Science Torrefranca Daniel student Computer Engineering Tran Duc student Computer Engineering Tran Hung student Computer Engineering Tsui Helen student Computer Engineering Wei Eileen student Computer Science Wong Nelson student Computer Engineering • Friday, November 14 at 2:00 • 3500 Deer Creek RoadPalo Alto

  7. Software Builds and Deployments • We cannot rely on using IDEs such as NetBeans or Eclipse for doing production builds and software deployment. • Not everyone has access to IDEs. • Not every developer uses the same IDE. • Not everyone wants to use a GUI. • You don’t want to have dependencies out in the field on any particular IDEs. • The software you build and deploy should not include any IDE-related artifacts.

  8. Software Builds and Deployments, cont’d • You want a separate command-line tool to do your production builds and software deployments. • This command can be part of a system-wide build script.

  9. Ant • A Java-based, open-source build tool. • Similar to the Unix make utility (only better!). • Manage dependencies among build tasks. • Build a working application from source files. • Create .jar and .war archive files. • Send commands to the Tomcat server and to the MySQL server. • Run the application (or a test suite). • Automate and standardize product builds and deployments.

  10. Ant, cont’d • The build script is an XML file build.xml. • A build.properties file can supply parameter values. • Download and install Ant fromhttp://ant.apache.org/bindownload.cgi • Add Ant’s bindirectory to your path.

  11. Ant Example • Java main program program Howdy.java package cs160.hello; import cs160.utils.Greeter; public class Howdy { public Howdy(String what) { Greeter greeter = new Greeter(); greeter.say(what); } static public void main(String args[]) { new Howdy(args[0]); } }

  12. Ant Example, cont’d • Utility class Greeter.java package cs160.utils; public class Greeter { public void say(String what) { System.out.println("Hello, " + what + "!"); } } • Suppose we want to put this utility program into a jar file named utils.jar.

  13. src_hello cs160 hello src_utils Howdy.java cs160 utils lib Greeter.java utils.jar classes cs160 hello Howdy.class Ant Example, cont’d • Directory structure

  14. Ant Example, cont’d • build.xml <project name="Hello"> <property name="source_hello.dir" value="src_hello"/> <property name="source_utils.dir" value="src_utils"/> <property name="classes.dir" value="classes"/> <property name="library.dir" value="lib"/> <property name="temp.dir" value="temp"/> <target name="clean" description="Delete library and class directories"> <delete dir="${library.dir}"/> <delete dir="${classes.dir}"/> </target> </project>

  15. Ant Example, cont’d • build.xml(cont’d) <project name="Hello"> <property … <target name="clean" … <target name="jar" … <target name="compile" depends="jar" description="Compile the hello program"> <mkdirdir="${classes.dir}"/> <javacsrcdir="${source_hello.dir}" classpath="${library.dir}/utils.jar" destdir="${classes.dir}" includes="cs160/hello/*.java" includeantruntime="false"/> </target> </project> First execute the jar task.

  16. Ant Example, cont’d • build.xml(cont’d) <project name="Hello"> <property … <target name="clean" … <target name="jar" description="Create the utils.jar archive"> <mkdirdir="${library.dir}"/> <mkdirdir="${temp.dir}"/> <javacsrcdir="${source_utils.dir}" destdir="${temp.dir}" includes="cs160/utils/*.java" includeantruntime="false"/> <jar destfile="${library.dir}/utils.jar "> <filesetdir="${temp.dir}"> <include name="cs160/utils/*.class"/> </fileset> </jar> <delete dir="${temp.dir}/cs160"/> </target> </project> Can be a comma-separated list, e.g. "cs160/utils/*.java, cs160/abc/*.java" Can have multiple <include> and <exclude> tags inside a <fileset>.

  17. Ant Example, cont’d • build.xml(cont’d) <project name="Hello"> <property file="build.properties"/> <property … <target name="clean" … <target name="jar" … <target name="compile" … <target name="run" depends="jar,compile" description="Run the hello program"> <java classname="cs160.hello.Howdy" fork="true"> <classpath> <pathelement path="${library.dir}/utils.jar "/> <pathelement path="${classes.dir}"/> </classpath> <arg value="${what.to.greet}"/> </java> </target> </project>

  18. Ant Example, cont’d • build.properties what.to.greet=CS 160 class Demo

  19. Assignment #5 • Write an Ant build script to build and deploy the current version of your web app and creates your database. • Due Wednesday, Nov. 12

  20. Assignment #5: Useful URLs • Ant tutorials • http://ant.apache.org/manual/tutorial-HelloWorldWithAnt.html • http://supportweb.cs.bham.ac.uk/docs/tutorials/docsystem/build/tutorials/ant/ant.html • How to write an Ant script that creates a .war file • http://techtracer.com/2007/04/16/the-great-ant-tutorial-a-great-jump-start/

  21. Assignment #5: Useful URLs, cont’d • How to write an Ant script that sends commands to Tomcat • http://tomcat.apache.org/tomcat-5.5-doc/manager-howto.html#Executing%20Manager%20Commands%20With%20Ant • How to write an Ant script that sends commands to MySQL • http://www.roseindia.net/tutorials/ant/AntScriptCreateMysqlTable.shtml

  22. Legacy Data • What should we do with legacy data that is still useful? • Much data is kept in Excel spreadsheets. • Write the data out to files • CSV: comma-separated values format • Write programs to read the files and enter the data into a database. • Or …

  23. An Excel Spreadsheet JDBC Driver • Develop Java programs that can read and write the data within the Excel spreadsheets as if the spreadsheets were databases. • Database = a directory containing Excel spreadsheet files • Schema = a spreadsheet • Table = sheet • Download the Excel Spreadsheet JDBC driver:http://www.hxtt.com/excel_g.html?gclid=CLH-gI-A3KQCFY5a7AodhWhAKw

  24. An Excel Spreadsheet JDBC Driver, cont’d • Connect to the database (directory). • Example: A directory that contains a spreadsheet file: /Users/rmak/Apache/Apache2.2.8/htdocs/~mak/CS160/lectures/ExcelDemo private static final String DRIVER = "com.hxtt.sql.excel.ExcelDriver"; private static final String URL = "jdbc:Excel:////Users/rmak/Apache/Apache2.2.8/htdocs/~mak/CS160/lectures/ExcelDemo";

  25. An Excel Spreadsheet JDBC Driver, cont’d • The spreadsheet is school.xls: • It contains tabbed sheets (tables) named student, class, student_class, and teacher. • private PreparedStatementclassesTaughtBy;...classesTaughtBy = conn.prepareStatement("SELECT code, subject " +"FROM school.teacher, " +" school.class" +"WHERE teacher_last = ? " +"AND teacher_first = ? " +"AND teacher_id = class_teacher_id"); Demo

  26. A Programming Puzzle int powersOf2[8]; void initPowersOf2() { powersOf2[0] = 1; powersOf2[4] = 2*powersOf2[3]; powersOf2[1] = 2*powersOf2[0]; powersOf2[5] = 2*powersOf2[4]; powersOf2[2] = 2*powersOf2[1]; powersOf2[6] = 2*powersOf2[5]; powersOf2[3] = 2*powersOf2[2]; powersOf2[7] = 2*powersOf2[6]; } • What does array powersOf2 contain after method initPowersOf2() has been called?

More Related