Boost Productivity: Leverage the Power and Flexibility of Workbench 2
March 25, 2010 — Adam Berry, Wolfram Development Suite Product Manager, Kernel Technology
It happens to everyone—you spend forever digging around in your filesystem for the dataset you need to finish your work. But you can’t remember the name or enough about the contents to be able to search for it. Searching is wasted time, time that would be far better spent on productive tasks.
What users like myself really need is for our tools to reflect the way we actually work, and that’s where project-based workflows in tools like Wolfram Workbench come in.
When working with Mathematica, we need notebooks—some will contain rough work and some will be presentation material. We may also need some data and other forms of output, such as HTML for final delivery. So let’s walk through setting up a project, and some of the features that can enhance your workflow and improve your productivity.
First we need to create a Mathematica basic project, which will contain an empty .m file and a notebook. Workbench makes some additions to the configuration when it launches Mathematica; if we open the notebook and check the path, we see something similar to this:
We can see here that the root of the project has been added to the path (it’s the second item in the output). Close the Mathematica session and return to Workbench. Opening the project properties and looking in the
So we have a few tabs here that will be useful to us—Source, Palettes, and Stylesheets. As you have probably guessed, the Source tab is how we contribute entries to the path. By default just the root of the project is added, but as we add a structure to our work project we could add more things here. The options for adding palettes and stylesheets are great for managing resources that you may need for just this work, helping keep your Mathematica session clean both while working with this project and when in a normal session.
Now let’s add some additional structure to our project. We are going to be working with images, so a folder for them would make sense, and an output folder for manipulated images would be a good idea. We’ll add a couple of images into the originals folder. Additionally, lets make a folder for palettes, and add an Image Manipulation palette to it.
Now open the project properties again, and select the Palettes tab. Using the Add button we can select the Palettes folder in our project, which will now look like this:
It would be useful to add the original images folder to the path in project properties:
Finally, before we open Mathematica again, open the .m file and add the following and then save:
Now launch Mathematica, by right-clicking on the notebook in Workbench and choosing Run As > Mathematica. Workbench will automatically set up the paths as before, and our SetDirectory call will be executed thanks to the auto-loading mechanism.
If we look in the Palettes menu in Mathematica, we will find our Image Manipulation palette, ready to be opened and used. It’s available to me when working on the images in this project, but does not crowd my environment the rest of the time.
But what has all this bought us? Well now, if I want to import one of my images, I only need specify its name:
Once I have completed my manipulations I can easily export. Thanks to setting the working directory, we do not need a full file path:
You will see this new image in the project structure. But once again, how has this helped? It has removed the need to use the file path insert dialog, and encourages you to organize what you are working on.
Both small gains to be sure, but when repeated over and over again, they add up to significant time savings and reduction of errors, increasing your efficiency. Add the use of the local history, or better yet a version control system like CVS or Subversion, and you make it easier to collaborate, as well as undo, when working on your projects.
This kind of feature is the very essence of modern IDEs: many small efficiency gains that stack up—taking time consuming, repetitive tasks (which computers are so good at) off your hands, freeing you up to solve the big problems—and you don’t even need to be doing development work to gain from them!
After all, if we don’t make computers do work for us, we might as well not use them at all. So why not try Workbench and start working better?