UPDATE
This turned out to be quite a long post, so here’s a little summary:
Imagine you develop an (openframeworks) application which uses a lot of non-core addons: ofxMidi, ofxKinect, ofxTimeline, ofxMSAInteractiveObject, ofxSimpleGuiToo, ofxDelanauy, ofxOpenCL, ofxBulletPhysics, ofxSplineInterpolator, ofxFx, ofxArtnet, ofxPD, ofxARToolKit etc.
How do you make sure you can easily re-compile and run this application in 3 years time? Do you create a snapshot copy of openFrameworks and all relevant addons for that particular project?
What if you are have tens, if not hundreds of applications (some big, some small) accumulating over the years.
The general consensus reply is ‘this is what version controls systems are for’. Yes of course, but most VCS are too low-level to easily handle this particular style of dependency on multiple repo’s. How do you realistically manage tens - if not hundreds - of applications, each using a large number of different addons. Currently it seems by the replies that a lot of people do have multiple copies of openframeworks lying around, and duplicate addons per application, so clearly the VCS isn’t being used efficiently and higher level tools are needed.
P.S. This isn’t a dilemma unique to us, a lot of other developers have run into similar workflow issues and each have their own solutions.
E.g. Google’s solution for android development: http://source.android.com/source/version-control.html
and other tools to manage multiple repo’s and/or submodules simultaneously http://gitslave.sourceforge.net/ , https://github.com/patmaddox/giternal , https://github.com/apenwarr/git-subtree/ , https://github.com/evilchelu/braid/wiki
in fact https://www.google.co.uk/search?q=git+manage+multiple+repositories
none of which seem ideal for our purposes.
Original Post:
Hey all, I just tweeted in frustration about a dilemma I’ve been having for years. It’s getting a lot better, but still I don’t feel it’s fully resolved (judging by the amount of instant replies I’ve gotten back on the webz i think most people agree this needs to be discussed!).
The problem is that of how to manage your source code for apps in relation to different instances of openframeworks and addons. I.e. putting your source code inside one central openframeworks folder, vs outside, possibly with it’s own bespoke copy of openframeworks, possibly not.
I’ve raised this discussed a few times on the devlist, and now that we have the project generator things are MUCH MUCH better. But I still think there is room to improve (or at least I haven’t nailed the solution I’m after).
This post is more of an improvised brainfart as opposed to a specific question. We’ll see where it goes. I might just rant on about stuff. I might ask some constructive questions, I might even find some answers on this journey.
First let me start with the options I see and use:
- old skool #1. All of your apps go inside one openframeworks folder. Inside of/apps you create a folder for each project (e.g. of/apps/myproject) or category (e.g. of/apps/demos, of/apps/experiments etc), and inside those are subfolders for each specific application.
1a. The most obvious solution is to have one openframeworks folder per OF version. E.g. OF005, OF00573 (remember that freaky one!?), OF006, OF007, OF0071, OF0072 etc. This maintains nice backwards compatibility, you can go back and compile old projects you wrote for OF005 if need be.
1b. the problem with the above, is it doesn’t factor in the possibility of working on the bleeding edge develop HEAD. As new updates come to OF (e.g. via github), you’re not benefitting from bug fixes. and often, you need to work on the develop head for latest features. In fact sometimes you need to work on branches ahead of develop HEAD! i.e. you modify the core, submit a pull request, and then it makes it into the core. if you are working off the latest on git, how do you manage that? So in addition to having a folder for each version of openframeworks, I also have a folder for openframeworks git. And that’s when it gets tricky.
-
Traditional way #2. The last scenario above starts to get tricky if you develop your app not for OF0072, or OF0073, but for something somewhere in between. So the safest bet, is for each project, create a whole copy of openframeworks elsewhere, and put your app there. This (almost) guarantees that you’ll be able compile and run in years to come (assuming you’re not depending on OS libraries and features that deprecate). But of course this takes up loads of space. Also if you are using custom addons, you’re likely to end up with hundreds of versions of the same addons. Often you might even make fixes and tweaks to a particular version of an addon for one project, but then other fixes and tweaks to another version of the same addon for another project. It’s relatively trivial to merge them all and update a master central repo, but of course in the real world that usually doesn’t get done straight away, and will eventually be forgotten, lost in time, like tears in rain.
-
New independent way. Thanks to the awesome Project generator, you can place your project anywhere, outside of any openFrameworks folder. This means that it’s not linked to any particular version (or instance) of OF. This has the most potential, but it’s not fully there yet. You can’t easily change instances i.e. make a project point to another instance of openframeworks (actually the PG has an ‘update project’ option, I don’t know if this is supposed to do that, but it doesn’t. more on that below).
In my *ideal* world what I’d like to be able to do is possibly this:
-
put my app code inside it’s own folder in a project folder. e.g. /myproject/src
-
point that to use my central openframeworks git repository so I can benefit from all current developments e.g. /dev/openframeworks/git
-
at the end of the project, automate the transfer of the current state of openframeworks and all relevant addons into the myproject folder. This seems like a bit of a diva thing to ask for. Why not copy it across in the finder. Well sometimes I have upto 20 addons in my projects. And I right now I have exactly 72 addons in my central openframeworks folder. To go through them all one by one comparing what I have in xcode vs finder seems very inefficient. It is also prone to human error. As a programmer, this kind of inefficiency, which is prone to human error aggravates my OCD
Also since I’m developing in git version, I have all libs for all platforms, which pushes the size of OF to over 1GB i think. I really don’t want 1GB per project. So stripping out all those unnecessary libs would be great too.
This ensures that I have a backup of the state which can make my app compile in years to come. -
I would like a very simple way to change to which instance of openframeworks, my project points to. I think perhaps the ‘update’ option in the project generator is supposed to do this. But I’ve not managed to get it to work. (e.g. my application is inside the openframeworks folder, I move it outside, and ‘update’ it via the PG. When I open the project, it can’t find ofMain.h, project settings aren’t correct.
One big problem with this is addons. Any addons you might have in one openframeworks instance might be different to another instance. I’m thinking keeping addons inside each project folder is a safer option than keeping them with the openframeworks instance.
Also another problem with the above is sharing projects (i.e. collaborative development on github). If your project folder is outside of openframeworks folder, if you add it to the git repo, the same project/workspace file won’t work for anyone else - unless they have the exact same folder structure as you for where they keep their openframeworks. So you either have to keep your project inside openframeworks folder, or don’t add the project file to the repo. If you don’t add the project file to the repo, everytime someone adds a new file to the project (which is quite common during development other people get errors. So you can say, ‘if you see files which are new that aren’t in the project, just add them to the project’. But of course that doesn’t always work either. Sometimes you might create a cpp, develop it a bit, then decide you want to do it another way, with another set of classes. So you remove that from the project (i.e. exclude it from the target, or remove it altogether - but without deleting the file). then someone else sees the file and adds it to their project. And it doesn’t compile anymore. Of course good communication between developers solves all of these problems, and they are very manageable. But still, it is a system prone to human error. And again, any system which is prone to human error, which can be avoided through automation of some sort, aggravates my OCD
I guess this also really brings in the importance of semantic versioning (http://semver.org/ as also discussed many times). You could argue that as long as the major version doesn’t change, backwards compatibility doesn’t break, so you can be sure that you can keep upgrading openframeworks and all of your app code will work. All you need to do is just keep a single copy of each major version of openframeworks, and all of your old apps will compile and run. Of course that’s just theory. In reality, bugs will be introduced, so the app that you wrote for openframeworks 0.7.3 today, might not work exactly as it did in a years time on 0.7.7, because someone didn’t realize that changing one little implementation detail in one function would have an impact on the way another class functions. This is just a normal part of development.
I think I definitely asked some questions, I possibly found a glimmer of hope of an answer, but definitely not something I can grab onto. Definitely not something which I can call ‘rules - or strict guidelines - of how to structure the file system and folder structure of any new openframeworks application, whether it be a demo, test, or project’. Maybe the solution is right there under my nose but I can’t see it. Maybe we need to make some small changes to something (no idea what), and then we’ll all be much happier. Just wanted to start a discusion about this.
any thoughts, suggestions, comments, feedback much welcome!
/massive rant over