3

I just created a big web application, and I need a way to present it. I want to allow people to visualize the amount and complexity of code I coded ("wow this is a giant bunch of code" and "wow this code is sooo complex(independent of the fact that complex code is bad quality)"), but in a style readable for those not familiar with programming. It would be nice if this visualization is also optically pleasing.

Because it needs to show the complexity and amount of work I put into it, I do not want a simple pie-chart. Are there any tools I can use to do this? How do you think I should present it?

This is not about being proud of much/complex code and code refactoring tools. This is about visualizing amount/complexity of code/programs for non programmers in a visually pleasing way.

9
  • I cleaned all previous comments, as the quesiton has been migrated and it now looks quite straightforward for this site.
    – Yisela
    Commented Mar 16, 2013 at 19:40
  • 2
    We're missing all sorts of necessary context here. WHO do you need to present this to? WHY? For what goal? What is the PURPOSE of the presentation? Why is showing COMPLEXITY important? How do you define COMPLEX?
    – DA01
    Commented Mar 16, 2013 at 21:57
  • 1
    From a programming point of view, wouldn't it make more sense to show the simplicity and elegance of your solution rather than playing up how bulky and convoluted it is? As DA01 sorta alluded to in his other comment, complexity may be the result of poorly organized spaghetti code that doesn't use good architectural design, doesn't follow good OOD principles, and/or is overengineered. If your goal is to show the merits of your work, it makes much more sense to show a list of features, demonstrate the particular challenges you faced and the novel solutions you created. Commented Mar 17, 2013 at 0:25
  • 1
    Rather than trying to overwhelm the audience with how indecipherable and abstruse you code is, why not focus on the merits of the code: such as performance, scalability, extensibility, etc.? If you don't think that sufficiently conveys the magnitude of your effort, include a class diagram, API documentation, UML diagrams, revision tree, and a list of all the bug fixes and refactoring you've done. Source code just isn't a good measure of a programmer's productivity, as much of a good programmer's work is done outside of actually coding. Commented Mar 17, 2013 at 0:33
  • 1
    Visual paradigm has some examples of different ways to convey the function and design of your app: including function call diagrams, sequence diagrams, and activity diagrams. And if you've been properly documenting your code using Javadoc/phpDoc/etc. then you can easily generate pretty API documentation in HTML, which can then be converted to PDF or LaTeX if you want. Commented Mar 17, 2013 at 0:42

4 Answers 4

6

Off-hand I'm thinking knots.

knots

(image from http://www.math.buffalo.edu/)

Knots offer a wide array of complexity degrees. From the simple square knot to some very complex, multi-line, knots. And the multi-line knots could be used to show integration between different languages if needed. These could be used or integrated into a design to show the complexity of an application.

3
  • 4
    Alas, could also be a metaphor for spaghetti code. ;)
    – DA01
    Commented Mar 16, 2013 at 21:59
  • This is a nice idea. its code independent and abstract. And easily understandable.
    – Alex
    Commented Mar 17, 2013 at 18:33
  • @DA01 .. ahh I hadn't considered that.
    – Scott
    Commented Mar 17, 2013 at 20:29
3

It may depend on what do you mean by complexity. If your code has a lot of nesting constructs and loops, perhaps you can first properly indent the code, and then replace the actual lines of code by rectangles, as to visualize the indentation and nesting. Some especially interesting parts could be done in another color, and made into active links, so you could click on them and be taken to another slide that further elaborates on that part of the code.

If you use a mix of languages (php, html, xml, sql), you could have an overview of a code with different languages in different colors, again with clickable links that would reveal details.

3

Please don't take offense to this, but when a coder is proud of the complexity of his/her code (like your sentence says "wow this code is sooo complex"), most of the time it is a sign of a really bad design.

I say this because it's what I have experienced in my 14 years of professional programming. It's easy to write code that is complex and more difficult to write code that is easy to read, understand, and maintain.

You don't want to be proud of complex code; it means you have not succeeded in making it easy to understand, it means you still have a lot to learn programming-wise.

There is a bunch of software for code quality, qualimetry, that measures complexity of functions, classes, modules. But contrary to what you think, the more parts are awarded red or high complexity scores, the more they need to be re-written.

Personally I focus on Mc Cabe complexity < 10, and that's already a high complexity, and function length of less than 40 lines of code.

It's incredible the pace at which functions are guilty of becoming non-maintainable due to their complexity. And if you use a complex function with another complex function, you end with something even more complex, non-maintainable, and prone to error when modified. And that grows exponentially if you have even more complex layers on complex layers. In software engineering we call it technical debt.

Maybe you should invest in one of those software metrics application. Google "Software Metrics" and the languages of your choice.

If you want it to be maintainable code, rewrite it so that it is not complex; don't be too proud or attached to your code.

Remember, code is written once, but it is read hundred of times.

5
  • This is a good point. However, the whole program can be very complex independent of how well it has been refactored. To visualize this complexity is important to me.
    – Alex
    Commented Mar 17, 2013 at 18:36
  • I agree with stephanie. My understanding of being 'proud of code' is not the complexity of the code but how a simple algorithm or snippet could be designed to a simplified state that it would serve a larger purpose or excute a better result. Example that comes to mind is the creation of jQuery to JavaScript. JavaScript was looked to be complex to designers but it was simplified by jQuery.
    – user9447
    Commented Mar 18, 2013 at 4:41
  • And then there is simplicity at a level where it wraps back around to complexity: obfuscation. Heck, even regex is incredibly simple and profoundly opaque.
    – horatio
    Commented Mar 19, 2013 at 15:16
  • It is not about being proud of much/complex code and code refactoring tools. This is about visualizing amount/complexity of code/programs for non programmers in a visually pleasing way.
    – Alex
    Commented Mar 19, 2013 at 15:23
  • I don't think you're really answering the question proposed. Sometimes complex code isn't yours and you want to illustrate that to people who don't understand that. Or you want to convey how much work it is to maintain or change complex (read bad) code.
    – Aaron
    Commented Mar 19, 2013 at 18:29
2

One thing that comes to mind for me is the way certain IDE's display code. Using colors and lines to connect matching sets of begin...end, if...then, and loops makes reading code easier for programmers, so why not for non-programmers? You could show nested loops, case statements, and compound if..else sets in a neat and clean way.

In the same vein, but different, you could color code functions, methods, and procedures by their time and/or perceived complexity. This way, a reader can quickly scan through and see "problem areas" or more complex areas of code.

I agree with the other answers/comments about pointing out "complexity" of code. However, I understand that you may be trying to point out reasons why you can't "just change it" or how a simple fix would actually touch a significant amount of the program in question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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