Jim Lynch Codes
  • Blog
  • About Jim

Writings about one coder's stories & experiences.

Interesting Code Flowcharting Technique

1/18/2016

0 Comments

 
This is a really cool, simple method for sketching out what you want your code to do. I came across this flowcharting method from page 23 of the great book “Javascript and JQuery” by Jon Duckett (screenshots below). He describes the motivation for them like this:

“Often scripts will need to perform different tasks in different situation. You can use flowcharts to work out how the task fit together. The flowcharts show the paths between in step.”
The flowchart allows you to see all the different paths of actions a user can take, and how the application should respond. Let's take a look at the key:
Picture
In the following example we can see a simple diagram that displays the flow logic for a simple form validation function with some explanation beneath it.
Picture
1. The button is clicked which sends an event to trigger your onButtonClicked function.
2. Then you need to access the specific textfield in question and save it's vale. 
​
3. Now the application must make a decision. It needs to compare the value from (2) to some predetermined conditions and see if it is valid. In this example there are only two possible paths, but there may be more. 
4. If there is not a name (or valid entry) in the textfield display a message to the user. Then wait for them to hit the button again to trigger the event and start the flow over again. 
5. This is neither a decision, event, input, nor output. It's just a calculation done to get the data is a way we can present more easily.
6. Actually present the data to the user and show it on the screen. 

​I do believe that this flowcharting technique a really interesting way to flesh out what things you want the application to do in response to different events. It’s much more simplified than something like UML, and writing feels more like you're thinking from the user’s perspective. I’m not saying you shouldn’t write UML once you want to start coding. I’m just saying that it might be a good exercise to build out a quick flowchart of your application before starting to write that UML (or diving into the first unit tests). It's a lean, quick way to outline what the software should do, and it works very nicely on a whiteboard or google drawings. What do you think about this flowchart technique?
0 Comments

Your comment will be posted after it is approved.


Leave a Reply.

    ​Author

    Picture
    The posts on this site are written and maintained by Jim Lynch. About Jim...
    Picture
    Follow @JimLynchCodes
    Follow @JimLynchCodes

    Categories

    All
    Actionscript 3
    Angular
    AngularJS
    Automated Testing
    AWS Lambda
    Behavior Driven Development
    Blockchain
    Blogging
    Business Building
    C#
    C / C++
    ClojureScript / Clojure
    Coding
    Community Service
    CS Philosophy
    Css / Scss
    Dev Ops
    Firebase
    Fitness
    Flash
    Front End
    Functional Programming
    Git
    Go Lang
    Haskell
    Illustrations
    Investing
    Java
    Javascript
    Lean
    Life
    Linux
    Logic Pro
    Music
    Node.js
    Planning
    Productivity
    Professionalism
    Python
    React
    Redux / Ngrx
    Refactoring
    Reusable Components
    Rust
    Security
    Serverless
    Shell Scripting
    Swift
    Test Driven Development
    Things
    TypeScript
    Useful Sites
    Useful Tools
    Video
    Website Development
    WebStorm
    Writing

    Archives

    March 2023
    August 2021
    February 2021
    January 2021
    October 2020
    September 2020
    May 2020
    April 2020
    February 2020
    January 2020
    December 2019
    October 2019
    September 2019
    August 2019
    July 2019
    June 2019
    May 2019
    April 2019
    March 2019
    February 2019
    January 2019
    December 2018
    November 2018
    October 2018
    September 2018
    August 2018
    June 2018
    May 2018
    April 2018
    March 2018
    February 2018
    January 2018
    December 2017
    November 2017
    October 2017
    September 2017
    August 2017
    July 2017
    May 2017
    April 2017
    March 2017
    February 2017
    January 2017
    December 2016
    November 2016
    October 2016
    September 2016
    August 2016
    July 2016
    June 2016
    May 2016
    April 2016
    March 2016
    February 2016
    January 2016
    December 2015
    November 2015
    October 2015

    RSS Feed

  • Blog
  • About Jim
JimLynchCodes © 2023