0

How to draw a program graph similar to but with multiple methods?

As it seems the flow of data across methods are not necessarily in the order of declaration.

enter image description here

Mulitple Classes

 public class Temp
    {
        //
        private int lowThreshold = 18200; // 1
        private int firstTier = 37000; // 2
        private int firstTierBase = 3572; // 3
 

        public Temp(int income, int age, bool medicareLevy, bool TBRLevy, bool LILevy) // 4
        {
            actualIncome = income - ReturnTax(income, age, medicareLevy, TBRLevy, LILevy); //5
        }
        private double ReturnTax(int income, int age, bool medicareLevy, bool TBRLevy, bool LILevy) // 6
        {
            double stage1 = 0.19; // 7
            double stage2 = 0.325; // 8
            double stage3 = 0.37; // 9
            double stage4 = 0.45; // 10
            double medicareLevyCharge = 0.02;  // 11
            double TBRLevyCharge = 0.02; // 12
....

0

Methods are isolated blocks of code, with one entry point and many exit points.

If, e.g. on node #11 you had:

type = 2;
foo(type);

you would draw an arrow from #11 to a special node that represents foo(). The exit of this special node would point to #16.

If the reader of your diagram wants to understand what is inside foo(), he/she can look at another diagram that shows foo() data flow.

| improve this answer | |
  • Hi Joao, so the program graph will be drawn based on the order of the execution but not the order of methods/fields declaration? – Jim_Mcdonalds Sep 17 at 22:41
  • Yes, it will depend on what is getting called in each function, not how you organized the functions. – João Farias Sep 18 at 5:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.