Software Design. Exercise session 1 : Introduction to Java & Eclipse. Stefan Müller 26 February

Ähnliche Dokumente
Java Tools JDK. IDEs. Downloads. Eclipse. IntelliJ. NetBeans. Java SE 8 Java SE 8 Documentation

iid software tools QuickStartGuide iid USB base driver installation

Programmentwicklung ohne BlueJ

Algorithms for graph visualization

Introduction to Python. Introduction. First Steps in Python. pseudo random numbers. May 2016

Informatik II (D-ITET) Übungsstunde 1,

BVM-Tutorial 2010: BlueBerry A modular, cross-platform, C++ application framework

Informatik II - Übung 01

Materialien zu unseren Lehrwerken

D-BAUG Informatik I. Exercise session: week 1 HS 2018

Weather forecast in Accra

Registration of residence at Citizens Office (Bürgerbüro)

Magic Figures. We note that in the example magic square the numbers 1 9 are used. All three rows (columns) have equal sum, called the magic number.

Die "Badstuben" im Fuggerhaus zu Augsburg

Informatik für Mathematiker und Physiker Woche 7. David Sommer

Accelerating Information Technology Innovation

PONS DIE DREI??? FRAGEZEICHEN, ARCTIC ADVENTURE: ENGLISCH LERNEN MIT JUSTUS, PETER UND BOB

Informatik II (D-ITET) Informatik II (D-ITET) Übungsstunde 1. Distributed Systems Group, ETH Zürich

Max und Moritz: Eine Bubengeschichte in Sieben Streichen (German Edition)

Extract of the Annotations used for Econ 5080 at the University of Utah, with study questions, akmk.pdf.

EVANGELISCHES GESANGBUCH: AUSGABE FUR DIE EVANGELISCH-LUTHERISCHE LANDESKIRCHE SACHSEN. BLAU (GERMAN EDITION) FROM EVANGELISCHE VERLAGSAN

Ein Stern in dunkler Nacht Die schoensten Weihnachtsgeschichten. Click here if your download doesn"t start automatically

Programmieren I. Dokumentation mit javadoc Heusch 10.4 Ratz Institut für Angewandte Informatik

Modern Foreign Languages

Im Zeichen der Sonne: Schamanische Heilrituale (German Edition)

NEWSLETTER. FileDirector Version 2.5 Novelties. Filing system designer. Filing system in WinClient

DIBELS TM. German Translations of Administration Directions

Übungsstunde: Informatik 1 D-MAVT

Programmier-Befehle - Woche 10

vcdm im Wandel Vorstellung des neuen User Interfaces und Austausch zur Funktionalität V

FAHRZEUGENTWICKLUNG IM AUTOMOBILBAU FROM HANSER FACHBUCHVERLAG DOWNLOAD EBOOK : FAHRZEUGENTWICKLUNG IM AUTOMOBILBAU FROM HANSER FACHBUCHVERLAG PDF

Ingenics Project Portal

PONS DIE DREI??? FRAGEZEICHEN, ARCTIC ADVENTURE: ENGLISCH LERNEN MIT JUSTUS, PETER UND BOB

PONS DIE DREI??? FRAGEZEICHEN, ARCTIC ADVENTURE: ENGLISCH LERNEN MIT JUSTUS, PETER UND BOB

How-To-Do. Hardware Configuration of the CC03 via SIMATIC Manager from Siemens

1. General information Login Home Current applications... 3

Java-Einführungskurs Informatik II (D-ITET) Vincent Becker,

Introduction to Python. Introduction. First Steps in Python. pseudo random numbers. May 2018

Teil 3 - Java. Grundlagen Klassen, Attribute Methoden

Die einfachste Diät der Welt: Das Plus-Minus- Prinzip (GU Reihe Einzeltitel)

Microsoft PowerPoint Herausgeber BerCom Training GmbH Stationsstrasse Uerikon. Kontakte:

Customer-specific software for autonomous driving and driver assistance (ADAS)

Order Ansicht Inhalt

Wissenschaftliche Arbeitsgemeinschaft für Raketentechnik und Raumfahrt. Lehrstuhl für Raumfahrttechnik Technische Universität München

Java-Einführungskurs Informatik II (D-ITET) Vincent Becker,

Exercise (Part II) Anastasia Mochalova, Lehrstuhl für ABWL und Wirtschaftsinformatik, Kath. Universität Eichstätt-Ingolstadt 1

Karlsruhe Institute of Technology Die Kooperation von Forschungszentrum Karlsruhe GmbH und Universität Karlsruhe (TH)

RESI A Natural Language Specification Improver

Objektorientierung II & die Java Klassenbibliothek. Kristian Bergmann und Arthur Lochstampfer

rot red braun brown rot red RS-8 rot red braun brown R S V~

KTdCW Artificial Intelligence 2016/17 Practical Exercises - PART A

JTAGMaps Quick Installation Guide

Informatik II (D-ITET)

Praktikum Entwicklung Mediensysteme (für Master)

Institut für Programmierung und Reaktive Systeme. Java 1. Markus Reschke

