Slashdot Mirror


How Do OOP Programmers Flowchart?

Lew Pitcher queries: "I recently attended a presentation of a code documentation tool that, among other things, produced a flowchart of the analyzed code. The vendor sells this one product for analyzing both mainframe code (COBOL, 390 Assembler, PL1, etc.) and 'distributed' code (C#, Java, C++, Smalltalk, etc). I haven't kept up with the 'modern' techniques (I prefer Nassi-Shneiderman charts, but I still have my flowcharting template), and wondered if modern 'OOP' programmers use flowcharts. If they don't, what is the preferred technique for diagramming an OOP program?"

19 of 134 comments (clear)

  1. Legos by Anonymous Coward · · Score: 5, Funny

    I build my objects out of legos.

  2. In uml by sporty · · Score: 4, Informative

    In uml, with activity diagrams, and class diagrams.

    --

    -
    ping -f 255.255.255.255 # if only

  3. If you've got any sense you don't use flowcharts by WolfWithoutAClause · · Score: 4, Informative
    The nearest thing to flowcharts that are used in OO are:
    • state diagrams
    • message sequence charts
    Neither are flowcharts, and if you try to use them as flowcharts (which I have seen done :-( ), bad things (tm) happen to your design. (States on state diagrams are states that parts of the system are supposed to be in for extended periods- message sequence charts are different because the flow is usually multitasking/parallel processing).

    Personally, if I see somebody drawing a flowchart, I know they aren't currently up to scratch (which doesn't mean that they can't get better).

    Actually, flowcharts are good for telling users what to do, and for similar reasons, might be appropriate for designing test scripts. But for the system- nope.

    --

    -WolfWithoutAClause

    "Gravity is only a theory, not a fact!"
  4. UML Sequence diagrams by cogpp · · Score: 4, Informative

    UML sequnce diagrams can be pretty useful to show these things. Especialy if you have asyncronus events, or multiple threads or processes, which ordinary flow charts dont model very well. PDF on sequnce diagrams.

  5. Never used them by Scarblac · · Score: 5, Insightful

    I've been programming for 19 years now; started my CS study 12 years ago; programming professionally for a few years. I used Java, and fast development languages like Python. I've never seen a flow chart in practice, let alone used one. So it's a bit hard to say.

    Somehow flow charts seem fit only for relatively short programs, that have a clear flow from A to B. My programs are web apps that constantly react to requests from web forms that are sent in, supported by a bunch of scripts running from cron to periodically update database stuff. Program-wide, there is no single flow.

    On the method-level (or the Action level, I build a large J2EE app with Struts), we could use flow charts I suppose. But they look pretty cumbersome; mostly I just write out what the method is going to do in a comment in English and/or pseudocode, and from that I write down the code.

    What each action is supposed to do, and what each method of an object is supposed to do, that is (should be) designed beforehand. There you get tools like UML, if you want to use something like that. What we design is the data objects, and the interface they should expose, and so on.

    How those methods do their work is decided at coding time, and is the only place where traditional flow charts seem applicable.

    Just some thoughts, I don't know if I'm making sense, since mostly I get very little time for any design at all, in reality...

    --
    I believe posters are recognized by their sig. So I made one.
  6. Here's the new "modern technique" by illuminatedwax · · Score: 5, Funny
    Here's the new "modern technique"... pay attention, it gets complicated!
    .______________.
    | o o o o o o o|
    | Outsource to |
    | o .India. o o|
    |______________|
    o o o o|o o o o
    o o o .V. o o o
    o o o END o o o

    --Stephen

    --
    Did you ever notice that *nix doesn't even cover Linux?
  7. as already mentioned by others by jeffy124 · · Score: 3, Informative

    The Unified Modeling Language.

    Start Here, then try google for more introductory articles that are out there.

    If you want books on the topic, I recommend UML Distilled by Martin Fowler for a quick intro, then branch out from there. (There's hte Object Technology series from Addison-Wesley, which are usually very good, but they're not the only UML books out there) I also recommend you download a UML tool (there are a bunch out there - free as in beer, Open Source, or try a commercial trial version)

    As for flowcharting, there are several model types in UML to handle it. Activity diagrams come immediately to mind (these are very close to the classic flowcharting techniques), but state charts and sequence diagrams are useful also to supplement an activity chart. Also look into the structural models - class diagrams, deployment charts, etc. when assembling/designing your program.

    UML is language independent - meaning it's not explicitly tied down to one specific language. Although, it is useful to keep in mind what language you plan on using when authoring in UML.

    --
    The One Rule Of Chess You'll Ever Need: Don't play someone who carries a kit in their bookbag.
  8. Re:Nobody uses flowcharts any more by abrotman · · Score: 3, Informative

    You dont use them because you're a programmer. There's a big difference between a software programmer and a software engineer.

    Please try going to IBM/HP/Oracle and tell them to implement you a 10 million dollar software solution but tell them you don't want them to spend time doing any actual planning. You'd just like them to start coding immediately.

    Every large project should use some sort of diagramming/planning. Can you get away with no flow-chart for a website or maybe even a 100,000 line program .. sure. Try something 10-100 times larger. While you're at it .. don't bother commenting your code either.

    Programming/Developing/Engineering is still a science. There is a certain inherent "art" which makes some people better than others. But it is still a science.

  9. Re:OOP coders don't flowchart by rmohr02 · · Score: 4, Funny

    Thanks
    for
    adding
    your
    own
    newlines
    it
    make s
    things
    so
    much
    easier
    to
    read.

  10. Re:If you've got any sense you don't use flowchart by laughing_badger · · Score: 3, Interesting
    Personally, if I see somebody drawing a flowchart, I know they aren't currently up to scratch (which doesn't mean that they can't get better).

    [Looks up from flowchart] None taken...


    Actually, flowcharts are good for telling users what to do, and for similar reasons, might be appropriate for designing test scripts. But for the system- nope.


    This depends strongly on the system.

    For a system that takes in data, performs computations, and spits out answers, a structured design using flowcharts is often appropriate.

    That said, implementing part of that design using OO code can be useful. For example, using C++ with a matrix class to do geometry based processing. The actual process may best be described as a flowchart though.

    OOA/OOD/OOP are not the silver bullets. I've seen a major revision of a large commercial computational program wither on the vine due to misunderstanding how to best apply object based thinking. 'Everywhere' is not the right answer.

    --
    Help children born unable to swallow - www.tofs.org.uk
  11. Re: How Do OOP Programmers Flowchart? by manavendra · · Score: 3, Informative
    OO programming defines and to some extent mandates more concrete and phased flow-control diagrams than a regular flowchart.

    In typical structured programming, there is more emphasis on control flow. Furthermore, for any modestly sized software, you will need flowcharts withy varying detail - those depicting the overall flow, flow for a particular user, flow within a particular module, and so on. This essentially leaves the decision of detail to each organization and/or author, and we can thus argue this approach introduces a certain vague-ness.

    OOP, on the other hand, provides more detailed and clearer demarcation for each of these entities.

    • Use Cases - model the functionality of system and the path of interaction of different users with it.
    • Activity Diagrams - depict the dynamism of the system and model the control flow from activity to activity. You can use these to model workflow and business processes.
    • Statechart Diagrams - depicts the dynamic response of the system in response to external stimuli.
    • Sequence Diagram - describes the interactions between different components (classes) in terms of message/data exchange over time.
    • Class Diagram - some call it the backbone of OOP. These diagram depict the various entities in your system and the relationships/associations among them.
    • Object Diagram - describe the snapshot of entities in the system at a given time. You can use these to examine the overall system state at any time, and verify your class diagram
    • Package Diagram - More useful for teams/people responsible for managing deployment and building the system, package diagrams describe the grouping and packaging of your classes.
    • Deployment Diagram - depicts the physical resources in the system and how they are deployed (locally, remotely, whether as nodes, connections, etc.)
    --
    http://efil.blogspot.com/
  12. Re:If you've got any sense you don't use flowchart by sartin · · Score: 4, Informative
    For a system that takes in data, performs computations, and spits out answers, a structured design using flowcharts is often appropriate

    This goal is often achieved with a Data Flow Diagram which many people mistake for a flow chart. Structured analysis/design techniques from the 1970s and 1980s developed the DFD concept as part of the problem analysis phase. Search for the likes of Coad, Yourdon, DeMarco, Gane and Sarson. Some of these names are still familiar in the OO design world. The key differences between a DFD and a flow chart are:

    • DFD does not imply sequencing of operations. Processes in a DFD can run in parallel.
    • Definition of the data stores. A DFD typically includes definitions of the data stores and not simply the steps that will be taken to process the data.

    In the 1980s, lots of people tried to slap object-oriented deisgn onto structured analysis using various techniques (like making the processes or data stores the objects). It didn't work out so well. Eventually, we got to UML from there after 10-15 years of haggling and stumbling; some argue that it still isn't working out so well.

  13. Re:Nobody uses flowcharts any more by Twylite · · Score: 3, Insightful

    You're probably a troll, but I'll bite.

    Flowcharts are an incredibly useful tool, but as with all tools the trick is not knowing how to use them, but when to use them.

    There are at least two core areas where flowcharts are still pertinent in modern development:

    1. Modeling user interaction.
      UML does not offer an adequate solution for modeling user interaction. A Use Case gives a high level name to interaction, and can be described, but often the description is inadequate to satisfy the user's requirements. Sequence and collaboration diagrams present the message flow between objects, but do not succinctly present the user experience.
      In the analysis phase, understanding the user expierience is vital. Developers and non-technical customers can easily understand Use Case diagrams (what you can do with the system) and flowcharts of interaction explaining the Use Cases (how you do it).
    2. Modeling atomic processes or algorithms.
      Under the hood, every OO language has a core that provides for sequential execution of instructions with branching and looping. A flowchart can graphically clarify a complex process or algorithm that cannot be further reduced into objects (at best it may be functionally decomposed), and would be poorly described by pseudocode.

    Web interfaces and embedded systems are examples of other areas where flowcharting can be invaluable.

    In the case of user interaction (the more common use of flowcharts Information Systems) a developer will seldom see or directly use the flowchart. Instead the interaction described by the flowchart will be translated by a designed into class, sequence and collaboration diagrams that describe the implementation of the operation the user is trying to achieve.

    --
    i-name =twylite [http://public.xdi.org/=twylite], see idcommons.net
  14. Re:Nobody uses flowcharts any more by Mr.+Slippery · · Score: 3, Insightful
    Every large project should use some sort of diagramming/planning.

    Planning, of course; diagramming, not so much. Design should be done primarily using English (or your local language) text, supplimented with diagrams.

    Software is a linguistic construction; blueprints or schematic diagrams are not as useful as they are in electronics or building construction. The fetish for diagrams over text usually indicates someone who can't write decent prose. And if you can't write decent prose well, you can't write decent code. (Besides a mathematical inclination, an exceptionally good mastery of one's native tongue is the most vital asset of a competent programmer. -- Dijkstra)

    --
    Tom Swiss | the infamous tms | my blog
    You cannot wash away blood with blood
  15. Twisted technique... by JediTrainer · · Score: 3, Funny

    What if I outsourced my *own* job to India? Pay some guy $100 per month to do my job, so I can sit on my ass all day and play games? Heck - get two guys - it's time for a raise!

    Anybody try it? Can it be done?

    --

    You can accomplish anything you set your mind to. The impossible just takes a little longer.
  16. Whiteboard... by SuperChuck69 · · Score: 5, Insightful
    When I have a complicated problem that requires some design (which is, unfortunately, not very often), I use a very complex system which involves sketching some boxes on a whiteboard, often connecting them with vague lines. I occasionally jot some method names down next to or inside the boxes

    Personally, I'm wary of any formalized system of object design (UML being the prevailing method at the moment). UML is a beast designed to design the hell out of anything that got in its path. Learning UML is roughly as complicated as learning Hebrew, with the drawback that more people actually understand Hebrew.

    Most of my experience with UML and other formal object languages involve one individual scrawling archaic symbols (which may well be astrology charts) on a whiteboard whilst everyone else in the room constantly ask "what does that symbol mean?" The designer invariably explains the symbol, in as condescending a tone as possible.

    I don't believe I've actually met anyone who uses formal modelling languages because it makes design easier; most seem to learn them solely for demeaning those who don't know them.

    Given that the goal of these languages is to communicate design, they must be failures. Rather than simplify the communication of a design, they complicate it. Really, it makes no more sense than me using Latin for all my design notes, just to insult my barbarus coworkers. Well, that does no good.

    I've found that using simple symbols such as "abstract" to denote an abstract class works just fine. Works fine for me, saves explaining what a lambda symbol means, and clearly explains its intent as an abstract class...

    --
    :wq
  17. Why do you need a graphical representation? by CatGrep · · Score: 5, Interesting

    A lot of folks will tell you that they use UML in place of flowcharts for OO design. I say that the UML emperor is naked.

    Chip designers (I used to be one) in the old days (before about '92) used to use schematics which are pictorial representations of their designs. But in the early 90's HDLs (hardware description languages) bagan to creep in. Now you rarely find schematics used for digital design. It's all done in HDLs. Why did this happen? Mainly because it's a whole lot easier and more powerful to describe a circuit with an HDL. You don't have to draw all those wires to connect everything. You can describe things at a very high level, such as an adder to add two 32bit values: A + B (where A and B are 32 bit vectors). What could be simpler.

    Another reason that schematics were abondoned is that it's a lot easier to parse text than graphics. The UML promoters should take note.

    Now the UML folks are essentially trying to take software design back to the schematic age. The hardware people learned that schematics are not the best representation.

    The answer is to program at a higher level of abstraction. This might mean chosing a higher-level language to prototype in (I like prototyping in Ruby) or it might mean using techniques like state machines, for example.

  18. Re:On the mac... by Joe+Tennies · · Score: 3, Informative

    OmniGraffle doesn't come w/ OSX. It's either $70 or $120 (standard or professional).

  19. What design? by Anonymous Coward · · Score: 3, Insightful

    I haven't worked with an OOP programmer yet who has used flowcharts, let alone a design beforehand. Heck, I haven't interviewed with a company yet that used designs to model a program. These days, it's all seat-of-the-pants.

    That's not to say that there aren't real engineers out there, or that designs are a bad thing. Just that whenever I talk of actually designing a product/project to nail it down, people look at me like I'm crazy. Who would have thought that wanting a specific goal to shoot for was so foreign a concept.

    Nobody wants to do research. Employers change feature lists with the whim of the customer du jour on the phone. Programmers waste time by throwing useless gadgets and doo-dads into software that never works properly, and would never have gotten past the design stage.

    In these insane times, you get your head handed to you if you demand designs, documentation, and working code. Fix or make reliable software and you're out of a job.