News:

BB code in posts seems to be working again!
I haven't turned on every single tag, so please let me know if there are any that are used/needed but not activated.

Main Menu

Visio Shapes as Objects: Exploring Parallels with OOP

Started by Yacine, September 29, 2024, 11:02:33 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Yacine

Coding is a hobby of mine, and when it comes to object-oriented programming (OOP), I often lean more towards procedural and functional approaches.
Why? With OOP, it's like you have to build an entire castle before you can push a button. I prefer simple data structures where I can follow the code execution step by step. OOP tends to complicate debugging, making it less transparent. After all that setup, the practical benefits may not always justify the effort.
In my view, OOP becomes necessary only when the scale or complexity of the data structure is too large to manage easily—like when dealing with dynamically created objects or the numerous events triggered in GUIs.
That said, I find myself surprisingly open to OOP principles when using Visio, even though I don't normally favor them. This is because I tend to think of Visio shapes as "objects" in a way that suits my workflow.
Here's how I see Visio shapes aligning with OOP principles:
  • Shapes as Objects: Each shape in Visio acts like an instance of a class (its master). When you drop a shape onto a drawing, it behaves according to the properties defined by its master, much like objects inheriting properties from a class in OOP.
  • Custom Functions: Using CALLTHIS
     functions and ShapeSheet formulas, shapes in Visio can have their own "methods," similar to how objects in OOP have methods that define their behavior.
  • Master vs. Instance Relationship: Shapes in Visio can either be controlled by their master (the template or class they derive from), or they can be individually modified, just as objects in OOP can override inherited methods or properties.
  • Events and Smart Behavior: Shapes respond to events—like being dropped onto the canvas—and interact with other shapes or their environment, similar to how objects in OOP can trigger and respond to events.
Of course, this is a simplified analogy and doesn't fully reflect the true nature of OOP. For instance, there's no true encapsulation in Visio. One could argue that the ShapeSheet is "hidden" enough to act like encapsulation, but it's not the same as proper data hiding in OOP.
On the flip side, Visio offers some features that go beyond traditional OOP capabilities, like its interactive and easy inheritance system. You can edit a shape's User and Prop sections and save it as a new master in a stencil. Additionally, you can even reassign shapes in your drawing to new masters, effectively changing the class of an instance mid-process—something that's not typically as straightforward in OOP.
Implications of These Thoughts
One interesting implication is that Visio can actually serve as a powerful tool for serialization tasks. Instead of using a traditional relational database structure or a JSON file to store and manage your data, you could leverage a Visio drawing to both define and store your data.
Here's why this could be effective:
  • Visio's ShapeSheet and custom properties allow you to attach extensive metadata to each shape, which can represent complex data relationships in a visual and intuitive manner.
  • Hierarchical and networked structures can be easily modeled through shape connections, providing a natural way to represent nested or relational data.
  • Flexibility of modification: You can dynamically update both the data and its visual representation in real-time, unlike with traditional serialization methods, which often require rigid schema definitions.
This approach might be particularly useful for tasks where visual representation is key, or where you want to combine data modeling and visualization in a single, interactive environment.
Final Thoughts By looking at Visio shapes through the lens of OOP, it opens up unique possibilities not only for conceptual understanding but also for practical applications like data serialization. In this context, Visio serves as more than just a drawing tool—it becomes an interactive, flexible data management system.
Yacine

Browser ID: smf (possibly_robot)
Templates: 4: index (default), Display (default), GenericControls (default), GenericControls (default).
Sub templates: 6: init, html_above, body_above, main, body_below, html_below.
Language files: 4: index+Modifications.english (default), Post.english (default), Editor.english (default), Drafts.english (default).
Style sheets: 4: index.css, attachments.css, jquery.sceditor.css, responsive.css.
Hooks called: 193 (show)
Files included: 32 - 1207KB. (show)
Memory used: 1006KB.
Tokens: post-login.
Cache hits: 14: 0.00170s for 26,724 bytes (show)
Cache misses: 4: (show)
Queries used: 16.

[Show Queries]