Distributed Computing Group

DAS ERSTE MAL UND IMMER WIEDER. ERWEITERTE SONDERAUSGABE BY LISA MOOS

Fachübersetzen - Ein Lehrbuch für Theorie und Praxis

Englisch-Grundwortschatz

Informatik - Übungsstunde

Ägyptisch-Arabisch für Minimalisten: Schnell Arabisch lernen mit Lautschrift (German Edition)

Funktion der Mindestreserve im Bezug auf die Schlüsselzinssätze der EZB (German Edition)

p^db=`oj===pìééçêíáåñçêã~íáçå=

STRATEGISCHES BETEILIGUNGSCONTROLLING BEI KOMMUNALEN UNTERNEHMEN DER FFENTLICHE ZWECK ALS RICHTSCHNUR FR EIN ZIELGERICHTETE

Einführung in die Programmierung mit Java

Die besten Chuck Norris Witze: Alle Fakten über den härtesten Mann der Welt (German Edition)

RECHNUNGSWESEN. KOSTENBEWUßTE UND ERGEBNISORIENTIERTE BETRIEBSFüHRUNG. BY MARTIN GERMROTH

Selbstbild vs. Fremdbild. Selbst- und Fremdwahrnehmung des Individuums (German Edition)

Was heißt Denken?: Vorlesung Wintersemester 1951/52. [Was bedeutet das alles?] (Reclams Universal-Bibliothek) (German Edition)

Programmier-Befehle - Woche 08

Bedienungsanleitung / Manual für il-debug_i Interface für den Debugger il_debug

Informatik II Übung 1

Wie man heute die Liebe fürs Leben findet

Dexatek's Alexa Smart Home Skills Instruction Guide

Kapitel zu bearbeitende Aufgaben: 6.1 bis :

Cameraserver mini. commissioning. Ihre Vision ist unsere Aufgabe

prorm Budget Planning promx GmbH Nordring Nuremberg

Unterwegs mit einem Engel: Mit dem Buch Tobit durch die Fastenzeit bis Ostern (HERDER spektrum) (German Edition)

Woche 6. Cedric Tompkin. April 11, Cedric Tompkin Woche 6 April 11, / 29

ONLINE LICENCE GENERATOR

VGM. VGM information. HAMBURG SÜD VGM WEB PORTAL - USER GUIDE June 2016

Analyse und Interpretation der Kurzgeschichte "Die Tochter" von Peter Bichsel mit Unterrichtsentwurf für eine 10. Klassenstufe (German Edition)

Application Note. Import Jinx! Scenes into the DMX-Configurator

Haslingden High School MFL Faculty Y8 German Block A Homework In der Stadt

Wissenschaftliche Dienste. Sachstand. Payment of value added tax (VAT) (EZPWD-Anfrage ) 2016 Deutscher Bundestag WD /16

Exercise (Part V) Anastasia Mochalova, Lehrstuhl für ABWL und Wirtschaftsinformatik, Kath. Universität Eichstätt-Ingolstadt 1

EINFÜHRUNG IN DIE PROGRAMMIERUNG

p^db=`oj===pìééçêíáåñçêã~íáçå=

Grundlagen MATLAB. Vorlesung Batteriemodellierung mit MATLAB

GridMate The Grid Matlab Extension

Kurzanleitung Eclipse

Getting started with MillPlus IT V530 Winshape

VGM. VGM information. HAMBURG SÜD VGM WEB PORTAL USER GUIDE June 2016

Wiederholung JAVA. 1. (Vorbereitung)

Der Topos Mütterlichkeit am Beispiel Bertolt Brechts "Der kaukasische Kreidekreis" und "Mutter Courage und ihre Kinder" (German Edition)

Creating OpenSocial Gadgets. Bastian Hofmann

Analysis Add-On Data Lineage

Im Fluss der Zeit: Gedanken beim Älterwerden (HERDER spektrum) (German Edition)

Nürnberg und der Christkindlesmarkt: Ein erlebnisreicher Tag in Nürnberg (German Edition)

Java und Eclipse Installation, erstes Beispielprogramm

Transkript:

Software Design Exercise session 1 : Introduction to Java & Eclipse Stefan Müller stefan.mueller@inf.ethz.ch 1

About us Stefan Müller stefan.mueller@inf.ethz.ch What I m doing PhD Student (Systems Group) Darko Makreshanski darkoma@inf.ethz.ch What I m doing PhD Student (Systems Group) Office CAB E 78 Office CAB F 72 2

Exercise Sessions Discussion of exercise solution We do not put the exercise solution s source code online! There are sometimes several possible solutions Tips for the next exercise Remarks about the week s topic Tips about programming tools, libraries, etc.... 3

Exercise Sessions Slides online after Exercise Session: http://web.fhnw.ch/plattformen/sd/assignments 4

No testat, but exercises are exam material Exercises: Exercises 1-3: Recomended to do alone Exercises 4-11: Teams of two are recomended (it is a lot of work) Hand-in A-J: stefan.mueller@inf.ethz.ch K-Z: darkoma@inf.ethz.ch Exercises 1-3: Sourcecode by e-mail Subject: SD:netzname_ex# Bsp: SD:smuelle_ex01 Exercises 4-11: (see slides exercise session 5) 5

