Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Dfd2

961 views

Published on

  • Login to see the comments

  • Be the first to like this

Dfd2

  1. 1. Data Flow Diagram (Design)
  2. 2. Overview:-Overview:-  Data flow diagrams(DFD) are commonly used during problem analysis.  DFD is an useful tool for software engg as well as for the developmnet of other systems.  In fact, dfds have in use long before the discipline of software engg started.
  3. 3. Salient features of any DFD:-Salient features of any DFD:-  DFDs are basically used to show the flow of data through a system.  The System may be an organization,a manual procedure, a software system, a mechanical system,a hardware system or any possible combination of these.  There are several processes in a dfd. Each process is shown by named circles(or bubbles).
  4. 4. Salient features of any DFD(contd….)Salient features of any DFD(contd….)  Data flows are represented by named arrows entering (or leaving) the bubbles.  A rectangle represents the source which is either a net originator or consumer of data.  All external files are shown as a labeled straight line.  When multiple data flows are required by a system this is represented by a ‘*’ between the data flows.This symbol represents the AND operation.
  5. 5. How is a DFD different from aHow is a DFD different from a flowchart?flowchart?  One must always remember that a dfd is not a flowchart.  While a DFD represents the “flow of data” a flow chart shows the “flow of control”.  A dfd does not represent procedural information.For eg:- considerations of loops and decisions must be ignored.  In drawing the dfd the designer has to specify what are the major transforms in the flow of the data from the input to the output.
  6. 6. How is a DFD different from aHow is a DFD different from a flowchart?(contd…)flowchart?(contd…)  How the transforms are occurring is not the concern of the designer.  Error messages are not shown in the dfd.
  7. 7. DFDs for large systems(LeveledDFDs for large systems(Leveled DFDs)DFDs)  Many systems are too large for a single dfd to represent the entire data processing clearly.  So, it becomes necessary that some decomposition and abstraction mechanisms be used for such large systems.  DFDs can be hierarchically organized which helps in progressive partitioning and analyzing of large systems.  Such dfds are called “Leveled DFD set”
  8. 8. How to draw a Leveled DFD set?How to draw a Leveled DFD set?  A leveled DFD set has a starting dfd, which is a very abstract representation of the system identifying the major inputs ,outputs and the major processes in the system.  Then each process is refined and a dfd is shown for the corresponding refinements.  In other words, a bubble in a dfd is expanded into another dfd during refinement.  For the hierarchy to be consistent ,it is necessary that the net inputs and outputs
  9. 9. How to draw a Leveled DFD set?(contd…)How to draw a Leveled DFD set?(contd…) of a dfd for a process are the same as the inputs and the outputs of the process in the higher level dfd.  This refinement stops if each bubble is considered to be “atomic” ; in that case each bubble can be easily specified or understood.  The top level dfd is sometimes called the “context-diagram”.
  10. 10. Suggestions for DFD construction:-Suggestions for DFD construction:-  Start with a data flow graph with a few major transforms describing the entire transformation form the inputs to the outputs and then refining each transform with more detailed transforms.  We must never try to show the control logic.If we find ourselves to be thinking in terms of loops and decisions then it is time to stop and start again.
  11. 11. Suggestions(contd….)Suggestions(contd….)  Label each arrow with proper data elements and inputs and outputs of each transform needs to be carefully identified.  Make use of ‘*’ and ‘+’ signs and show sufficient data in the data flow graph.  Try and draw alternate data flow graphs before settling on one.  After drawing the dfd the next step is to establish a man-machine boundary by specifying what will be automated and what will remain manual in the dfd for the new system.
  12. 12. Data Dictionary:-Data Dictionary:-  Data dictionary is almost a data structure that keeps track of information about data flows.  Data dictionary states precisely the structure of each data flow in the dfd.  The structure of a data could be defined with different notations which are almost similar to those used for regular expressions.
  13. 13. Data Dictionary:-(contd…)  Some of the commonly used notations are as below:-  “+” indicates composition.  “|” indicates one OR the other.  “*” indicates one or more occurences.
  14. 14. DFD of a System that Pays Workers : Employee Record Company Records Weekly Timesheet Tax Rates Get Employee File Weekly Pay Overtime pay Deducted Pay Issue Pay Check Worker Overtime Rate Overtime Hours Regular Hours Employee Id Pay Rate Pay Net Pay Total Pay Check Worker
  15. 15. Analysis of the dfd system for payment of worker’s:-  In this dfd there is one basic input data flow and that is the weekly time sheet, which originates form the source worker.  The basic output is the paycheck, the sink for which is also the worker.  In this system first the employee’s record is retrieved using the employee id,which is contained in the timesheet.
  16. 16. Analysis of the dfd system for payment of worker’s:-  From the employee record the rate of payment and overtime rate are obtained.These rates and the regular overtime hours(from the timesheet) are used to compute the pay.  After the total pay is determined,taxes are deducted.
  17. 17. Analysis of the dfd system for payment of worker’s:-  To compute the tax deduction,information from the tax-rate file is used.The amount of tax deducted is recorded in the company and employee records.  Finally the paycheck is issued for the net- pay.The amount paid is also recorded in the company records.
  18. 18. A sample Data dictionary:-  The data dictionary for the problem involving the payment of workers is as below:-  Weekly timesheet=Employee_name+Employee_id+ [Regular Hours+Overtime Hours]*  Pay_rate=[Hourly|daily|weekly]+Dollar_Amount  Employee_name=First+Middle+Last  Employee_id=digit+digit+digit+digit
  19. 19. An Example :A restaurant SystemAn Example :A restaurant System A restaurant owner felts that some amount of automation will help him in making the business more efficient . DIFFERENT PARTIES INVOLVED: CLIENT: The Restaurant Owner POTENTIAL USER: Waiter, Cash register Operator
  20. 20. DFD of a Restaurant System Supply Information Member Sale Information Restaurant Supplier Customer Supply OrderOfSupplier Paym ent O rders Receipt Final Bill Several Bill
  21. 21. Data Flow Diagram of Spell Check Problem:Data Flow Diagram of Spell Check Problem: New Dictionary Misspelled Word Get File Name Split the Words Sort Words Lookup Dictionary Handle Unknown Word User Command FileName Document W ord List Sorted W ordList Dictionary Word not In Dictionary Dictionary Good Words Bad Words
  22. 22. Problem 2:Problem 2: Library System:Library System: Needs Books Checks The Collection Arranges Signed on The card DeliverReadsReturnsRecollect File name Reader Preferable Book Librarian Books The Particular Book Library Card Selected BookReader Library card Books
  23. 23. Jackson Structure Programming (JSP)
  24. 24. Jagson’s Structured Programming(JSP):-  JSP is a systematic technique for mapping the structure of any problem into a program structure.  The 3 steps for construction of any JSP are:-  To draw the “data structure diagram” for each data set.  Form a “program structure diagram” from the data structure diagram.  List all “operations” ,”functional components” and “conditions”.
  25. 25. JSP for Account Processing System:- FILE CUSTOMERS ACCOUNTS TRANSACTIONS WITHDRAWL DEPOSIT
  26. 26. Data Structure Diagram: Transaction File File Header File Body End of File Masker Customer Accounts Account Header Account Body Transaction Deposit With Drawal
  27. 27. Program Structure Diagram ProcessProcess TransactionTransaction FileFile Program StartProgram Start (1,3)(1,3) Program BodyProgram Body (c1)(c1) Program EndProgram End (2,6)(2,6) Process CustomerProcess Customer (c1 or c2)(c1 or c2) Process Customer StartProcess Customer Start (7)(7) Process Customer BodyProcess Customer Body Process accountProcess account Process Account StartProcess Account Start (3,8)(3,8) Process Account BodyProcess Account Body (c1 or c2 or c3)(c1 or c2 or c3) Process TransactionProcess Transaction Process DepositProcess Deposit (3,4)(3,4) Process WithdrawalProcess Withdrawal (3,5)(3,5)
  28. 28. Operations:- 1. Open Transaction File. 2. Close Transaction File. 3. Read a Record form the file. 4. Add Amount deposited to the total amount. 5. Add amount withdrawn to the total amount. 6. Output the two totals. 7. Set Current Cust_no Cust_no 8. Set Current Acct_no Account_no
  29. 29. Conditions:-  C1 EOF  C2 Cust_no = Current Cust_no  C3 Acct_no = Current Acct_no  C4 Deposit  C4 WithDrawal
  30. 30. JSP for Spelling Checker’sJSP for Spelling Checker’s Problem:-Problem:-  Components:- a)Document File b)Dictionary File c)Mispelled Words File  Conditions:- C1 EOF
  31. 31. Spell Check Problem This problem took each word used in a document and in a dictionary. If a word appears in the dictionary then the word is correct .Otherwise it is displayed in the user terminal, The user then decides if the word is misspelled ,the word is held in a file of misspelled words and if correctly spelled then it is added to the dictionary
  32. 32. Procedure of Spell check problem: Begin loop get next word add word to word list in sorted order end from the loop when all word are processed endloop
  33. 33. contdcontd……..…….. loop get word from sorted word list If word is not in dictionary then display the word and prompt on the user terminal if user response says word ok then add word to the dictionary else add word to misspelled word list end if
  34. 34. ContdContd end if exit when all words are processed end loop end
  35. 35. Document Misspelled Word List Dictionary New Dictionary Basic diagram of Spell Check Problem Spell check Problem T1 Sorting T2 Dictionary
  36. 36. Data Structure Diagram Of Spell Check Problem MisspelledMisspelled WordWord FileFile FileFile HeaderHeader FileFile BodyBody EOFEOF MarkerMarker MisspelledMisspelled WordWord ** GoodGood WordWord BadBad WordWord DocumentDocument FileFile FileFile HeaderHeader FileFile BodyBody EOFEOF MarkerMarker WordWord DictionaryDictionary FileFile FileFile HeaderHeader FileFile BodyBody EOFEOF MarkerMarker MeaningfulMeaningful WordWord
  37. 37. Program Structure Diagram Of Spell Check Problem ProcessProcess Spell CheckSpell Check Program startProgram start (1)(1) Program BodyProgram Body (c1)(c1) Program EndProgram End (2)(2) ProcessProcess DocumentDocument ** Start DocumentStart Document Process(3,4)Process(3,4) Document ProcessDocument Process BodyBody ProcessProcess WordWord ** Start ProcessStart Process WordWord Process WordProcess Word BodyBody ProcessProcess DocumentDocument **
  38. 38. Cont… Process DictionaryProcess Dictionary ** Start DictionaryStart Dictionary Process(5)Process(5) Dictionary ProcessDictionary Process BodyBody Process MisspelledProcess Misspelled Word *Word * Start Misspelled WordStart Misspelled Word Process(6,7)Process(6,7) Misspelled WordMisspelled Word Process BodyProcess Body Good WordGood Word (3)(3) Bad WordBad Word (8)(8) Process DictionaryProcess Dictionary (9)(9)
  39. 39. Operations:- 1. Open document file and dictionary. 2. Split the document into words. 3. Sort the words. 4. Lookup the sorted words in the dictionary. 5. Collect the mis-spelt words or output them. 6. Add mis-spelt words to mis-spelt word list. 7. Identify good words form mis-spelt words. 8. Add good words to the dictionary. 9. Output the bad words to the user. 10. Close the file.
  40. 40. Bank Problem:- A problem is received to process Bank transaction keyed in at a terminal .The Program is to be menu driven & the menu gives user three option 1. Input of deposit 2. For input of withdrawal 3. Terminate program ( option-9) Deposit are to be written to the deposit file and withdraw are to be written in withdrawal file. Additionally file trailers are to be appended to deposit and withdrawal file containing the total deposit and withdraw respectively
  41. 41. Data Structure Diagram of Bank Transaction (Screen Data Structure Diagram) Screen InputScreen Input (1)(1) Input BodyInput Body (2)(2) Option-9Option-9 Terminate(3)Terminate(3) MenuMenu ** Option -1Option -1 Deposit (4)Deposit (4) Option -2Option -2 Withdraw (4)Withdraw (4) InvalidInvalid OptionOption
  42. 42. Data Structure Diagram Of Deposit File and Withdrawal File Deposit FileDeposit File (1)(1) File BodyFile Body (2)(2) File TrailerFile Trailer (3)(3) DepositDeposit ** (4)(4) Withdrawal FileWithdrawal File (1)(1) File BodyFile Body (2)(2) File TrailerFile Trailer (3)(3) WithdrawalWithdrawal ** (5)(5)
  43. 43. Program Structure Diagram of Bank Transaction Problem Process Screen Input Program Start (1,3,4,5) Program Body (c3) Program End (2,13,14) Process * Menu Process Menu Body(c1,c2) Process Menu End Process Option-1 Deposit (7,9,11) Process Option-2 Withdrawal (8.10.12) Process
  44. 44. Data Structure Diagram of File copy Problem INFILE 1INFILE 1 INFILE 1INFILE 1 ** INFILE 2INFILE 2 ** INFILE 2INFILE 2
  45. 45. Program structure Diagram of File Copy Copy INFILE1 ToCopy INFILE1 To INFILE2INFILE2 Program StartProgram Start (1,3)(1,3) Program BodyProgram Body (C1)(C1) Program EndProgram End (2)(2) Copy INFILE1 ToCopy INFILE1 To INFILE 2INFILE 2 (3,4,5)(3,4,5)

×