140 likes | 328 Views
CS242. Mike Woodley mwoodley@uiuc.edu Office: 2101 Siebel 244-1971 Home: 531-8237. What is this course all about?. Improve your coding habits Write lots of straightforward code Embellish on assignments Interpret assignment Present your own code Look at the code of others. Your Code.
E N D
CS242 Mike Woodley mwoodley@uiuc.edu Office: 2101 Siebel 244-1971 Home: 531-8237
What is this course all about? • Improve your coding habits • Write lots of straightforward code • Embellish on assignments • Interpret assignment • Present your own code • Look at the code of others
Your Code • It’s OK to • get help on your code • get code from the Internet • get code from a book
BUT… WRITE YOUR OWN CODE!!! Give credit where credit is due both in class and in your source code comments.
Grading TA evaluates: • Attendance • Participation • Completing assignments • Making improvements • Presenting code • Investigating code of others
“Clever” Solutions • Are cool • Don’t really help your grade • Unless you make a presentation out of it • The presentation is clear • It benefits the class • More interested in clear code
Discussion Sections • Peer code review • MARS – each student plays each role in each discussion section • Moderator • Author • Reviewer • Scribe
Lectures • Coding Style/Habits • Optimization • Practical How-To • Details about current assignment
Assignments • Assignments should be approached as applications not MPs. • User input – no hard coded filenames, for instance. • Defensive – elegantly handle bad input • Consider user’s experience
Coding Style Layout Comments Variable naming Function naming Functions (methods)
main() • Simply an outline of the main functionality of the application • Should not have large code blocks in loops or conditionals • raster.c • Come conventions • Variables • Functions • Comments
Routines(functions, methods, subroutines) • Do one thing • Do that one thing well • Have no hidden consequences (read chapter 7)
The “Right Way” • There isn’t one perfect way to code • I advocate an approach • I don’t want to get into “religious wars” about formatting, commenting, naming, … • When you go to work, whatever your boss says is right • When you’re the boss, you can change everything
Optimizing the Raster Processor • Optimization priority • Algorithm • Eliminate unnecessary conditionals • Lower level optimizations (chapters 25, 26)