Welcome to Informatik 2!
|
|
- Branden Sparks
- 5 years ago
- Views:
Transcription
1 Welcome to Informatik 2!
2 Our Subject this Term: Algorithms and Data Structures in Java and C++
3 Totally Different Problems!? What is the minimum number of people involved for a person to become his/her own grandparent by marriage? In order to set up a network, James has to connect desks A-F. As a first guess, he sums up all distances to order cable. How much better could he do? A 4m 3m C B 2m 3m 10m D 4m 5m F E Which 4 digits need to be removed? schmiedecke 09 Info2-1-Intro 3
4 The Algorithmic Perspective In Informatik 1, we dealt with creating objects combined them to form interacting systems with behaviour either active or reactive That was the object oriented paradigm for problem solving But there is another perspective: it is not about systems, but about computation processes i.e. solving mathematical problems in a stepwise process using the computer to do tedious, time- consuming computations The Algorithmic Perspective schmiedecke 09 Info2-1-Intro 4
5 The Cradle of Computer Science Greek mathematiciens invented the process of stepwise computing more than 2000 years ago. Present in other ancient cultures, too. In our days: the basis for mechanization of computing Brunsviga Calculator and of course of electronic computing. schmiedecke 09 Info2-1-Intro 5 Zuse Computer Z1 (1936) and Z64 (1964)
6 Is this an Algorithm? Let AB and CD be the given numbers,, such that the bigger one, AB, is not measured precisely by the smaller one,, CD. Keep taking the smaller number away from the bigger one, until the remainder measures the the number before it. This remainder is the greatest common measure of the two given numbers. Euclid, about 250 B.C. (abbreviated) An algorithm describes the solution of a problem as a set of consecutive simple steps. (Definition from Info 1) schmiedecke 09 Info2-1-Intro 6
7 Algorithms can be... fast or slow By all means, algorithms offer many opportunities for making mistakes! schmiedecke 09 Info2-1-Intro 7
8 Code Quality Matters! Aspects: efficiency / complexity next week correctness robustness readability and structure today schmiedecke 09 Info2-1-Intro 8
9 Contents and Learning Material Part 1: Algorithm and Data Structure Design until Witsun using Java Text Book: Duane Bailey, Java Structures available online! exam on part 1 60% Part 2: Introduction to C week introduction online course material (still to be selected) redoing java labs exam on part 2 40 % schmiedecke 09 Info2-1-Intro 9
10 Lab Work Reports: published as web pages (as soon as possible) include running programs as applets, when applicable Teamwork: groups of two pair programming: don't split the work, but share it! OS: Linux is mandatory for part 1 Grading: Part of the grade for your achievements during lab time. schmiedecke 09 Info2-1-Intro 10
11 Step 1: Code Quality (Book Chapter 2)
12 Programmers are Craftsmen Designing Algorithms established correctness known complexity and measured performance readable and managable code Designing Data Structures correctness, robustness, and efficiency support algorithm efficiency well-understood concept re-usable Using Programming Tools support code quality schmiedecke 09 Info2-1-Intro 12
13 Code Readability What makes code readable / hard to read? Believe it or not, there are well accepted rules for readbility: Code Style Guides, regulating: Naming and spelling conventions camelcase, only class names starting with capital, constants all capital,... Formatting: indentation, new line conventions, convnetions for control structures... Program sizes: max method length, max class length, max num of parameters, max nesting of control structures (often applied as code quality metrics) Comment conventions usage of javadoc comments, line comments, assertions schmiedecke 09 Info2-1-Intro 13
14 Code Style Guides 1. Formatting Conventions indentation new lines comment enforcement line length method length class length schmiedecke 09 Info2-1-Intro 14
15 from Geosoft JavaStyle schmiedecke 09 Info2-1-Intro 15 quoted from
16 Code Style Profile in Eclipse schmiedecke 09 Info2-1-Intro 16
17 Eclipse: Code Templates schmiedecke 09 Info2-1-Intro 17
18 Code Style Guides 2 Naming Conventions Case CamelCase starting capital for classes CamelCase starting small for all other names Capitals for constants all names in English... Grammar verbs for methods nouns for Types nouns in plural for collections positive is-terms for booleans type prefixes for constants no abbreviations... schmiedecke 09 Info2-1-Intro 18
19 from Geosoft JavaStyle schmiedecke 09 Info2-1-Intro 19
20 Implemented Style Guides Style guides ensure readability and testability Implementation in IDE is better than discipline! Style checking still necessary! Main advantage: switch dynamically between different styles: production and test slide presentation schmiedecke 09 Info2-1-Intro 20
21 Production Style schmiedecke 09 Info2-1-Intro 21
22 Presentation Style schmiedecke 09 Info2-1-Intro 22
23 Refactoring Refactoring means "restoring a clean program structure" - in succession to program modifications... Experience: Most programs originally "tidy" schmiedecke 09 Info2-1-Intro 23
24 Refactoring Tasks Style Guide Requirements Renaming Abstraction Requirements Changing Method Signatures Localizing / Delocalizing Variables Structure Requirements Splitting Methods Splitting Classes Moving Methods to other Classes Moving Methods to Superclasses / Subclasses Extracting Interfaces schmiedecke 09 Info2-1-Intro 24
25 Simple Editing vs Refactoring Simple editing, e.g. changing a method signature, will cause a lot of errors in different classes. Let eclipse help you with refactoring: Refactoring takes care of all references within the current working set. What's a working set? An arbitrary set of classes, usually a project, but sometimes a set of projects or even a free collection of classes in a workspace. schmiedecke 09 Info2-1-Intro 25
26 Structural Quality: Let's do the Number Riddle Major Principle: Good code has a clear structure! Steps towards structure: look for a good abstraction separate concerns find useful, supportive data structures Which 4 digits need to be removed? schmiedecke 09 Info2-1-Intro 26
27 Three Steps Towards Structure 1. Abstraction: we have to iterate through all valid combinations and evaluate them. 2. Separation of Concerns: separate iteration and evaluation 3. Data structure: implement the Enumeration interface to manage the iteration. public interface java.util.enumeration <T> { public boolean hasmoreelements(); public <T> nextelement(); } schmiedecke 09 Info2-1-Intro 27
28 Basic Enumeration Setup Sample solution (may be wrong...) = 548 Encoding: Combinations can be described as arrays of 4 integers, representing the number of digits removed { 0, 1, 1, 2 } Iteration: like numbers to the base of 4: 0000, 0001, 0002, 0003, 0010, 0011, 00012,... Valid combinations: sum of digits = , 0022, 0031, 0103,... Enumeration should produce sequence of valid combinations schmiedecke 09 Info2-1-Intro 28
29 Basic Evaluation Setup Assume Enumeration producing arrays of valid combinations For each combination, evaluate as sum of integers print solution, if sum fits Simple can be done in the main method... schmiedecke 09 Info2-1-Intro 29
30 Solver Code public class RiddleSolver { public static void main(string[] args) { int requiredsum = 548; int[] combination; RiddleCombinationEnumerator rce = new RiddleCombinationEnumerator(); while (rce.hasmoreelements()) { combination = rce.nextelement(); if (sumup(combination)==requiredsum) printformula(); } } private static String formula =""; private static void printformula () { System.out.println(formula); } schmiedecke 09 Info2-1-Intro 30
31 ctd. private static int sumup (int[] combination){ formula = ""; int factor=0, sum=0; } for (int i=0; i<combination.length; i++) { switch (combination[i]) { case 0: factor = 111; break; // no digit removed case 1: factor = 11; break; // 1 digit removed case 2: factor = 1; break; // 2 digits removed case 3: factor = 0; break; // all digits removed } int value = factor*(i+3); formula += " + " + value; // collect string sum += value; } formula += " = "+sum; return sum; schmiedecke 09 Info2-1-Intro 31
32 Enumeration, V 1.0 public class RiddleCombinationEnumerator implements Enumeration<int[]> { protected int[] current = { 0, 0, 1, 3 }; protected boolean finished = false; } public boolean hasmoreelements() { return!finished; } Too involved. refactor!! public int[] nextelement() { int [] result = current; do { //findnextcombination for (int index=3; index>=0; index--) { current[index] = (current[index]+1) % 4; if (current[index]!= 0) break; // no overflow } if (current[0]+current[1]+current[3]+current[3] == 0) finished = true; } while (!finished &&!combinationvalid()); return result; schmiedecke 09 Info2-1-Intro 32
33 Refactor Extract Method schmiedecke 09 Info2-1-Intro 33
34 schmiedecke 09 Info2-1-Intro 34
35 Enumeration Code public class RiddleCombinationEnumerator implements Enumeration<int[]> { protected int[] current = { 0, 0, 1, 3 }; protected boolean finished = false; public boolean hasmoreelements() { return!finished; } public int[] nextelement() { int [] result = current; do findnextcombination(); while (!finished &&!combinationvalid()); return result; } private void findnextcombination() {...} private boolean combinationvalid() { return current[0]+current[1]+current[2]+current[3] == 4; } schmiedecke 09 Info2-1-Intro 35
36 ctd.. private void findnextcombination() { for (int index=3; index>=0; index--) { current[index] = (current[index]+1) % 4; if (current[index]!= 0) return; // no overflow } if (current[0]==0) finished = true; } schmiedecke 09 Info2-1-Intro 36
37 Fine Structure, but... It's not commented add javadoc comments! Is it trustworthy? Is it correct? Is it robust? how could we find out? What can we do? schmiedecke 09 Info2-1-Intro 37
38 Pre- and Postconditions Pre- and postconditions can be used to (semi-)formally define the semantics of methods if formal, they can be used for correctness proofs Use pre- andd postconditions to specify the meaning before coding keep them as documentation schmiedecke 09 Info2-1-Intro 38
39 Enumeration Code with Pre and Post public class RiddleCombinationEnumerator implements Enumeration<int[]> { protected int[] current = { 0, 0, 1, 3 }; protected boolean finished = false; public boolean hasmoreelements() { // pre: // post: returns true, until all valid combinations have // been enumerated return!finished; } public int[] nextelement() { // pre: hasmoreelements // post: current combination is returned // either current holds the next valid combination, // and finished is false, // or current contains all zeros, and finished is true int [] result = current; do findnextcombination(); while (!finished &&!combinationvalid()); return result; schmiedecke } 09 Info2-1-Intro 39
40 ctd. private void findnextcombination() { // pre: hasmoreelements // post: current is updated to next value, or to zeros // finished is set to false if end is reached for (int index=3; index>=0; index--) { current[index] = (current[index]+1) % 4; if (current[index]!= 0) return; } if (current[0]==0) finished = true; } private boolean combinationvalid() { //pre: current is not null // post: validity check: sum of digits removed is 4 return (current[0]+current[1]+current[2]+current[3] == 4); } schmiedecke 09 Info2-1-Intro 40
41 Integrate into javadoc /** * findnextcombination * Enumerates combinations like base-4 numbers. * Sets current to the next combination. * On overflow (0000), finished is set true. hasmoreelements current is updated to next value, or to zeros * finished is set to false if end is reached */ private void findnextcombination() { for (int index=3; index>=0; index--) { current[index] = (current[index]+1) % 4; if (current[index]!= 0) return; } if (current[0]==0) finished = true; } schmiedecke 09 Info2-1-Intro 41
42 Enforcing Preconditions Parameter preconditions on public methods are the user's responsibility enforce using Exceptions /RuntimeExceptions Preconditions on private methods or preconditions on hidden state are the implementor's responsibility must be asserted failing is a severe programming error. use assertions as safeguard. schmiedecke 09 Info2-1-Intro 42
43 Enforcing Public Preconditions public int[] nextelement() { // pre: hasmoreelements // post: current combination is returned // either current holds the next valid combination, // and finished is false, // or current contains all zeros, and finished is true if (!hasmoreelements()) throw new EnumerationEndedException(); int [] result = current; do findnextcombination(); while (!finished &&!combinationvalid()); return result; } schmiedecke 09 Info2-1-Intro 43
44 Enforcing Private Preconditions private void findnextcombination() { // pre: finished is false // post: current is updated to next value, or to zeros // finished is set to true if end is reached assert!finished: "Enumeration has expired"; for (int index=3; index>=0; index--) { current[index] = (current[index]+1) % 4; if (current[index]!= 0) return; } if (current[0]==0) finished = true; } private boolean combinationvalid() { //pre: current is not null // post: validity check: sum of digits removed is 4 assert current!= null; return (current[0]+current[1]+current[2]+current[3] == 4); } schmiedecke 09 Info2-1-Intro 44
45 Assertions in Java Since Java1.4, assert is a keyword and has a meaning in Java: assert condition; if the contion fails, an AssertionError is thrown. Exception in thread "main" java.lang.assertionerror at enumerator.riddlecombinationenumerator.findnextcombin.... assert condition : messageexpression; if the condition fails, an AssertionError is thrown with the messageexpression as message parameter. Exception in thread "main" java.lang.assertionerror: Enumeration expired at enumerator.riddlecombinationenumerator.findnextcomb..... schmiedecke 09 Info2-1-Intro 45
46 Where to Put Assertions? You can dynamically assert any condition that you believe holds or has to hold true at runtime: preconditions of private methods loop invariants method invariants postconditions thread states Make use of them whenever a semantic comment allows to be stated as an assertion (keep the comment for more verbal explanation) schmiedecke 09 Info2-1-Intro 46
47 Assertion Don't-s Never: use an assertion condition with side effect (the assertion may be switched off at runtime) assert index++ == 100; use an assertion instead of a documented Exception to check the input parameter compliance of public methods. An assertion is not an interface check; a broken assertion marks a severe internal programming error. - assert inputparam!= null schmiedecke 09 Info2-1-Intro 47
48 Enabling Assertions Assertions can be switched on or off at VM start using the VM options -enableassertions, -ea -disableassertions, -da (default) If disabled, assert staements are ignored. In the shell, this means calling java ea MyClass In eclipse, enter ea as VM argument in your run cnfiguration. schmiedecke 09 Info2-1-Intro 48
49 Testing Correctness Postconditions can be used to determine test sets Design test sets before coding Run all tests after every code modification... The answer is automatic testing: You define the test sets They are run and evaluated automatically. We will look into the JUnit test framework some other time... schmiedecke 09 Info2-1-Intro 49
50 Design for Scalability Scalability: Ability to adapt to growing problem sizes: amount of data to be handled input frequency number of users or connections Limiting Factors: data structure limitations memory computer perfomance algorithm complexity schmiedecke 09 Info2-1-Intro 50
51 Example: Vector Vector is a flexible array initial size when exhausted, data copied to new enlarged array. How much growth at a time? Different strategies: constant increment doubling the size... with very different consequences! schmiedecke 09 Info2-1-Intro 51
52 Vector Extension Fixed increment take initial size 1, increment (n-1) = ½ n(n-1) copy operations for 1000 elements, that is ½ million copy operations for larger initial size and increment, you get ½ size²/increment², still a lot*) Double size take initial size 1 at the end, only n/2 elements have to be copied n/2 = n-1 copy operations for 1000 elements, that is 1000 copy operations *)Note: The initial size and increment become neglegible for large vectors schmiedecke 09 Info2-1-Intro 52
53 Design for Efficiency What does it mean? Efficiency means optimized resource consumption for a given task Resources: Time and space (memory) There may be an optimum and a worst case Efficiency is a property of the algorithm, not of implementation details! schmiedecke 09 Info2-1-Intro 53
54 Does it matter? Watch them sort at schmiedecke 09 Info2-1-Intro 54
55 Appendix: Linux schmiedecke 09 Info2-1-Intro 55
56 Switching OS......for those of you who have been using Windows last term. Reasons: Linux is open source Is a true multi-user OS Most servers are Unix-derivatives Big changes? First week is "shell week" But then: use eclipse as before... Mandatory? Yes, at least in the lab. You can use a virtual linux on your own machine, if you do not want to install another or second OS (VMplayer) It is your own responsibility to get familiar with Linux you will definitely need it - and hopefully like it schmiedecke 09 Info2-1-Intro 56
57 Basic Linux Terminology Command Shell: Shell Interactive Process: Terminal Bourne-Shell, C-Shell, bash (born again shell, Linux only) Graphical User Interfaces: KDE, Gnome Graphics support: X-Server X-Terminal is a command shell with graphics support: font size and colouring, copy-paste using mouse,... You should already be familiar with some Unix networking tools: ssh secure network command shell VNC secure networking shared GUI schmiedecke 09 Info2-1-Intro 57
58 First bash steps Open bash shell (or X-Terminal) Type commands: ls -lh contents of current directory pwd name of current directory mkdir name create new directory cd change directory mv datei verz move or rename file cp datei verz copy file rm datei delete file echo text or echo $file type text / file contents more datei type one page at a time with search option cmd1 cmd2 "pipe": output of cmd1 is used as input to cmd2 man cmd or info cmd manual pages for cmd man cmd more show one page at a time schmiedecke 09 Info2-1-Intro 58
59 First vi steps vi is a sophisticated command line text editor which runs on every Unix machine (use it for ssh connections) Special feature: 2 modi edit mode and input mode input commands change to input mode return to edit mode using ESC Editing: Start, Save, Quit: vi file opens file, creates it if necessary :q quit vi without saving :w save ZZ save and quit schmiedecke 09 Info2-1-Intro 59
60 vi Editing Cursor Control: use cursor keys or ghjk for cursor control Screen up, Screen down, Pos1 and End 23G goto line 23 G goto end-of-file Deleting Text : x delete character after cursor dw delete word from cursor position dd delete line Modifying Text (Implicit change to input mode!) r replace current character cw replace word from cursor position cd replace line from cursor position (Don't forget to return to edit mode, using ESC!) schmiedecke 09 Info2-1-Intro 60
61 vi input Change to Input Mode i insert before cursor a insert after cursor o insert on new line after cursor Return to Edit Mode Escape Hint: use two bash shells: one vi shell (save without leaving, :w) one shell for compilation and execution schmiedecke 09 Info2-1-Intro 61
62 ... so let the adventure start NOW! Of course, there are some really good introductions to the bash shell and the vi editor in the internet. Go and find one that suits you best!
CS 315 Software Design Homework 3 Preconditions, Postconditions, Invariants Due: Sept. 29, 11:30 PM
CS 315 Software Design Homework 3 Preconditions, Postconditions, Invariants Due: Sept. 29, 11:30 PM Objectives Defining a wellformed method to check class invariants Using assert statements to check preconditions,
More informationCS 215 Software Design Homework 3 Due: February 28, 11:30 PM
CS 215 Software Design Homework 3 Due: February 28, 11:30 PM Objectives Specifying and checking class invariants Writing an abstract class Writing an immutable class Background Polynomials are a common
More informationAssertions, pre/postconditions
Programming as a contract Assertions, pre/postconditions Assertions: Section 4.2 in Savitch (p. 239) Specifying what each method does q Specify it in a comment before method's header Precondition q What
More informationAP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS
AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS PAUL L. BAILEY Abstract. This documents amalgamates various descriptions found on the internet, mostly from Oracle or Wikipedia. Very little of this
More informationLab 1 Introduction to UNIX and C
Name: Lab 1 Introduction to UNIX and C This first lab is meant to be an introduction to computer environments we will be using this term. You must have a Pitt username to complete this lab. NOTE: Text
More informationSECTION 2: CODE REASONING + PROGRAMMING TOOLS. slides borrowed and adapted from Alex Mariakis and CSE 390a
SECTION 2: CODE REASONING + PROGRAMMING TOOLS cse331-staff@cs.washington.edu slides borrowed and adapted from Alex Mariakis and CSE 390a OUTLINE Reasoning about code Developer tools Eclipse and Java versions
More informationDynamic Analysis Techniques Part 2
oftware Design (F28SD2): Dynamic Analysis Techniques Part 2 1 Software Design (F28SD2) Dynamic Analysis Techniques Part 2 Andrew Ireland School of Mathematical & Computer Sciences Heriot-Watt University
More informationYou should see something like this, called the prompt :
CSE 1030 Lab 1 Basic Use of the Command Line PLEASE NOTE this lab will not be graded and does not count towards your final grade. However, all of these techniques are considered testable in a labtest.
More informationCourse Outline. Introduction to java
Course Outline 1. Introduction to OO programming 2. Language Basics Syntax and Semantics 3. Algorithms, stepwise refinements. 4. Quiz/Assignment ( 5. Repetitions (for loops) 6. Writing simple classes 7.
More informationWeek Overview. Unix file system File types and file naming Basic file system commands: pwd,cd,ls,mkdir,rmdir,mv,cp,rm man pages
ULI101 Week 02 Week Overview Unix file system File types and file naming Basic file system commands: pwd,cd,ls,mkdir,rmdir,mv,cp,rm man pages Text editing Common file utilities: cat,more,less,touch,file,find
More informationSemantic Analysis. CSE 307 Principles of Programming Languages Stony Brook University
Semantic Analysis CSE 307 Principles of Programming Languages Stony Brook University http://www.cs.stonybrook.edu/~cse307 1 Role of Semantic Analysis Syntax vs. Semantics: syntax concerns the form of a
More informationOregon State University School of Electrical Engineering and Computer Science. CS 261 Recitation 1. Spring 2011
Oregon State University School of Electrical Engineering and Computer Science CS 261 Recitation 1 Spring 2011 Outline Using Secure Shell Clients GCC Some Examples Intro to C * * Windows File transfer client:
More informationMills HPC Tutorial Series. Linux Basics I
Mills HPC Tutorial Series Linux Basics I Objectives Command Line Window Anatomy Command Structure Command Examples Help Files and Directories Permissions Wildcards and Home (~) Redirection and Pipe Create
More informationLab 1 Introduction to UNIX and C
Name: Lab 1 Introduction to UNIX and C This first lab is meant to be an introduction to computer environments we will be using this term. You must have a Pitt username to complete this lab. The doc is
More informationCS 3 Introduction to Software Engineering. 3: Exceptions
CS 3 Introduction to Software Engineering 3: Exceptions Questions? 2 Objectives Last Time: Procedural Abstraction This Time: Procedural Abstraction II Focus on Exceptions. Starting Next Time: Data Abstraction
More informationCS 351 Design of Large Programs Coding Standards
CS 351 Design of Large Programs Coding Standards Brooke Chenoweth University of New Mexico Spring 2018 CS-351 Coding Standards All projects and labs must follow the great and hallowed CS-351 coding standards.
More informationCOMS 6100 Class Notes 3
COMS 6100 Class Notes 3 Daniel Solus September 1, 2016 1 General Remarks The class was split into two main sections. We finished our introduction to Linux commands by reviewing Linux commands I and II
More informationCS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 3: SEP. 13TH INSTRUCTOR: JIAYIN WANG
CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 3: SEP. 13TH INSTRUCTOR: JIAYIN WANG 1 Notice Reading Assignment Chapter 1: Introduction to Java Programming Homework 1 It is due this coming Sunday
More informationPace University. Fundamental Concepts of CS121 1
Pace University Fundamental Concepts of CS121 1 Dr. Lixin Tao http://csis.pace.edu/~lixin Computer Science Department Pace University October 12, 2005 This document complements my tutorial Introduction
More informationCSC System Development with Java. Exception Handling. Department of Statistics and Computer Science. Budditha Hettige
CSC 308 2.0 System Development with Java Exception Handling Department of Statistics and Computer Science 1 2 Errors Errors can be categorized as several ways; Syntax Errors Logical Errors Runtime Errors
More informationIntro to Programming. Unit 7. What is Programming? What is Programming? Intro to Programming
Intro to Programming Unit 7 Intro to Programming 1 What is Programming? 1. Programming Languages 2. Markup vs. Programming 1. Introduction 2. Print Statement 3. Strings 4. Types and Values 5. Math Externals
More informationChapter 3. Selections
Chapter 3 Selections 1 Outline 1. Flow of Control 2. Conditional Statements 3. The if Statement 4. The if-else Statement 5. The Conditional operator 6. The Switch Statement 7. Useful Hints 2 1. Flow of
More informationWhy Design by Contract! CS 619 Introduction to OO Design and Development. Design by Contract. Fall 2012
Why Design by Contract What s the difference with Testing? CS 619 Introduction to OO Design and Development Design by Contract Fall 2012 Testing tries to diagnose (and cure) defects after the facts. Design
More informationCS11 Advanced Java. Winter Lecture 2
CS11 Advanced Java Winter 2011-2012 Lecture 2 Today s Topics n Assertions n Java 1.5 Annotations n Classpaths n Unit Testing! n Lab 2 hints J Assertions! n Assertions are a very useful language feature
More informationlast time in cs recitations. computer commands. today s topics.
last time in cs1007... recitations. course objectives policies academic integrity resources WEB PAGE: http://www.columbia.edu/ cs1007 NOTE CHANGES IN ASSESSMENT 5 EXTRA CREDIT POINTS ADDED sign up for
More informationCMSC 201 Fall 2016 Lab 09 Advanced Debugging
CMSC 201 Fall 2016 Lab 09 Advanced Debugging Assignment: Lab 09 Advanced Debugging Due Date: During discussion Value: 10 points Part 1: Introduction to Errors Throughout this semester, we have been working
More informationCS370 Operating Systems
CS370 Operating Systems Colorado State University Yashwant K Malaiya Fall 2016 Lecture 5 Slides based on Text by Silberschatz, Galvin, Gagne Various sources 1 1 User Operating System Interface - CLI CLI
More informationCS 251 Intermediate Programming Coding Standards
CS 251 Intermediate Programming Coding Standards Brooke Chenoweth University of New Mexico Fall 2018 CS-251 Coding Standards All projects and labs must follow the great and hallowed CS-251 coding standards.
More informationCS11 Java. Fall Lecture 1
CS11 Java Fall 2006-2007 Lecture 1 Welcome! 8 Lectures Slides posted on CS11 website http://www.cs.caltech.edu/courses/cs11 7-8 Lab Assignments Made available on Mondays Due one week later Monday, 12 noon
More informationDocumentation Requirements Computer Science 2334 Spring 2016
Overview: Documentation Requirements Computer Science 2334 Spring 2016 These requirements are based on official Java coding conventions but have been adapted to be more appropriate to an academic environment.
More informationLab # 2. For today s lab:
1 ITI 1120 Lab # 2 Contributors: G. Arbez, M. Eid, D. Inkpen, A. Williams, D. Amyot 1 For today s lab: Go the course webpage Follow the links to the lab notes for Lab 2. Save all the java programs you
More informationCS/ENGRD 2110 SPRING Lecture 2: Objects and classes in Java
1 CS/ENGRD 2110 SPRING 2018 Lecture 2: Objects and classes in Java http://courses.cs.cornell.edu/cs2110 Homework HW1 2 The answers you handed in at the end of lecture 1 showed mass confusion! Perhaps 80%
More informationSoftware Testing Prof. Meenakshi D Souza Department of Computer Science and Engineering International Institute of Information Technology, Bangalore
Software Testing Prof. Meenakshi D Souza Department of Computer Science and Engineering International Institute of Information Technology, Bangalore Lecture 04 Software Test Automation: JUnit as an example
More informationTest-Driven Development (a.k.a. Design to Test) CSE260, Computer Science B: Honors Stony Brook University
Test-Driven Development (a.k.a. Design to Test) CSE260, Computer Science B: Honors Stony Brook University http://www.cs.stonybrook.edu/~cse260 Person-hours Labor is sometimes measured in person-hours,
More informationChap2: Operating-System Structures
Chap2: Operating-System Structures Objectives: services OS provides to users, processes, and other systems structuring an operating system how operating systems are designed and customized and how they
More informationCSE 331 Summer 2016 Final Exam. Please wait to turn the page until everyone is told to begin.
Name The exam is closed book, closed notes, and closed electronics. Please wait to turn the page until everyone is told to begin. Score / 54 1. / 12 2. / 12 3. / 10 4. / 10 5. / 10 Bonus: 1. / 6 2. / 4
More informationRefresher workshop in programming for polytechnic graduates General Java Program Compilation Guide
Refresher workshop in programming for polytechnic graduates General Java Program Compilation Guide Overview Welcome to this refresher workshop! This document will serve as a self-guided explanation to
More informationFirst steps on Linux and programming
First steps on Linux and programming Adrien Poteaux CRIStAL, Université de Lille Year 2017-2018 This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License. http://creativecommons.org/licenses/by-nc-sa/3.0/
More informationSection 2: Developer tools and you. Alex Mariakakis (staff-wide)
Section 2: Developer tools and you Alex Mariakakis cse331-staff@cs.washington.edu (staff-wide) What is an SSH client? Uses the secure shell protocol (SSH) to connect to a remote computer o Enables you
More informationObject Oriented Programming Exception Handling
Object Oriented Programming Exception Handling Budditha Hettige Department of Computer Science Programming Errors Types Syntax Errors Logical Errors Runtime Errors Syntax Errors Error in the syntax of
More informationUnix File System. Learning command-line navigation of the file system is essential for efficient system usage
ULI101 Week 02 Week Overview Unix file system File types and file naming Basic file system commands: pwd,cd,ls,mkdir,rmdir,mv,cp,rm man pages Text editing Common file utilities: cat,more,less,touch,file,find
More informationControl Flow. COMS W1007 Introduction to Computer Science. Christopher Conway 3 June 2003
Control Flow COMS W1007 Introduction to Computer Science Christopher Conway 3 June 2003 Overflow from Last Time: Why Types? Assembly code is typeless. You can take any 32 bits in memory, say this is an
More informationWhat does this program print?
What does this program print? Attempt 1 public class Rec { private static int f(int x){ if(x
More informationProgramming with assertions Oracle guidelines
Programming with assertions Oracle guidelines J.Serrat 102759 Software Design October 27, 2015 Index 1 Preliminaries 2 When not to use assertions 3 When to use assertions 4 Post-conditions 5 Requiring
More informationHistory. Terminology. Opening a Terminal. Introduction to the Unix command line GNOME
Introduction to the Unix command line History Many contemporary computer operating systems, like Microsoft Windows and Mac OS X, offer primarily (but not exclusively) graphical user interfaces. The user
More informationCMPT 300. Operating Systems. Brief Intro to UNIX and C
CMPT 300 Operating Systems Brief Intro to UNIX and C Outline Welcome Review Questions UNIX basics and Vi editor Using SSH to remote access Lab2(4214) Compiling a C Program Makefile Basic C/C++ programming
More informationLab 5 : WordAnalyzer class
Lab 5 : WordAnalyzer class Introduction READ THE INSTRUCTIONS FIRST! The WordAnalyzer class was written to perform a few different analyses of words: - identify the first repeated (adjacent) character
More informationJava Bytecode (binary file)
Java is Compiled Unlike Python, which is an interpreted langauge, Java code is compiled. In Java, a compiler reads in a Java source file (the code that we write), and it translates that code into bytecode.
More informationTutorial 1: Unix Basics
Tutorial 1: Unix Basics To log in to your ece account, enter your ece username and password in the space provided in the login screen. Note that when you type your password, nothing will show up in the
More informationWelcome (back) to CS1007!
Welcome (back) to CS1007! Introduction to Computer Science in Java Spring 2002 Section 001: TR 2.40pm - 3.55pm 301 Pupin Section 002: TR 11.00am - 12.15pm 209 Havemeyer Professor Elizabeth Sklar email:
More informationCS/ENGRD 2110 FALL Lecture 2: Objects and classes in Java
1 CS/ENGRD 2110 FALL 2018 Lecture 2: Objects and classes in Java http://courses.cs.cornell.edu/cs2110 Homework HW1 2 The answers you handed in at the end of lecture 1 showed mass confusion! Perhaps 80%
More informationCISC 220 fall 2011, set 1: Linux basics
CISC 220: System-Level Programming instructor: Margaret Lamb e-mail: malamb@cs.queensu.ca office: Goodwin 554 office phone: 533-6059 (internal extension 36059) office hours: Tues/Wed/Thurs 2-3 (this week
More informationn Specifying what each method does q Specify it in a comment before method's header n Precondition q Caller obligation n Postcondition
Programming as a contract Assertions, pre/postconditions and invariants Assertions: Section 4.2 in Savitch (p. 239) Loop invariants: Section 4.5 in Rosen Specifying what each method does q Specify it in
More informationCSCI 161: Introduction to Programming I Lab 1b: Hello, World (Eclipse, Java)
Goals - to learn how to compile and execute a Java program - to modify a program to enhance it Overview This activity will introduce you to the Java programming language. You will type in the Java program
More informationPhysics REU Unix Tutorial
Physics REU Unix Tutorial What is unix? Unix is an operating system. In simple terms, its the set of programs that makes a computer work. It can be broken down into three parts. (1) kernel: The component
More informationUsing Eclipse Europa - A Tutorial
Abstract Lars Vogel Version 0.7 Copyright 2007 Lars Vogel 26.10.2007 Eclipse is a powerful, extensible IDE for building general purpose applications. One of the main applications
More informationCSE 390a Lecture 1. introduction to Linux/Unix environment
1 CSE 390a Lecture 1 introduction to Linux/Unix environment slides created by Marty Stepp, modified by Jessica Miller & Ruth Anderson http://www.cs.washington.edu/390a/ 2 Lecture summary Course introduction
More informationCSE 421 Course Overview and Introduction to Java
CSE 421 Course Overview and Introduction to Java Computer Science and Engineering College of Engineering The Ohio State University Lecture 1 Learning Objectives Knowledgeable in how sound software engineering
More informationBASIC COMPUTATION. public static void main(string [] args) Fundamentals of Computer Science I
BASIC COMPUTATION x public static void main(string [] args) Fundamentals of Computer Science I Outline Using Eclipse Data Types Variables Primitive and Class Data Types Expressions Declaration Assignment
More informationProgramming II (CS300)
1 Programming II (CS300) Chapter 04: Exception Handling MOUNA KACEM mouna@cs.wisc.edu Fall 2018 Creating Classes 2 Introduction Exception Handling Common Exceptions Exceptions with Methods Assertions and
More informationIntroduction to Linux Environment. Yun-Wen Chen
Introduction to Linux Environment Yun-Wen Chen 1 The Text (Command) Mode in Linux Environment 2 The Main Operating Systems We May Meet 1. Windows 2. Mac 3. Linux (Unix) 3 Windows Command Mode and DOS Type
More informationToday. Review. Unix as an OS case study Intro to Shell Scripting. What is an Operating System? What are its goals? How do we evaluate it?
Today Unix as an OS case study Intro to Shell Scripting Make sure the computer is in Linux If not, restart, holding down ALT key Login! Posted slides contain material not explicitly covered in class 1
More informationIntroduction to UNIX. Logging in. Basic System Architecture 10/7/10. most systems have graphical login on Linux machines
Introduction to UNIX Logging in Basic system architecture Getting help Intro to shell (tcsh) Basic UNIX File Maintenance Intro to emacs I/O Redirection Shell scripts Logging in most systems have graphical
More informationPART 1. Eclipse IDE Tutorial. 1. What is Eclipse? Eclipse Java IDE
PART 1 Eclipse IDE Tutorial Eclipse Java IDE This tutorial describes the usage of Eclipse as a Java IDE. It describes the installation of Eclipse, the creation of Java programs and tips for using Eclipse.
More informationProgram Correctness and Efficiency. Chapter 2
Program Correctness and Efficiency Chapter 2 Chapter Objectives To understand the differences between the three categories of program errors To understand the effect of an uncaught exception and why you
More information12/22/11. Java How to Program, 9/e. Help you get started with Eclipse and NetBeans integrated development environments.
Java How to Program, 9/e Education, Inc. All Rights Reserved. } Java application programming } Use tools from the JDK to compile and run programs. } Videos at www.deitel.com/books/jhtp9/ Help you get started
More informationDesigning Robust Classes
Designing Robust Classes Learning Goals You must be able to:! specify a robust data abstraction! implement a robust class! design robust software! use Java exceptions Specifications and Implementations
More informationConnecting to ICS Server, Shell, Vim CS238P Operating Systems fall 18
Connecting to ICS Server, Shell, Vim CS238P Operating Systems fall 18 By Aftab Hussain (Adapted from Claudio A. Parra s Slides for Fall 18 CS-143A) October 5 2018 University of California, Irvine Andromeda
More informationIntroduction to Java
Introduction to Java Module 1: Getting started, Java Basics 22/01/2010 Prepared by Chris Panayiotou for EPL 233 1 Lab Objectives o Objective: Learn how to write, compile and execute HelloWorld.java Learn
More informationCompilation and Execution Simplifying Fractions. Loops If Statements. Variables Operations Using Functions Errors
First Program Compilation and Execution Simplifying Fractions Loops If Statements Variables Operations Using Functions Errors C++ programs consist of a series of instructions written in using the C++ syntax
More informationReadability [Skrien 4.0] Programs must be written for people to read, and only incidentally for machines to execute.
Readability [Skrien 4.0] Programs must be written for people to read, and only incidentally for machines to execute. Abelson & Sussman Use a good set of coding conventions, such as the ones given in the
More informationIntroduction to Linux. Woo-Yeong Jeong Computer Systems Laboratory Sungkyunkwan University
Introduction to Linux Woo-Yeong Jeong (wooyeong@csl.skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu What is Linux? A Unix-like operating system of a computer What is an
More informationProgramming II (CS300)
1 Programming II (CS300) Chapter 04: Exception Handling MOUNA KACEM mouna@cs.wisc.edu Spring 2018 Creating Classes 2 Introduction Exception Handling Common Exceptions Exceptions with Methods Assertions
More informationExamples: Directory pathname: File pathname: /home/username/ics124/assignments/ /home/username/ops224/assignments/assn1.txt
ULI101 Week 03 Week Overview Absolute and relative pathnames File name expansion Shell basics Command execution in detail Recalling and editing previous commands Quoting Pathnames A pathname is a list
More informationCSE 391 Lecture 1. introduction to Linux/Unix environment
CSE 391 Lecture 1 introduction to Linux/Unix environment slides created by Marty Stepp, modified by Jessica Miller & Ruth Anderson http://www.cs.washington.edu/391/ 1 2 Lecture summary Course introduction
More informationWorking with Basic Linux. Daniel Balagué
Working with Basic Linux Daniel Balagué How Linux Works? Everything in Linux is either a file or a process. A process is an executing program identified with a PID number. It runs in short or long duration
More informationLab 4: Shell Scripting
Lab 4: Shell Scripting Nathan Jarus June 12, 2017 Introduction This lab will give you some experience writing shell scripts. You will need to sign in to https://git.mst.edu and git clone the repository
More informationIntroduction to Computers and C++ Programming p. 1 Computer Systems p. 2 Hardware p. 2 Software p. 7 High-Level Languages p. 8 Compilers p.
Introduction to Computers and C++ Programming p. 1 Computer Systems p. 2 Hardware p. 2 Software p. 7 High-Level Languages p. 8 Compilers p. 9 Self-Test Exercises p. 11 History Note p. 12 Programming and
More informationCOMP 202 Java in one week
COMP 202 Java in one week... Continued CONTENTS: Return to material from previous lecture At-home programming exercises Please Do Ask Questions It's perfectly normal not to understand everything Most of
More informationCS 200 Command-Line Arguments & Exceptions Jim Williams, PhD
CS 200 Command-Line Arguments & Exceptions Jim Williams, PhD This Week 1. Battleship: Milestone 3 a. First impressions matter! b. Comment and style 2. Team Lab: ArrayLists 3. BP2, Milestone 1 next Wednesday
More informationA Fraction Class. Using a Fraction class, we can compute the above as: Assignment Objectives
A Fraction Class Assignment Objectives What to Submit Evaluation Individual Work Write a Fraction class that performs exact fraction arithmetic. 1. Practice fundamental methods like equals, tostring, and
More informationLinux File System and Basic Commands
Linux File System and Basic Commands 0.1 Files, directories, and pwd The GNU/Linux operating system is much different from your typical Microsoft Windows PC, and probably looks different from Apple OS
More informationIndex. Index. More information. block statements 66 y 107 Boolean 107 break 55, 68 built-in types 107
A abbreviations 17 abstract class 105 abstract data types 105 abstract method 105 abstract types 105 abstraction 92, 105 access level 37 package 114 private 115 protected 115 public 115 accessors 24, 105
More informationSOFT 161. Class Meeting 1.6
University of Nebraska Lincoln Class Meeting 1.6 Slide 1/13 Overview of A general purpose programming language Created by Guido van Rossum Overarching design goal was orthogonality Automatic memory management
More informationCMPUT 201: Practical Programming Methodology. Guohui Lin Department of Computing Science University of Alberta September 2018
CMPUT 201: Practical Programming Methodology Guohui Lin guohui@ualberta.ca Department of Computing Science University of Alberta September 2018 Lecture 1: Course Outline Agenda: Course calendar description
More informationIntro to Linux & Command Line
Intro to Linux & Command Line Based on slides from CSE 391 Edited by Andrew Hu slides created by Marty Stepp, modified by Jessica Miller & Ruth Anderson http://www.cs.washington.edu/391/ 1 Lecture summary
More informationQueueBlock, ReversalADT, LinkedList,CustomerAccount, not MaintainCustomerData
Naming Conventions Rules Classes Use nouns Use whole words-avoid acronyms and abbreviations (unless the abbreviation is much more widely used than the long form, such as URL or HTML) Begin with upper case
More informationCOMP 110/401 DOCUMENTATION: ASSERTIONS. Instructor: Prasun Dewan
COMP 110/401 DOCUMENTATION: ASSERTIONS Instructor: Prasun Dewan PREREQUISITE Documentation Annotations 2 INVALID BMI public double getbmi() { return weight/(height*height); getbmi() should really not have
More informationNews and information! Review: Java Programs! Feedback after Lecture 2! Dead-lines for the first two lab assignment have been posted.!
True object-oriented programming: Dynamic Objects Reference Variables D0010E Object-Oriented Programming and Design Lecture 3 Static Object-Oriented Programming UML" knows-about Eckel: 30-31, 41-46, 107-111,
More informationReviewing all Topics this term
Today in CS161 Prepare for the Final Reviewing all Topics this term Variables If Statements Loops (do while, while, for) Functions (pass by value, pass by reference) Arrays (specifically arrays of characters)
More informationCSE 391 Lecture 1. introduction to Linux/Unix environment
CSE 391 Lecture 1 introduction to Linux/Unix environment slides created by Marty Stepp, modified by Jessica Miller & Ruth Anderson http://www.cs.washington.edu/391/ 1 2 Lecture summary Course introduction
More informationDefining Classes and Methods
Defining Classes and Methods Chapter 5 Modified by James O Reilly Class and Method Definitions OOP- Object Oriented Programming Big Ideas: Group data and related functions (methods) into Objects (Encapsulation)
More informationAdvances in Programming Languages
T O Y H Advances in Programming Languages APL4: JML The Java Modeling Language David Aspinall (slides originally by Ian Stark) School of Informatics The University of Edinburgh Thursday 21 January 2010
More informationFormale Entwicklung objektorientierter Software
Formale Entwicklung objektorientierter Software Praktikum im Wintersemester 2008/2009 Prof. P. H. Schmitt Christian Engel, Benjamin Weiß Institut für Theoretische Informatik Universität Karlsruhe 5. November
More informationUnix Introduction to UNIX
Unix Introduction to UNIX Get Started Introduction The UNIX operating system Set of programs that act as a link between the computer and the user. Developed in 1969 by a group of AT&T employees Various
More information3D Graphics Programming Mira Costa High School - Class Syllabus,
3D Graphics Programming Mira Costa High School - Class Syllabus, 2009-2010 INSTRUCTOR: Mr. M. Williams COURSE GOALS and OBJECTIVES: 1 Learn the fundamentals of the Java language including data types and
More informationEINDHOVEN UNIVERSITY OF TECHNOLOGY
EINDHOVEN UNIVERSITY OF TECHNOLOGY Department of Mathematics & Computer Science Exam Programming Methods, 2IP15, Wednesday 17 April 2013, 09:00 12:00 TU/e THIS IS THE EXAMINER S COPY WITH (POSSIBLY INCOMPLETE)
More informationPage 1. Human-computer interaction. Lecture 1b: Design & Implementation. Building user interfaces. Mental & implementation models
Human-computer interaction Lecture 1b: Design & Implementation Human-computer interaction is a discipline concerned with the design, implementation, and evaluation of interactive systems for human use
More informationIntroduction Welcome! Before you start Course Assessments The course at a glance How to pass M257
Introduction Unit 1: Java Everywhere Prepared by: Dr. Abdallah Mohamed, AOU-KW 1 Introduction Welcome! Before you start Course Assessments The course at a glance How to pass M257 1. Java background 2.
More information3. Java - Language Constructs I
Educational Objectives 3. Java - Language Constructs I Names and Identifiers, Variables, Assignments, Constants, Datatypes, Operations, Evaluation of Expressions, Type Conversions You know the basic blocks
More information