3.3.1 • What is a Data Flow Diagram? • Why are they used? • How to draw them. “A data flow diagram is used for the visualization of data processing. It illustrates the processes, data stores, external entities, data flows in a business or other system and the relationships between these things.” - Wikipedia • In order to design a new system you need to be able to work out how data flows through a system. • During the analysis stage of the system life cycle the analyst would have worked this out by using Data Flow Diagrams (DFDs). • The DFD will show: – – – – External entities Processes Data stores Flow of data and information Anything that interacts with the system. Could be people, organisations or other systems. Generally, external entities input or receive data. This is an activity that takes place inside the system. It uses inputs to produces outputs. This is where data is stored (database, spreadsheet, paper form, filing cabinet etc). Show the direction that data flows through a system. 2.0 Check Stock Check stock levels aren’t below value n. The process has three boxes. Top Left: This indicates the process number. Top Right: This is the process name. Bottom: This explains what the process does. D2 Stock The process has two boxes M2 Invoices Left: This indicates the type of data store. D: Computerised data store (database etc) M: Manual data store (paper, filing cabinet etc) Right: This is the name of the data store. Stock If a data store is repeated then this is indicated by removing the identifier from the repeated symbol and placing an additional vertical line into the symbol. Customer Customer This box contains the name of the entity. If the entity repeats for example, a customer inputs data into the system and the same customer retrieves an output from the system. then a diagonal line is drawn to represent this. • A DFD can been drawn to different levels of complexity. • At a basic level, (aka Context Level or Level 0), the diagram only gives a summary of the system. • It will only show the external entities, the inputs and the outputs. • It DOES NOT show the processes involved. Customer details Reject rental DVD Rental System Customer Customer DVD details Accept rental Customer details Reject rental DVD Rental System Customer Customer DVD details Accept rental As you can see, this context diagram only shows: - External Entities - Basic Inputs - Basic Outputs Customer details Reject rental DVD Rental System Customer Customer DVD details Accept rental As you can see, this context diagram only shows: - External Entities - Basic Inputs - Basic Outputs Customer details Reject rental DVD Rental System Customer Customer DVD details Accept rental As you can see, this context diagram only shows: - External Entities - Basic Inputs - Basic Outputs Customer details 1.0 Receive Receive details into the system. Customer DVD details Customer details 1.0 Receive Receive details into the system. Customer DVD details Detail 2.0 Valid Check membership. < 3 DVDs rented? Banned? D1 Membership Customer details 1.0 Receive Receive details into the system. Customer DVD details Detail 2.0 Valid Check membership. < 3 DVDs rented? Banned? D1 Membership D2 Rentals Detail 3.0 Update Add loan details to rental database. Customer details 1.0 Receive Receive details into the system. Customer DVD details Detail 2.0 This diagram shows more detail compared to a context diagram. Valid Check membership. < 3 DVDs rented? Banned? D1 Membership D2 Rentals D3 DVD Detail You can see the processes and the data stores. 3.0 Update Add loan details to rental database. Detail 4.0 Customer Update DVD Update status of borrowed DVD. • Look closely at the previous DFD. • Notice how where there is a data store you could relate this to a table in a database. • Notice how where there is a process you need to have a query. • Notice how where there is data flow you need to have an input into a system. • Notice how where there is data flow out of a system there is need for a report. • A DFD can help design a database if done correctly. • If you look closely, you can notice that some sections can be broken down further. • Section 2 can be broken down to show the processes of checking if the person is a member, and doesn’t already have 3 DVDs on loan and isn’t blocked on the system. • This would be known as a Level 2 DFD. • Draw and label the four symbols you’d expect to find in a DFD diagram. • Why is it sometimes more suitable to draw a diagram than explain a system in words? • Explain how a DFD could help a database designer. • Create a Level 0 and Level 1 DFD which looks at what happens when you buy a pair of trainers from a shoe shop. • The scenario... – You have gone into a shoe shop and found a pair of really wicked trainers that you like. You have asked the shop assistant if they have your size. The shop assistant checks on her PDA to see if your size is available. Success! They have your size and you purchase the trainers. The system automatically updates the stock database. You walk away safe in the knowledge that your new trainers will allow you to run and jump faster than everyone else now!