- Aug 7, 2013
When to Use a Workspace
It’s hopefully obvious that a workspace is useless without two or more projects. Less obvious but just as important is that a workspace doesn’t help with multiple unrelated projects. A workspace is only helpful for two or more projects that share each other’s code and resources. Let’s look at two real-world examples.
Imagine Acme Corporation has a host of unrelated desktop (and even mobile) applications. Here, unrelated means a calculator application, a calendar application, and an address book application. Each of these applications has only one thing in common: They’re products of Acme Corporation.
Being the property of the same business entity, the applications presumably use the same software registration system, company logo, contact information, and so on. They may even be able to share user data among them. This means each application would use the same code, the same resources, or both.
A change to the Person and Event classes, for example, might need to be updated in both the address book and calendar applications. While these classes may or may not be wrapped in a library or framework, it makes little sense to maintain two copies of Person and Event (one in each project). Here, a separate project that at least contains the common model-layer classes (and corresponding unit tests) makes sense. A separate framework project makes even better sense.
Since the applications are otherwise unrelated, each application might have its own workspace that includes the application project and the shared framework project. The benefit of such a setup is that changes made to a project that belongs to a workspace are available to that workspace. For example, if you have two applications (each in its own workspace) that share a common framework, changes to the framework from one app are automatically available to the other by virtue of including the framework in their respective workspaces.
Imagine Acme Corporation’s desktop calendar application has gone where no calendar application has gone before. Against all odds, it has become a best seller, and users are clamoring for mobile versions for their various devices. Acme Corporation, in addition to its other products that share company-wide resources, now has a product that supports two platforms, shares company-wide resources, and has a device synchronization library to let users share calendar information between their devices and their desktop computers.
In this case it would make sense to have a workspace containing the two application projects (OS X and iOS), their sync library project, and the company-wide resource project.