lec2 - CSE 8A: Lecture 2 Why programming is fun. but hard...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
Page 1 of 41 CSE 8A, UCSD LEC 2 CSE 8A: Lecture 2 Why programming is fun. .. but hard Designing, Writing, Compiling, and Running programs in general, and in Java javac and java Kinds of programming errors Syntax and semantics Variables, identifiers, and declarations Integer, floating, character, and boolean types Assigning values to variables Simple input and output (Reading: Savitch Ch. 1 and part of Ch. 2)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Page 2 of 41 CSE 8A, UCSD LEC 2 Why is programming fun? According to Fred Brooks, manager of the IBM OS/360 development team in the 1960’s (quoting from his 1975 book The Mythical Man-Month ): First is the sheer joy of making things. Second is the pleasure of making things that are useful to other people. Third is the fascination of fashioning complex puzzle-like objects of interlocking moving parts and watching them work in subtle cycles, playing out the consequences of principles built in from the beginning. Fourth is the joy of always learning, which springs from the nonrepeating nature of the task. Finally, there is the delight of working in such a tractable medium. The programmer, like the poet, works only slightly removed from pure thought. .. However. ..
Background image of page 2
Page 3 of 41 CSE 8A, UCSD LEC 2 ... and why is it hard? Brooks goes on to point out: Not all is delight, however. First, one must perform perfectly. .. If one character, one pause, of the incantation is not strictly in proper form, the magic doesn’t work. .. Adjusting to the requirement of perfection is, I think, the most difficult part of learning to program. -- Fred Brooks In CSE 8A, I hope you have fun programming in Java. But you will have to pay attention to the “requirement of perfection”: Using even a high-level, object-oriented language like Java requires much more precision than a natural language like English We will start to see some of these “requirements of perfection” today
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Page 4 of 41 CSE 8A, UCSD LEC 2 How to program 4 steps to keep in mind: Design your program Create one or more source code files that implement your design Compile your source code files Run the program! But these 4 steps almost never work exactly as planned. .. You will need to test the operation of your program, and fix any problems with it This is the process of debugging , and it is not separate step as much as it is involved in all 4 steps
Background image of page 4
Page 5 of 41 CSE 8A, UCSD LEC 2 Design your program Before creating any source code files, design your program: Understand what your program should do Devise an algorithm (a complete and precise sequence of steps) that will do it Sketch the algorithm in ‘pseudocode’ (a combination of English, mathematical notation, class diagrams, flowcharts, actual Java, etc.) THEN translate the pseudocode to Java Especially for more complicated applications, design is essential, and is really the hardest part of the process Think first! For any nontrivial program, starting by writing Java code is usually a bad idea
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 41

lec2 - CSE 8A: Lecture 2 Why programming is fun. but hard...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online