Code Reuse in Notes and Domino: How to Find References and Dependencies in Your Apps

* DILBERT © Scott Adams. Used By permission of ANDREWS MCMEEL SYNDICATION. All rights reserved.

* DILBERT © Scott Adams. Used By permission of ANDREWS MCMEEL SYNDICATION. All rights reserved.

Once upon a time, way back in the mid-90s, we had a vision of a better world. It was a place where, if you wanted to build a Lotus Notes app, pretty much any app, you could do so by simply assembling a series of pre-tested components. You could put together a robust application, with a user interface that conformed to all your corporate standards, within minutes. The components were stored in a central library so that, if a bug was discovered, it could be fixed in the library component, which could then be distributed out to all the production apps that used that component. You could even produce versions of your app translated to different languages at the click of a button.

dubonnet.png

This Notes Nirvana was made possible by our amazing tool of the time, Teamstudio Designer. It came with a set of pre-built library components to get you started. But inevitably, for the whole thing to work, you would have had to invest a substantial amount of time in building your own set of components to your own corporate standards. And there’s the rub. Inevitably, our customers were way too busy building and maintaining their existing business applications to stop everything and spend a couple of months building a library of reusable components. And thus Teamstudio Designer was consigned to the great scrapheap of history.

Despite our initial failed attempt at revolutionizing the world of Notes application development, code reuse is still a good idea, if you can make it happen. So we took the core of Designer and created Teamstudio Design Manager, which takes a much more pragmatic, if less ambitious approach to the concept of code reuse.

You can use it to store Notes design elements into libraries that you can make available for others (or yourself) to use in other applications. Unlike Designer, you don’t have to create a whole set of libraries to be able to use the product. But if you have something that you think someone else (or you) could benefit from using again, you can easily store it somewhere safe.

One of the biggest hurdles when it comes to code reuse is being able to identify all the dependencies on the element you want to reuse. Probably the simplest example of that is a Notes form that uses a subform. If you want to reuse that form in a different app, you need to make sure you copy the subform along with it. But what if that subform uses a shared field? And the shared field uses a script library? And on, and on.

Identifying all the dependencies in even a simple application can be very time consuming and error prone. And any time some task is time consuming and error prone, it’s a prime candidate for tooling. Which is where Design Manager comes in. One of the many things you can do with this tool is to identify all the dependencies and references within an application design.

To find the dependencies on a given element in Design Manager, just select the element you’re interested in, and hit the Dependencies button. All the other elements that are referenced (recursively) are automatically selected. Bonus: external references (for example DBLookups in views in other databases) and missing dependencies are identified too!

So that takes care of dependencies, but what about references? References are simply the opposite of dependencies, in other words all the elements that have dependencies on a given element. Well, Design Manager can find those for you too. So, if you think a design element in your application can be deleted because it’s not being used any more, it’s a good idea to check for any references to that element before you do so. Simply select the element you’re interested in deleting, and then right-click to display the short-cut menu and choose Select Reference of Selected Elements(s). All elements that reference the element you selected are now highlighted.

Code reuse is one of those things that everyone knows they should be doing, but it’s sometimes just easier to copy and paste code instead of setting up a reusable element. Teamstudio Design Manager can make it easy to overcome the hurdles that stop you from doing these things the way you really should. And maybe the crowd really will go wild.

To learn more about Design Manager, click below.