1 / 21

Welcome to SIGSoft

Welcome to SIGSoft. Who are we?. Chairs: Drew Cross Eric Parsons Treasurer: Dylan Nugent “Authorized Agents”: Ciara Proctor Sean Nicolay What SIGSoft was like last year. What to expect from us this year. Side note: Our meetings will become much more informal over time.

osric
Download Presentation

Welcome to SIGSoft

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Welcome to SIGSoft

  2. Who are we? • Chairs: • Drew Cross • Eric Parsons • Treasurer: • Dylan Nugent • “Authorized Agents”: • Ciara Proctor • Sean Nicolay • What SIGSoft was like last year. • What to expect from us this year. • Side note: Our meetings will become much more informal over time

  3. Announcements • Permanent Room TBA via newsgroup eventually… • Today: “Random” examples of bad code • Next week: Possibly a GIT tutorial • Survey results

  4. As of 12pm Tuesday

  5. What do you think about this?

  6. There is no -->operator • This is a misuse of white space • In this example, the -->is a combination of the decrement operator (--) and the greater than operator (>). • Note: the -> operator does exist in C/C++

  7. Now what do you think?

  8. Use appropriate control structures • On the previous slide, a while loop is performing an action typically performed by a for loop. • By switching to a for loop, the comparison and the decrement operation are isolated. This separation helps make the code easier to understand.

  9. Two examples of scope brace placement Either is fine, just be consistent I prefer the latter because of screen real estate and putting the opening brace on a new line does not convey new information to me.

  10. Coding conventions • On the previous slide I showed two examples of curly brace place placement. Either is fine if you are consistent about your usage. • This point is moot in Python as it uses whitespace (indentation) for indicating scope. • If you join a project and everyone is following a coding convention (variable names, indentation, etc) conform to their convention; don’t try to change conventions mid-project unless there is a really good reason to.

  11. Key Point Managing Complexity "Everyone knows that debugging is twice as hard as writing a program in the first place. So if you’re as clever as you can be when you write it, how will you ever debug it?” --Brian Kernighan • The human brain can only handle so many tasks at once. (about 7) • Always strive for simplicity and clarity when designing your programs and when choosing names for classes, methods/ functions, and variables. • Write simple/clear code first and profile it. Only then perform optimizations. • “…premature optimization is the root of all evil.” –Donald Knuth

  12. What is this java code doing? From Code Complete: Second Edition (pg 260)

  13. Now with sane names… • Don’t be afraid to write longer names if needed (but be concise!) For example: numStudents is better than numberOfStudentsInTheClass • Learn the AutoComplete shortcuts for your editor • Vim: Ctrl-n Eclipse: Ctrl-Space, or Cmd-Space on Mac

  14. A more real-world example… • Bad variable names: myInt, arr, thing1, returnVal, input, output, result, a, b, c • Short names can be ok but think before using them. • i.e. x,y,z for Cartesian coordinate system i,j,k for loop control I can’t stress the power of good names enough! Which is why the next talk I (Eric) do will be on naming conventions.

  15. What is wrong here?(Aside from the fact that PHP is being mixed with HTML) • Hint: these are all different files and I could have picked any one of about 200 others for this example…

  16. Repetition • In the previous slide, the PHP/HTML that generates the site’s overall layout is duplicated via copy/paste in a couple hundred files. • If you wanted to make a site wide change you would have to either: • Hope the relevant file was an include that all the pages used • Go through every file making your changes to each • Re-write the site to eliminate the repetition and separate logic from presentation • As a result, this site is inflexible and making changes is difficult and tedious

  17. DRY (Don’t Repeat Yourself) • If you find yourself wanting to violate DRY by copy-pasting code, refactor instead • Benefits of not repeating code • Single place for change • Can give a name to the set of operations being performed (Reducing complexity) • Also: Don’t reinvent the wheel. Chances are that someone has had to solve the problem you are now facing. Maybe that solution uses a software license compatible with your code.

  18. Next Talk • The GIT version control system

  19. Projects • Engineering Open House (EOH) • Will be held March 9-10, 2012 • Sample Ideas: (Feel free to use them if you are stuck) • Where are my classes? http://goo.gl/jQZ0e • Hex Game w/AI opponent http://en.wikipedia.org/wiki/Hex_(board_game) • Import class schedule into Google Calendar • Continue working on IdeaMine

  20. Projects • Break into groups based on interest • Work on just coming up with an idea or problem statement for now • However, if your group is set on an idea, let me know • Repository access • Share contact info • You can post to the newsgroup (please do) but if you have a set of specific people that you want to contact, please try to email each other.

More Related