编程辅导 C C++ Java Python MIPS Processing 网络家教 在线辅导

编程家教 远程写代码 Debug 讲解答疑 课后答疑 不是中介,本人直接答疑

微信: ittutor QQ: 14061936 Email: ittutor@qq.com

导航

 What is Programming About

COMP 102 #22016 T1Peter AndreaeComputer ScienceVictoria University of Wellington© Peter AndreaeCOMP 102  2:2Menu• Introductions• More course details• Programs and programming languages• Object Oriented Programming Reading:• Text Book Chapter 1 Announcements:• Sign up for a lab session!  (Labs start Thursday)• Voting for a Class Rep• Put a message about yourself on the forum if you want to be class representative;  the class will vote on Monday.• Trouble with passwords? Go to school office: CO 358© Peter AndreaeCOMP 102  1:3Course OrganisationAll the details are in the course outline:• handout• on the course web page: http://ecs.victoria.ac.nz/Courses/COMP102_2016T1/Lectures• Present new ideas, techniques, examples.• Mon, Tue, Thu:   2-3 in  KK LT303,  4-5 in MC LT102• Approx 32 lectures • Other 4 lecture slots used for reviews, extension material, etc.Optional Tutorial/Review Session• Wed 4-5,   FT77/306  from 3rd week,  MY632 in 2nd week.• 1st year help sessions:  Mon, Wed 5-7, AM103© Peter AndreaeCOMP 102  1:4Course Web SiteAn essential resource for the course:• http://ecs.victoria.ac.nz/Courses/COMP102_2016T1(also accessible via link on BlackBoard)• Course information, announcements, handouts, videos• Lab Assignment details (times, dates, handouts, files, ...)• Forum, for questions and discussion • Info about doing work at home.• Java documentation• Other useful linksPrimary administrative communication channel. © Peter AndreaeCOMP 102  1:5Lab assignments• Ten lab assignments (roughly weekly),• hand out: Thursday • due: 1pm Thursday (a week later) (except #4 & #10)• Apply material from lectures and text book to practical programming problems.This is where your learning happens!• Done partly in scheduled lab sessions • Further work required:  expect 5 hours outside labs • any of the ECS labs,• on your home computer© Peter AndreaeCOMP 102  1:6Scheduled Labs• Two 1hr labs, in CO 219 & 238• Thu/Fri Lab: Thu 3-4, Thu 4-5, Thu 5-6; Fri 10-11, Fri 11-12, Fri 3-4• Mon/Tue Lab: Mon 10-11, Mon 12-1, Mon  1-2 Mon 3-4 Tue 11-12, Tue 5-6• Tutors present to help.• Start THIS week (from Thursday)• First assignment is short, and should not require additional work outside the lab sessions.• Sign up online• https://student-sa.victoria.ac.nz/• choose ONE Thu/Fri Lab   and ONE Mon/Tue Lab(CO219 or CO238    doesn’t matter)© Peter AndreaeCOMP 102  1:7Course OrganisationHelp Desk• Online help: • Forum for general questions; • email/web form for questions about your code.• Help Desk: Tutors available at various times:  TBA  (12-1?)Study groups• We will facilitate organising study groups and tutored help sessions • First year engineering/CompSci tutorials/help sessions• Excellent way of helping your learning• Science and Engineering Faculty Awhina programme:• support for Maori and Pacific Nations students• Women students support group. © Peter AndreaeCOMP 102  1:8Text Book and HandoutsText Book• Java Foundations Lewis, DePasquale, Chase• Same as for COMP103.• [also OK: Java Software Solutions (6th ed)  Lewis and Loftus]• We consider it an important resource.• The lectures complement the text, not replace it.• Lectures will not cover all the details you need! • But nor will the textbook!  Handouts• Course outline, Lecture slides,  Assignments• Handed out in class.• On COMP102 web page.© Peter AndreaeCOMP 102  1:9Tests and ExamsTerms Test 1:• 15%• Wednesday 6 April    6-7 pm• NOT in lecture time! Terms Test 2:• 15% • Monday 9 May   6-7 pm• NOT in lecture time! Exam: • 50% • Date tba (between 10 and 29 June)© Peter AndreaeCOMP 102  1:10AssessmentRead the Course Outline!!!Mandatory Course Requirement:• Submit reasonable attempts ( at least D) for at least 7 of assignments 2 to 10.Final Grade:• Lab assignments: 20%  (labs 2 -10)• Terms Test 1: 15% (mark boosted to exam mark, if better)Terms Test 2: 15%  (mark boosted to exam mark, if better)Exam: 50% To pass the course, you must:• Satisfy the Mandatory Requirement.• Get overall grade of  C- or better.• Need B- or better to get into COMP103© Peter AndreaeWithdrawal dates• Early withdrawal with refund:   up do Fri 11 March• no consequences to early withdrawal• Standard withdrawal without refund:  up to Friday 13 May• Withdrawal recorded• No grade recorded on transcript• BUT, withdrawal counts as a fail for determining "Satisfactory Academic Progress"• Late withdrawal with Dean's permission: after 13 May• Requires permission of Associate Dean• Normally given only when special circumstances arise after deadline.COMP 102  1:11© Peter AndreaeCOMP 102  1:12Plagiarism (Cheating)• You must not present anybody else’s work as if it were your own work:  • Basic principle of academic honesty.• applies to work by other students, friends, relatives, the web, books…• If you received substantial help, then you must state who helped and how much.• If you declare any work from someone else, then it isn’t plagiarism!!! • In COMP102: • We encourage you to work in pairs on the core & completion parts of assignments BUT• You must put a comment at the top of your code saying that you worked with ….• If you use code from the assigned text book, or from the lectures, then you do not need to declare it;If you use any other code that wasn’t yours, then declare it!© Peter AndreaeCOMP 102  1:13Cheating in the assignments.Assignments are primarily for learning, not assessingCheating in the assignments is not worth it!• You won't learn, so you will probably fail.• If caught, you'll lose marks --- or worse.• Assignments have a fairly small contribution to your grade.© Peter AndreaeCOMP 102  1:14Lab Facilities• All scheduled labs are in CO219/238• Can also use other ECS labs (or one of the labs at VS)• Can also use home computers.• Lab Hours:  24/7• Need ID card to access in evenings and weekends• The labs are for getting work done• Don’t prevent other people from working• If you want to play around, go somewhere elseRead the lab rules!© Peter AndreaeCOMP 102  1:15Where to go for HelpDepends on the kind of help needed• Lecturers, Senior Tutor, tutors• Forum• On-line help system• Help desk  (CO 242b)• ECS School Office: • Student Services: http://www.vuw.ac.nz/st_services/• Science/Engineering/Arch&Des Awhina programme• The Web© Peter AndreaeCOMP 102  2:17A program is a specification for the behaviour of a computer:• What the computer should do when:      • the program is started• the user types something• the user clicks with the mouse• a message arrives over the network• some input from a camera/switch/sensor arrives.• ……      • Responses may be simple or very complex.• A program consists of • descriptions of responses to events/requests • written as instructions • in a language the computer can understand:• Low level,    High level,    Specialised What is a Program© Peter AndreaeCOMP 102  2:18Machine & Assembly Language• What the computer  can understand• Different for each computer• Very detailed, low-level control of the computer• Horrible to read::000XX00X 0X00XXXX 0XX0X00X 00XXX0X0 00X0X00X X0XX0X0X ::copy the contents of memory location 143 into register 1.add the contents of memory location 116 to the contents of register 1.copy the contents of register 1 to memory location 181.::LD d1  143AD d1  116ST d1  181::Pattern of bits controls the switches that operate the CPU© Peter AndreaeCOMP 102  2:19High Level Programming Languages• Designed for people to use• Designed to be translated into machine language• compiled (translated all at once), or• interpreted (translated one step at a time), or• compiled to an intermediate language, theninterpreted(examples at:  http://www.99-bottles-of-beer.net/ )Must be • Precise: no ambiguity about what to do• Expressive: must be able to specify whatever you want done.• Readable: People must be able to read the instructions.• Translatable: able to be translated into machine language• Concise: not “long-winded” or redundantSmalltalkMLAdaC++EiffelPrologHaskellMirandaJavaC#PythonScratchGameMakerAliceFORTRANLISPAlgolCOBOLBasicCPascalSimulaModulaPHPJavascriptint top = base + height;© Peter AndreaeCOMP 102  2:20Specialised language: MazeMouse• Writing a program to control a Mouse in a Maze• The mouse should get out of the maze• No matter what shape the maze is!!• The program must cope with “the general case”!• Very simple language:• Sequence of  Forward, Left, and/or Righteg:    FLFR• What should the mouse do when • there’s a space ahead• there’s a space only to the left• there’s a space only to the right• there’s space only to the sides• it’s in a dead-end??© Peter AndreaeCOMP 102  2:21Programming Languages • Different languages support different “paradigms”:(ways of designing) • imperative, • object-oriented, • functional, • logic programming, ...Object Oriented programming languages:• Organise program around Classes (types) of objects• Each class of objects can perform a particular set of actions• Most instructions consist of asking an object to performone of its actions© Peter AndreaeCOMP 102  2:22Java• A high-level Object-Oriented programming language• Designed by Sun Microsystems, early-mid 1990's.• Widely used in teaching and industry.• Related to C++, but simpler. Similar to C#.• Good for interactive applications.• Extensive libraries of predefined classesto support, UIs, graphics, databases, web applications, ...• Very portable between kinds of computers.© Peter AndreaeCOMP 102  2:23Constructing ProgramsDesignEditTest• The Design—Edit—Test  cycle: Given a task: © Peter AndreaeCOMP 102  2:24Building programs• Specification:• Work out what you want the program to accomplish • Design• Work out what the computer must do to accomplish the task• Edit• Express the design in a programming language• instructions for individual steps, • structure of the program• Test• Run the program and see whether it works as intended• may need to try it out on lots of different cases.© Peter AndreaeCOMP 102  2:25A program for the Maze MouseSpecification• Program to get the mouse out of any maze with a reachable exit(Mouse always starts in the top left corner facing right) Design • "make the mouse move into an empty space, When there is a choice, go forward if possible, otherwise to the left"Edit• space ahead• space only to the left• space only to the right• space only to the sides• dead-end??FLFRFLFLLFProgram© Peter AndreaeTesting the program• (Try it out with the MazeMouse demo)COMP 102  2:26© Peter AndreaeA different task:Specification:• Find the average of a sequence of numbers from the user• Design:• Initialise a count and a running total to 0• Ask the user to enter the numbers• Repeat until there are no more numbers:• read the next number• add it to the total• increase the count by 1• If there was at least one number• Print out the total / count• Otherwise, print a message.  COMP 102  2:27© Peter AndreaeCOMP 102  2:28A Java Programimport ecs100.*;/** Program to compute the average of a sequence of numbers */public class MeanFinder {public void findMean () {double total= 0;int count =0;UI.print( "Enter numbers (followed by 'done'): " );while ( UI.hasNextDouble( ) ) {total = total + UI.nextDouble( );count = count + 1;}if (count > 0) { UI.printf( "Mean = %5.2f \n", (total/count) );  }else {UI.println( "You entered no numbers");  }}}© Peter AndreaeCOMP 102  2:29Learning to Program in JavaWhat’s involved?• Understand what the computer can do and what the language can specify• Problem solving:• program design,• data structuring,• Programming language (Java):• syntax and semantics• style and common patterns• libraries of code written by other people• Testing and Debugging (fixing).• Common patterns in program design.• Important data structures and algorithms.

相关推荐