Presentation is loading. Please wait.

Presentation is loading. Please wait.

ENEE150 – 0102 ANDREW GOFFIN Functional Decomposition.

Similar presentations


Presentation on theme: "ENEE150 – 0102 ANDREW GOFFIN Functional Decomposition."— Presentation transcript:

1 ENEE150 – 0102 ANDREW GOFFIN Functional Decomposition

2 Why use functions? Code Reuse Splitting Up Functionality Readability Ease of testing Separating use and implementation Goffin – ENEE150

3 Choosing Functions Top down design  Look at high level description and split up the functions from there Bottom up design  Building up from basic functions Typically use top down, and look for  Repeated modules  Hierarchy  Logical units Goffin – ENEE150

4 Declaring Functions Function prototype Function implementation Function prototypes allow freedom of where you put your implementations in the program Implementation has return type, name, and input variables Goffin – ENEE150

5 Code Example – Robot Control Goffin – ENEE150

6 Multiple Modules Can split code up into multiple.c files When compiling, just type:  gcc …  Will still compile to one a.out file Goffin – ENEE150

7 Project 1 - Chess Note that queen is just a bishop and a rook put together King is a queen that only moves one space Goffin – ENEE150

8 Project 1 - Chess Mainly just implementing move checks MUST use functions listed, but you can (and are encouraged to) create more Goffin – ENEE150

9 Project 1 - Chess Pawn and general game logic should come FIRST  Don’t start with knight… that’s going to be looked at last for grading  Cannot actually move most of the pieces without moving the pawn anyway No checks/checkmates/queening pawns  Only implement what’s listed in the project description Start project ASAP  The full two weeks are likely needed Goffin – ENEE150


Download ppt "ENEE150 – 0102 ANDREW GOFFIN Functional Decomposition."

Similar presentations


Ads by Google