---------- OUTLINE ---------- Announcements Software Engineering Questions ---------- ANNOUNCEMENTS ---------- There will be one handwritten page of notes for the test - George should make an annoucement to this effect. There will be a sort of in-class review session on the Tuesday before the test - Can ask questions about the homework, etc then (Im not sure if the homework solutions will be released before then). I should have everything from this week posted to my web page early this weekend. Tell them the plan - Software Engineering today, an optional QA discussion, followed by office hours on Tuesday, then please come to lecture and discussion on the Thursday after the test - It will help with the second project and is interesting stuff - Starts to get into data structures. ---------- SOFTWARE ENGINEERING ---------- FAIRLY CONCEPTUAL MATERIAL - ILL TRY TO MOTIVATE IT WITH EXAMPLES WHEN I CAN A MIX OF ACCEPTED METHODS AND MY OWN TIPS FROM EXPERIENCE STORE IN YOUR HEAD AND USE LATER --- COMPUTER SCIENCE / SOFTWARE ENGINEERING WHATS THE DIFFERENCE BETWEEN CS AND TRADITIONAL ENGINEERING? LESS RIGID PROCESS MORE FREEDOM ON THE APPROACH YOU TAKE LOWER EXPECTATIONS IN SOME AREAS - SAFETY, COMPARED TO BUILDING A BRIDGE ALLOWS YOU FREEDOM IN OTHERS - SCOPE, INNOVATION SOFTWARE ENGINEERING - INTRODUCE SOME DISCIPLINE --- IDEA / REQUIREMENT SPEC IDEA YOU HAVE / SOMETHING YOU WANT TO DO --- DESIGN TAKE AN IDEA AND SET UP A STRUCTURE THAT YOU CAN THEN BEGIN PROGRAMMING 1. UNDERSTAND THE PROBLEM OR THE SPEC READ THE SPEC A FEW TIMES - MAY TAKE A WHILE IF THE SPEC IS BIG OR FIGURE OUT EXACTLY WHAT YOU WANT YOUR IDEA TO DO / WHAT PROBLEM DO YOU WANT TO SOLVE 2. START AT A HIGH LEVEL * WHAT LANGUAGE TO USE? * WHAT PROGRAMMING PARADIGM? * WHAT DATA STRUCTURES - THIS CLASS WILL HELP THERE * HOW LONG DO YOU HAVE? * HOW MUCH CAN YOU GET DONE IN THAT TIME? * WHAT DO YOU NEED TO TEST? * HOW DO YOU PLAN TO TEST? 3. GET MORE DETAILED WHAT CLASSES, WHAT HIERARCHY WHAT METHODS ETC 4. WORKING IN GROUPS EACH COME UP WITH INDIVIDUAL SOLUTIONS MEET AND BATTLE IT OUT - BEST IDEAS HOPEFULLY WIN DIVIDE THE WORK BIG IDEA - MORE PEOPLE TO WRITE CODE, BUT A LOT MORE TIME COMMUNICATING --- IMPLEMENTATION WHAT THIS CLASS IS ABOUT YOU DO ALL OF THE OTHER STEPS TO MAKE THIS ONE EASIER / POSSIBLE WHY IS PROGRAMMING HARD - * ELEGANCE (BEING CLEVER, GETTING RID OF SPECIAL CASES, BALANCING OTHER CONCERNS) * EFFICIENCY * MAINTAINABILITY / READABILITY - WRITING GOOD CODE IS ANALOGOUS TO WRITING GOOD PROSE - DIFFICULTY IS HOW YOU ORGANIZE IT AND HOW YOU WRITE IT GOOD CODE CAN READ LIKE PROSE 1. ABSTRACTION AN IMPORTANT IDEA IN CS / PROGRAMMING AND IN LIFE ABSTRACT AWAY THE DETAILS THE REASON WE CAN GO THROUGH LIFE IS THAT WE DONT HAVE TO DEAL WITH ALL THE DETAILS THIS IS "CS61B"; WE DONT NEED TO THINK ABOUT EVERY DETAIL 2. PACKAGES - HOW DO YOU WANT TO SPLIT UP THE CODE? SPLIT SIMILAR CODE / CLASSES (BASED ON FUNCTIONALITY) INTO GROUPS LOOK AT THE JAVA STANDARD LIBRARY / API - WRITE THESE OUT - JAVA.NET, JAVA.UTIL, JAVA.LANG 3. INTERFACES GURANTEE THAT CERTAIN CODE WILL ACT IN A CERTAIN WAY ACTS AS A SORT OF CONNECTOR BETWEEN CODE CHUNKS REAL WORLD EXAMPLE - WALL PLUGS. EUROPEANS DECIDED TO DO IT A DIFFERENT WAY; A DIFFERENT INTERFACE PROJ1 - INTERFACE BETWEEN FRONTEND (TEXT OR GUI) IS markTile() (INPUT), getBoard(), getTiles(), getMines(), and toStringBoard(), toStringTiles(), toStringMines() (OUTPUT). THIS IS WHY I COULD WRITE THE GUI DRAW A PICTURE HERE 4. STYLE WRITE SOME OF THESE OUT CONTINUING WITH THE PROSE ANALOGY - YOUR CODE CAN HAVE STYLE JUST LIKE YOUR WRITING * NAMES WHY? MORE READABLE / MAINTAINABLE CODE SHOULD BE DESCRIPTIVE - DONT USE A, B, C HOW LONG? I WILL GO UP TO 5 OR 6 WORDS - TYPING ISNT THE ISSUE IN BIGGER PROJECTS EXAMPLE - LOOK AT THE JAVA API CAPITALIZATION - 2 MAJOR STYLES CLASS NAMES - Start with a capital letter * CONSTANTS IDEA - MAKE LITERALS (0, "STRING", ETC) LESS AMBIGUOUS CAN ALSO QUICKLY AND CONSISTENTLY REPLACE MANY INSTANCES CONSTANTS - ALL CAPS PLACE AT BEGINNING OF FILE GO IN AND MODIFY PLAY MINES GUI, FOR EXAMPLE - CAN CHANGE COLORS WITHOUT KNOWING DETAILS * BRACES / INDENTATION SAME LINE, NEXT LINE INDENTATION STYLE * MODULARITY AT THIS LEVEL AS WELL BREAK THINGS INTO SMALL METHODS - REDUCE BUGS BY FITTING A SECTION OF CODE ON THE SCREEN AT ONCE * IDEAL DESIGN, CODE, RE-DESIGN, RE-CODE BUT, NO TIME CAN MAYBE DO THIS WITH SECTIONS OF YOUR CODE - I DID FOR PLAY MINES GUI --- CODE REVIEW LOOK OVER YOUR CODE LOOK FOR A CERTAIN TYPE OF PROBLEM - SECURITY, FOR EXAMPLE PAIR PROGRAMMING --- TESTING COVERED LAST TIME --- DOCUMENTATION MAINLY COMMENTS, BUT ALSO RELEASE NOTES / USER GUIDE COMMENT UNCLEAR CODE COMMENT METHODS / CHUNKS OF CODE JAVADOC - COOL FEATURE OF JAVA. ANOTHER PROGRAMMER FRIENDLY FEATURE Similar to a C-style comment /** * Text here (formatted like HTML) */ Takes special flags - @author authorName @parameter paramterName description @return description @see, @link - Link to other methods, classes, etc --- RELEASE ADVERTISE GET USER FEEDBACK AND BUG REPORTS GET USERS INVOLVED ---------- EXTRA ---------- --- COMPUTER SCIENCE / SOFTWARE ENGINEERING What seperates computer science from other, more traditional engineering fields? The process is less rigid - There is maybe more freedom in how you go about the process There are lower expectations in some areas (safety, relative to building a bridge, for example), that allow you to do more and branch out further in other areas. --- DESIGN Design - Sometimes this will affect the idea (Sort of a feedback cycle - Draw this in the diagram). What is involved in design? First, define and understand the problem - May require reading the spec several times or really fleshing out the idea. Then sit down and think, on increasingly detailed levels, how you want to solve this problem - What language do you want to use (different languages are good at different things), what are your data structures - Defining your data is good, and this class will help, what programming paradigm do you want to use (tied with the language you use), how do you plan to test it, how long do you have, and how ambitious should you be? Then work into more detail - What classes should you have and how will those be related, what methods do you want to write, what library routines do you want to write or get from elsewhere If working in a group - Each come up with individual ideas and then meet in a group and battle it out, discuss difficult issues, figure out how to divide the work. You will get experience with this later (in upper div classes).