No testat, but exercises are exam material Hand-in Deadline: Two weeks after hand-in (there are exceptions) We may not be able to provide feedback for late submissions Ask specific questions 6

Today Installation of Java + Eclipse First steps with eclipse (Demo) Hello World in Java Vektor-Class 7

Installation of Java install Java Development Kit (JDK) Version 8 aka. 1.8, (versions 1.4 lack features used in this course) Windows / OSX: Download from http://www.oracle.com/technetwork/java/javase/downloads/index.html (Version JDK without JavaFX, J2EE or NetBeans) Linux: Installation via Package-Manager (apt-get, Synaptic etc.) or download from Oracle Attention: Java Runtime Environment (JRE) is not sufficient: The compiler is missing! JRE is part of the JDK. 8

Hello World Application in Java Enter source in text-editor and save as HelloWorld.java Filename must be equal to the class name. public class HelloWorld { public static void main(string args[]) { System.out.println( Hello World! ); HelloWorld.java 9

Hello World Programm in Java Name of the class: HelloWorld Application entrance point: main( ) The Java Virtual Machine (VM) searches the static method static void main(string[]) within the class that was given to the java command. Array args contains the command line arguments. public class HelloWorld { public visibility (all) public static void main(string args[]) { System.out.println( Hello World! ); class object method System static field (class variable) 10

Start java from the command line The Java VM (java.exe) as well as the compiler (javac.exe) can be started from the console: 11

Extend the searchpath (Windows) The bin directory of the JDK must be in the PATH environment variable: Unter : My Computer Properties extend Path (append) ;C:\<INSTALLATION-DIRECTORY>\Java\jdk1.6.0_18\bin; 12

Eclipse IDE Download: http://www.eclipse.org/downloads recomended Eclipse is an open-source framework, primarlily used as a Integrated Development Environment (IDE) Eclipse is modular and can be extended by plugins Eclipse is available in several packages (different set of pre-installed plugins) 13

Eclipse Workspaces Workspace: Contains the projects Where is my workspace? Shown at startup It is possible to have several workspaces Hides this dialog in the future. Can be changed later in: Window Preferences General Startup and Shutdown Workspaces Prompt for workspace on startup 14

Eclipse 15

Eclipse Execute Application Icon or: Run As => Java Application in contextmenu of Hello.java Helpers while coding: Code formatting: CTRL+SHIFT+F Code Completion: CTRL+SPACE Refactoring: Renaming of methods, classes, fields, incl. changing of all references. a lot more... Stefan Müller Software Design Übungsstunde Frühlingssemester 2012 16

Documentation Complete Java Documentation: http://docs.oracle.com/javase/8/docs/ Documentation of all Classes that come with java http://docs.oracle.com/javase/8/docs/api/ Tooltips in Eclipse: 17

Java Coding Style Guideline for Java-Programming style Increases readability of the code 80% of software cost is from maintenance Code usually is not maintained by the original author Makes it easier for me to read Code Conventions for the Java Programming Language http://www.oracle.com/technetwork/java/codeconv-138413.html Used by almost all professional java developers Automatic in Eclipse : Source Format 18

Some Code Conventions Package names are lower-case (e.g. ch.ethz.inf.sd.math) Classes start with an upper-case letter (z.b. Complex) Java Files are named after the public class they contain. UNIX-like operating systems are case sensitive! Static constants are written all upper-case. Fields and methods start with a lower-case letter. Seperation of words by an upper-case letter: get_first_element() getfirstelement() Brackets: void foo() void foo() { { if (x>y) { if (x>y) else { { else { Indent code blocks 19

Console output of objects Output of primive types (int, float, double, usw.) int a, b;... System.out.println(a+b*3.0); Result appears in console Output of objects by converting them to strings: Foo foo = new Foo(); System.out.println(foo); Output: Foo@82ba41 (Classe+hash value) 20

A class for vector operations Encapsulation: Class Vector capsulates vector operations in R 3 Possible operations (not complete): Constructors: Construct vector from the three components R 3 x R 3 R 3 : addition, subtraction R 3 x R R 3 : scaling R 3 R : norm getter and setter methods for the individual components. normalizing Output as string Source code available online after the exercise 21

public class Vector { private double x, y, z; Basic structure public Vector(double x, double y, double z) { this.x = x; this.y = y; this.z = z; //... public double getx() { return x; public void setx(double x) { this.x = x; public void add(vector v) { x+=v.x; y+=v.y; z+=v.z; //... also possible: public Vector add(vector v) { return new Vector(x+v.x, y+v.y, z+v.z); 22

How to use the vector class: The class VectorTest uses Vector public class VectorTest { public static void main(string args[]) { Vector a = new Vector(3.0, 1.0, 5.0); Vector b = new Vector(1.0, 0.0, 0.0); a.add(b); System.out.println(a.getX()); 23