Presentation is loading. Please wait.

Presentation is loading. Please wait.

March 2005 1R. Smith - University of St Thomas - Minnesota Today’s Class IntroductionsIntroductions About the CourseAbout the Course FundamentalsFundamentals.

Similar presentations


Presentation on theme: "March 2005 1R. Smith - University of St Thomas - Minnesota Today’s Class IntroductionsIntroductions About the CourseAbout the Course FundamentalsFundamentals."— Presentation transcript:

1 March 2005 1R. Smith - University of St Thomas - Minnesota Today’s Class IntroductionsIntroductions About the CourseAbout the Course FundamentalsFundamentals –Computer –Program - Sequence –Parts of a computer –Parts of a CPU Writing a really short programWriting a really short program HomeworkHomework

2 March 2005 2R. Smith - University of St Thomas - Minnesota I love programming 20 year career, then went into something else20 year career, then went into something else My dad HATED programmingMy dad HATED programming My own kids never really tried itMy own kids never really tried it Some people will find they love itSome people will find they love it Some will hate it, and some are in the middleSome will hate it, and some are in the middle The GOAL: to be capable at programmingThe GOAL: to be capable at programming

3 March 2005 3R. Smith - University of St Thomas - Minnesota Class Survey Who is sitting next to you?Who is sitting next to you? Their name? Major?Their name? Major? Why are they taking the course?Why are they taking the course? What computer skills do they bring to this class?What computer skills do they bring to this class?

4 March 2005 4R. Smith - University of St Thomas - Minnesota Class Schedule I’ll arrive at 7:55 or so every dayI’ll arrive at 7:55 or so every day “Lectures” start at 8:15 AM, MW“Lectures” start at 8:15 AM, MW –Ends at 9:20 “Lab” starts at 8:00 AM Tue-Thu“Lab” starts at 8:00 AM Tue-Thu –Ends at 9:40 Both Lecture and Lab will start with a discussion of a new techniqueBoth Lecture and Lab will start with a discussion of a new technique

5 March 2005 5R. Smith - University of St Thomas - Minnesota Syllabus Learning Java programmingLearning Java programming –The basic mechanics –Assignments and variables –Conditionals –Loops –Input/Output –Structure with multiple procedures –Arrays Lots and lots of programmingLots and lots of programming

6 March 2005 6R. Smith - University of St Thomas - Minnesota How the class works Memorization and programmingMemorization and programming –This is lots and lots of detail work –You work fast if you work from memory –Practice and remember “patterns” that work Do the Reading!Do the Reading! –It gives you another source for programming details –A different way of describing the same stuff –A place to go to answer questions –“Some” problem sets based on the reading Quick Reference on end flapsQuick Reference on end flaps Labs = lists of programming tasks to doLabs = lists of programming tasks to do –Try to finish DURING lab –If you don’t, then you have extra homework

7 March 2005 7R. Smith - University of St Thomas - Minnesota Fundamentals ComputerComputer Program - SequenceProgram - Sequence Parts of a computerParts of a computer –Note they are built hierarchically Parts of a CPUParts of a CPU

8 March 2005 8R. Smith - University of St Thomas - Minnesota Java Program Always in a fileAlways in a file Starts with “public class”Starts with “public class” Usually contains a “public static void main”Usually contains a “public static void main” We “compile” it to make it workWe “compile” it to make it work

9 March 2005 9R. Smith - University of St Thomas - Minnesota Sample Java Program public class hello { public static void main (String[] args) { System.out.println(“Hello, world!”); }}

10 March 2005 10R. Smith - University of St Thomas - Minnesota Observations Case sensitive: match cases “exactly”Case sensitive: match cases “exactly” Program is worked “in order” from start to endProgram is worked “in order” from start to end –“Sequences” are fundamental to computing Curly braces mark “nested” componentsCurly braces mark “nested” components –“Hierarchies” are fundamental to computing Learn the “patterns” of typical programming tasksLearn the “patterns” of typical programming tasks –Setting up the program –Doing output

