Ok, people, where are all the web frameworks that will give me a CTRL-S, ALT-TAB, F5 workflow? As I've been shopping around, it seems everything requires more than that. Some places you can script the additional steps into the refresh, but not always. Am I the only person that doesn't want to have a million extra steps in the process every time I make a change?
Just to be clear, I'm not necessarily saying you have to avoid reinitializing your app or whatever, I just don't want to have to do it manually (nor figure out manually when I ought to do it). Similarly, I don't want to have to rely on an IDE to do it for me, the framework should take care of all that. I should be able to open up ANY source file in my app with an arbitrary text editor, change it, and then load the app in my browser and see my change. I don't care if it takes 5 seconds because the app has to reload/rebuild itself to deal with the change, I just want it to happen without my intervention or any sort of special external tools.
Is this too much to ask?
Hi Barney,
Coldbox lets you specify special settings for your dev environment, apart from your production settings. There you can specify not to cache handlers, reload your ioc factory, reload the framework, etcetera on every request.
See Environment Control Via Interceptors for more details.
Well, setting Fusebox for instance to development mode refreshes EVERY time, regardless of changes. I've often thought through this issue, and the main stumbling block I saw was minute resolution on files – do a cfdirectory and the timestamp is down to the minute. Now getting a cache system to see changes under that? Maybe there's a java workaround, but ultimately finding out if a file has changed and recompiling it under a minute (which does happen a lot when you are tweaking) is not possible?
Maybe this has changed with CF9 (not checked). Until you can get a timestamp of last-modified to be second or less resolution…who knows.
Barney, Are there specific CF frameworks you're thinking of? I ask that because in my day job, we use a very old fusebox2-ish framework, so for me development is always ctrl-s/alt-tab/f5 for seeing interface changes. I wonder what CF frameworks don't do that. Perhaps it's the ones that cache handler components, in which case you need to "reset" them?
I remember a few years back, when FuseBox 5 first came out, I downloaded it just to play around. I was surprised at how long page loads were… half a second, and that was just in the framework, not in my app. I then learned that it was in "dev" mode. Turning that off got the page times down, but then everything was cached. So I installed a firefox extension for easily resetting the app when I needed it. Is this the pain you're talking about? If so… I completely hear you.
When I have to get into java coding (non-grails… straight jsp) I am appalled at the workflow. I'm like you: I don't want to rely on IDE tricks to "transparently" stop and restart the server, because either way it's slow. Perhaps JRebel is the answer here and if I were doing daily java-ish work I'd think it would be worth the money.
I know ColdBox supports this. You can use the Environments interceptor to turn this on for your development server, then just add the settings to autoload:
This will ensure that you can just save changes and refresh the page.
(NOTE: In case the XML doesn't show up, you use the "Setting" tag to set the HandlersIndexAutoReload and ConfigAutoReload to true.)
Barney, as long as you are in development mode, Model-Glue will do this for you too. When you are not in dev mode, you simply need to append an init var at the end of your URL. And you only really need to do this if your model or your controller files change. If you just update view files, there is no need to reload the app.
Thanks, all y'all. I was really talking about non-CFML frameworks; all the CFML frameworks I've ever used are at least scriptable for reloads (via filesystem timestamp checks), and most of them provide the hooks to have it happen automatically (though they're typically not intelligent about it). Pretty much every CFML application I write has a block in Application.cfm|cfc that will do series of filesystem checks, and if any of the files are newer than the last application load, set a request variable that will trigger a load on this request. Then the in-memory stuff is always current, but I only pay the reload cost if stuff has changed.
But once you get out of CFML, it's pretty much all about restarting the whole container every time you make a change. And worse, it's not something that happens automatically; you have to manually remember to go restart. If you have a good IDE, some of that pain is mitigated because it'll notice when you need to restart and at least tell you to do it with a dialog, but still a PITA.
It doesn't seem like this is a hard problem to solve, though it's certainly one that has to be done pretty low level (below the JEE spec) or with some pretty invasive classloader stuff (like CFML engines do). But it seems either one isn't to terribly much work compared to the rest of a web toolkit.