The Way to Produce Good, Clean Code That Will Blow Your Boss Away!

Slides:



Advertisements
Similar presentations
Revealing the Secrets of Self-Documenting Code Svetlin Nakov Telerik Corporation For C# Developers.
Advertisements

By Justin Hendrix. Design Challenges Design is the activity that links requirements to coding and debugging. Good design is useful on small project and.
Chapter 9: Advanced Array Manipulation
Tailoring Needs Chapter 3. Contents This presentation covers the following: – Design considerations for tailored data-entry screens – Design considerations.
Analysis of Algorithms CS 477/677 Instructor: Monica Nicolescu Lecture 5.
High Quality Code – Style Matters  Chapter 5. Design in Construction  Chapter 31. Layout and Style Software Construction by Jeff Nogy.
Software Engineering and Design Principles Chapter 1.
Recursion. Binary search example postponed to end of lecture.
Recursion. Objectives At the conclusion of this lesson, students should be able to Explain what recursion is Design and write functions that use recursion.
COMP205 Comparative Programming Languages Part 1: Introduction to programming languages Lecture 3: Managing and reducing complexity, program processing.
Recursion.
 Last lesson  Arrays for implementing collection classes  Performance analysis (review)  Today  Performance analysis  Logarithm.
Analysis of Algorithms CS 477/677
Recursion Chapter 7. Chapter 7: Recursion2 Chapter Objectives To understand how to think recursively To learn how to trace a recursive method To learn.
Programming Logic and Design Fourth Edition, Comprehensive
1 ES 314 Advanced Programming Lec 2 Sept 3 Goals: Complete the discussion of problem Review of C++ Object-oriented design Arrays and pointers.
Recursion Chapter 7. Chapter 7: Recursion2 Chapter Objectives To understand how to think recursively To learn how to trace a recursive method To learn.
DAST 2005 Tirgul 6 Heaps Induction. DAST 2005 Heaps A binary heap is a nearly complete binary tree stored in an array object In a max heap, the value.
Introduction SWE 619. Why Is Building Good Software Hard? Large software systems enormously complex  Millions of “moving parts” People expect software.
PROGRAMMING LANGUAGES The Study of Programming Languages.
CSE 486/586 CSE 486/586 Distributed Systems PA Best Practices Steve Ko Computer Sciences and Engineering University at Buffalo.
PRAGMATIC PARANOIA Steven Hadfield & Anthony Rice.
Chapter 13 Recursion. Topics Simple Recursion Recursion with a Return Value Recursion with Two Base Cases Binary Search Revisited Animation Using Recursion.
1 Decrease-and-Conquer Approach Lecture 06 ITS033 – Programming & Algorithms Asst. Prof. Dr. Bunyarit Uyyanonvara IT Program, Image and Vision Computing.
Analysis CS 367 – Introduction to Data Structures.
Chapter 13: Implementation Phase 13.3 Good Programming Practice 13.6 Module Test Case Selection 13.7 Black-Box Module-Testing Techniques 13.8 Glass-Box.
Recursion Chapter 7. Chapter Objectives  To understand how to think recursively  To learn how to trace a recursive method  To learn how to write recursive.
MCS 270 Spring 2014 Object-Oriented Software Development.
1 Chapter 5 Software Engineering Practice. 2 What is “Practice”? Practice is a broad array of concepts, principles, methods, and tools that you must consider.
What is a BIOS? * basic input/output system (BIOS), also known as the System BIOS * The BIOS software is built into the PC on a non-volatile ROM and is.
Chapter 13 Recursion. Learning Objectives Recursive void Functions – Tracing recursive calls – Infinite recursion, overflows Recursive Functions that.
Topic 25 - more array algorithms 1 "To excel in Java, or any computer language, you want to build skill in both the "large" and "small". By "large" I mean.
Data Structures Simple Sorts Phil Tayco Slide version 1.0 Feb. 8, 2015.
Analysis of algorithms Analysis of algorithms is the branch of computer science that studies the performance of algorithms, especially their run time.
CSIS 123A Lecture 9 Recursion Glenn Stevenson CSIS 113A MSJC.
CS Data Structures I Chapter 2 Principles of Programming & Software Engineering.
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
1 FUNCTIONS - I Chapter 5 Functions help us write more complex programs.
The Software Development Process
1 CSCD 326 Data Structures I Software Design. 2 The Software Life Cycle 1. Specification 2. Design 3. Risk Analysis 4. Verification 5. Coding 6. Testing.
Goals for Presentation Explain the basics of software development methodologies Explain basic XP elements Show the structure of an XP project Give a few.
An Undergraduate Course on Software Bug Detection Tools and Techniques Eric Larson Seattle University March 3, 2006.
Review 1 Selection Sort Selection Sort Algorithm Time Complexity Best case Average case Worst case Examples.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
The Art of Programming. The process of breaking problems down into smaller, manageable parts By breaking the problem down, each part becomes more specific.
Recall The Team Skills 1. Analyzing the Problem (with 5 steps) 2. Understanding User and Stakeholder Needs 3. Defining the System A Use Case Primer Organizing.
Objectives Understand Corrective, Perfective and Preventive maintenance Discuss the general concepts of software configuration management.
Copyright © 2000, Department of Systems and Computer Engineering, Carleton University 1 Introduction An array is a collection of identical boxes.
Chapter 9 Sorting. The efficiency of data handling can often be increased if the data are sorted according to some criteria of order. The first step is.
High Quality Code – Style Matters  Design in Construction  Layout and Style Software Construction by Jeff Nogy.
CS 162 Intro to Programming II Insertion Sort 1. Assume the initial sequence a[0] a[1] … a[k] is already sorted k = 0 when the algorithm starts Insert.
CS320n – Elements of Visual Programming Assignment Help Session.
Bubble Sort. Sorting  Computers only use numeric values for sorting  Does this mean you cannot sort a file by a character field (such as last name or.
CSC317 1 So far so good, but can we do better? Yes, cheaper by halves... orkbook/cheaperbyhalf.html.
CHAPTER 07 Arrays and Vectors (part II). OBJECTIVES In this part you will learn:  To pass arrays to functions.  Basic searching techniques.
Learning Styles. Numbers The numbers indicate how strongly you prefer one learning style over another. A 1 or 3 means you are pretty well balanced and.
Recursion. Definitions I A recursive definition is a definition in which the thing being defined occurs as part of its own definition Example: A list.
Recursion. Objectives At the conclusion of this lesson, students should be able to Explain what recursion is Design and write functions that use recursion.
Technological Design VS Engineering Design. Technological design and Engineering design are very similar and sometimes the terms are often confused with.
Instructor: Chris Trenkov Hands-on Course Python for Absolute Beginners (Spring 2015) Class #003 (February 14, 2015)
Chapter 15 Running Time Analysis. Topics Orders of Magnitude and Big-Oh Notation Running Time Analysis of Algorithms –Counting Statements –Evaluating.
Investigate Plan Design Create Evaluate (Test it to objective evaluation at each stage of the design cycle) state – describe - explain the problem some.
Winter 2016CISC101 - Prof. McLeod1 CISC101 Reminders Assignment 5 is posted. Exercise 8 is very similar to what you will be doing with assignment 5. Exam.
Survey Training Pack Session 20 – Presentation of Findings.
Lecture 8: Collections, Comparisons and Conversions. Svetla Boytcheva AUBG, Spring COS 240 Object-Oriented Languages.
Effective C# 50 Specific Ways to Improve Your C# Item 44 ~ 45 Kevin2012/9/26 1.
Tools Of Structured Analysis
PROGRAMMING METHODOLOGY
Chapter 7: Input Validation
Presentation transcript:

The Way to Produce Good, Clean Code That Will Blow Your Boss Away!

How Not To Code /* Use the insertion sort technique to sort the "data" array in ascending order. This routine assumes that data[ firstElement ] is not the first element in data and that data[ firstElement-1 ] can be accessed. */ public void InsertionSort( int[] data, int firstElement, int lastElement ) { /* Replace element at lower boundary with an element guaranteed to be first in a sorted list. */ int lowerBoundary = data[ firstElement-1 ]; data[ firstElement-1 ] = SORT_MIN; /* The elements in positions firstElement through sortBoundary-1 are always sorted. In each pass through the loop, sortBoundary is increased, and the element at the position of the new sortBoundary probably isn't in its sorted place in the array, so it's inserted into the proper place somewhere between firstElement and sortBoundary. */ for ( int sortBoundary = firstElement+1; sortBoundary <= lastElement; sortBoundary++ ) { int insertVal = data[ sortBoundary ]; int insertPos = sortBoundary; while ( insertVal < data[ insertPos-1 ] ) { data[ insertPos ] = data[ insertPos-1 ]; insertPos = insertPos- 1; } data[ insertPos ] = insertVal; } /* Replace original lower-boundary element */ data[ firstElement-1 ] = lowerBoundary; }

How Not to Manage Your Software Project

The Result of Bad Coding…...Poor Joel

Managing Complexity When projects fail due to technical reasons, most often it is due to uncontrolled complexity. There are two different classes of complexity: - Accidental - Essential

Fighting Complexity The key to beating complexity is a two- pronged approach. – Reduce the total essential complexity that any one person may have to deal with at one time. -- Prevent accidental complexity from unnecessary dissemination.

Design Through a Little T & E Designing is a heuristic process. This all means that designing involves trial and error testing. While initial steps of design may start with a basis of what to try, nothing is guaranteed to solve the design dilemma.

When you think you have found a good design solution, continue looking, and try another. Iteration helps one gain more understanding about the design both from a high-level and a low-level perspective. Iterative Design

Information Hiding Information hiding is vital for any design. It is one of the few theoretical techniques that has been inarguably shown as valuable for its contribution toward a good design. Asking the question “What should I hide?” will help to remove a lot of the confusion.

Illuminating the Logical Organization The one key to visual layout is to enunciate the logical organization of the code. Four characteristics determine if this is successful: – Correctly shows the logical structure – Constantly shows the logical structure – Enhances readability – Persists through modifications

Looking Good is Secondary Pretty looking code is always second to code that shows its structure. General rule is that logically organized code will make good looking code.

Pure-Block Layout Use Visual Basic and enjoy pure-block layout! It is pretty code, formatted for you! Strongly recommended to use this layout for our viewing pleasure. For C++, either pure-block or begin-end block boundaries work well.

Consistent Code Structuring We need to make sure that code is readable not only by humans, as well as computers. The details are less important it is that the program is consistently structured. Martin Fowler

Weeding Through Potential Layouts Use the criteria for a good layout to determine the subjective reasons versus the objective reasons. Weighing the different advantages of layouts will help determine how effective each one is.

Good Code Summary Coding is trial and error, do not expect to find your solution right off the bat. Reduce complexity! Enhance code layout through a structure- based code layout. Keep it consistent!