11 March 2005 11R. Smith - University of St Thomas - Minnesota “Compiling” - the mechanics Should work the same on PCs and MacsShould work the same on PCs and Macs You have to “compile” programs to run themYou have to “compile” programs to run them $ javac hello.java $ You have to use the “JVM” to run them, tooYou have to use the “JVM” to run them, too $ java hello Hello, world! $

12 March 2005 12R. Smith - University of St Thomas - Minnesota Homework 1.Read Chap. 1 & Chap. 2 Sec. 2.1-2.3 2.Find a “java compiler” on a computer you can use Already installed on 3rd and 4th floor OSSAlready installed on 3rd and 4th floor OSS May be installed on other campus computersMay be installed on other campus computers You can download it and install it at homeYou can download it and install it at home Java.sun.comJava.sun.com 3.Write a program that prints your name Ideally, use your U: drive or a USB driveIdeally, use your U: drive or a USB drive 4.Run it and print the result If it doesn’t work, write up a description of what you did and what happenedIf it doesn’t work, write up a description of what you did and what happened

13 March 2005 13R. Smith - University of St Thomas - Minnesota What’s happening now? Revised history of JavaRevised history of Java Overview of Statements and VariablesOverview of Statements and Variables Simple typesSimple types Printing out textPrinting out text The nuts and bolts of compiling programsThe nuts and bolts of compiling programs

14 March 2005 14R. Smith - University of St Thomas - Minnesota “My” History of Java Interpreting expressions (1940s)Interpreting expressions (1940s) Sort/Merge GeneratorSort/Merge Generator A2 CompilerA2 Compiler FortranFortran AlgolAlgol C Then, Objects happenedThen, Objects happened

15 March 2005 15R. Smith - University of St Thomas - Minnesota Statements and Variables Statements we’ll useStatements we’ll use –“Wrappings” like class and static void Always followed by a pair of curly bracesAlways followed by a pair of curly braces –Other statements are followed by a “;” –Variable declarations –Assignment statements VariablesVariables –Storage cells in your program –Each one is like a spreadsheet cell, only dumber

16 March 2005 16R. Smith - University of St Thomas - Minnesota Variable Naming Naming StructureNaming Structure First character: A-Z, a-z, _ or $First character: A-Z, a-z, _ or $ Remaining: same plus digitsRemaining: same plus digits Style rulesStyle rules Descriptive namesDescriptive names Usually start with lowercase letterUsually start with lowercase letter Camelback: use capitals to mark wordsCamelback: use capitals to mark words itemsOrdered, totalPaymentitemsOrdered, totalPayment DO NOT USE $ to start a nameDO NOT USE $ to start a name

17 March 2005 17R. Smith - University of St Thomas - Minnesota “Types” of variables First use: you say the typeFirst use: you say the type int = “integer”int = “integer” signed, no decimal part, less than 2Gsigned, no decimal part, less than 2G String = character stringString = character string Usually captured in quotesUsually captured in quotes Note that “String” is capitalizedNote that “String” is capitalized ExamplesExamples int sampleInt = 12; sampleInt = 25; System.out.println(sampleInt);

18 March 2005 18R. Smith - University of St Thomas - Minnesota Blanks, newlines, tabs System.out.printSystem.out.print System.out.printlnSystem.out.println “ ““ “ “Hello” + “ “ + “There”“Hello” + “ “ + “There” “Hello There”“Hello There” \n, \t\n, \t

19 March 2005 19R. Smith - University of St Thomas - Minnesota Compiling and Running What is really happening?What is really happening? How a program executesHow a program executes Computer ‘Languages’Computer ‘Languages’ InterpetingInterpeting CompilingCompiling Byte codes, “virtual machines”Byte codes, “virtual machines” What it looks like in RAMWhat it looks like in RAM

20 March 2005 20R. Smith - University of St Thomas - Minnesota Creative Commons License This work is licensed under the Creative Commons Attribution-Share Alike 3.0 United States License. To view a copy of this license, visit http://creativecommons.org/licenses/by- sa/3.0/us/ or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.


Download ppt "March 2005 1R. Smith - University of St Thomas - Minnesota Today’s Class IntroductionsIntroductions About the CourseAbout the Course FundamentalsFundamentals."

Similar presentations


Ads by Google