salman marvasti sharif university of technology fall 2014

37
Advanced Programming in Java Salman Marvasti Sharif University of Technology Fall 2014

Upload: barbra-marsh

Post on 01-Jan-2016

216 views

Category:

Documents


1 download

TRANSCRIPT

Advanced Programming in Java

Advanced Programming in JavaSalman MarvastiSharif University of TechnologyFall 2014AgendaIntroduction to CourseAdministrative DetailsSyllabusReferencesEvaluation Policy

Fall 2014Sharif University of Technology2Expected BackgroundA one-semester college course in programming.I assume you can write a program in some language, understand variables, control structures, functions/subroutines.If in doubt, lets talk.Evaluation PolicyFall 2014Sharif University of Technology4How many?Total GradeQuiz44Midterm Exam14Final Exam15Assignment33Project24+Class Activity-+Administrative Details (cont.)Our teaching assistant [email protected]@gmail.com Administrative Details (cont.)15 weeksTwo 80-minute lectures per week, a break in between the lectures.Course notes in PowerPoint.Course notes available (usually) Friday before class.Send course questions to Blackboards Discussion Group, personal questions to me.Administrative Details (cont.)Homework usually monthly. Printing slides? Three to a page, at least. Save a tree! Remove the PowerPoint background before printing. Save toner!

Administrative Details (cont.)Attendance is not required, butyou are responsible for everything said in class.I encourage you to ask questions in class. Dont guess, ask a question!My Policy on CheatingCheating means submitting, without proper attribution, any computer code that is directly traceable to the computer code written by another person.I give students a failing course grade for any cheating. This doesnt help your job prospects.My Policy on Cheating(cont.)You may discuss homework problems with classmates, after you have made a serious effort in trying the homework on your own.You can use ideas from the literature (with proper citation).You can use anything from the textbook/notes.The code you submit must be written completely by you.Course EtiquetteEtiquette is conduct in polite societyNo cell phonesNo random comings and goingsIf you are sleepy, go homeIf you want to read email or surf the Web, please do it elsewhereThis Course Covers:Object Oriented ConceptsFundamentals of Java programming languageSome Programming SkillsSoftware QualityTestRefactoring

Fall 2014Sharif University of Technology12Object Oriented ProgrammingProblem Spacethe place where the problem existssuch as a businessSolution Spacethe place where youre implementing that solutionsuch as a computerThe effort required to perform this mapping.E.g. think about a library, or a phonebook programFall 2014Sharif University of Technology13Object Oriented ApproachOOP lets the programmer represent problem space elements

The elements in the problem space and their representations in the solution space are referred to as objects Fall 2014Sharif University of Technology14OOPThe program is allowed to adapt itself to the lingo of the problem by adding new types of objects

when you read the code, youre reading words that also express the problem. Fall 2014Sharif University of Technology15OOP (2)OOP allows you to describe the problem in terms of the problemRather than in terms of the computer Objects in your code are similar to real objectsRecall the sample programs: phonebook and library

Fall 2014Sharif University of Technology16Object Oriented LanguagesSmalltalkThe first successful object-oriented language One of the languages upon which Java is basedJavaC++C#

Fall 2014Sharif University of Technology17Java HistoryJava was created in 1991by James Gosling in Sun MicrosystemsInitially called Oakin honor of the tree outside Gosling's windowIts name was changed to Java becaused of Java Island in Indonesia because there was already a language called Oak.Sun Microsystems released the first public implementation as Java 1.0 in 1995Java syntax is similar to C and C++.

Fall 2014Sharif University of Technology18Java MotivationThe need for platform independent languageTo be embedded in various consumer electronic products like toasters and refrigeratorsPlatform independent?!HardwareOperating System

Fall 2014Sharif University of Technology19Java Motivation (2)At the same time, the World Wide Web and the Internet were gaining popularity. Java could be used for internet programming.Why?Platform independenceCreation of Applets

Fall 2014Sharif University of Technology20The Java technology is:A programming languageJava can create all kinds of applicationsA development environmentA compiler (javac)An interpreter (java)A documentation generator (javadoc)Compare it to C++Fall 2014Sharif University of Technology21High-Level LanguagesFall 2014Sharif University of Technology22

Java Virtual MachineFall 2014Sharif University of Technology23

Compile and Execution StagesCompare to C++ and Assembly.NET FrameworkFall 2014Sharif University of Technology24

Java is PopularSome reports on programming languages popularityAccording toJob advertisementsBook salesFinding code on the web

Fall 2014Sharif University of Technology25Fall 2014Sharif University of Technology26

http://www.langpop.comupdated in 2010

Fall 2014Sharif University of Technology27http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html (2012)

Characteristics of JavaJava is simpleJava is object-orientedJava is architecture-neutralJava is portableJava is interpretedJava is multithreadedJava is secureJava is robust

Fall 2014Sharif University of Technology28First ExampleCreate a file named First.javaJava class files have .java extensionNote to naming conventionCopy this lines to the fileNote: File name and class name should be the same.

Fall 2011Sharif University of Technology29

29Oracle, Sun, Fall 2014Sharif University of Technology30

Further ReadingRead Java page on Wikipediahttp://en.wikipedia.org/wiki/Java_(programming_language)Google this terms and phrases:

Fall 2014Sharif University of Technology31JavaJava MobileJVMByte codeJava SunJava and C++Java and C#

Assignment # 0Download and install JDKhttp://www.oracle.com/technetwork/java/javase/downloads/index.htmlJDK 7Write a program that prints your name on the consoleCompile and run the program

Fall 2014Sharif University of Technology32Course OutlineLets See The Syllabi.

TopicsIntroduction to java languageJava syntax, operators, conditions, loops, StringsArraysObject Oriented ProgrammingInterfaceInheritancePolymorphismSoftware QualityRefactoringTest

Advanced Java ProgrammingException HandlingGenerics CollectionsGUIThreadsFiles and StreamsNetworkingReflection

Fall 2014Sharif University of Technology34ReferencesJava How to ProgramDeitel & Deitel9th Edition (6th+ editions are ok)

Thinking in Java Bruce EckelFourth EditionFall 2014Sharif University of Technology35Course Homepagehttps://ce.sharif.edu/courses

Lecture notes and reference books are uploaded hereFall 2014Sharif University of Technology36Fall 2014Sharif University of Technology37