Ask HN: Web dev's – how often do you run your code?
For web developers: How often do you run your code? Due to the nature of hot code reload/interpreted languages like PHP, how often do you find yourself flicking back to the browser to check on things?
Just curious. Despite knowing that 99% of the code I write will work as intended, I can't help but play with whatever functionality I'm developing every few lines to make sure things are coming together correctly. Is this normal? Or do people knock out a load of code and run it all at the end?
I suppose test-driven development somewhat combats the need to check on things for reassurance and this doesn't apply as much to front-end devs, since that's a large part of the job.
8 comments
[ 4.9 ms ] story [ 28.4 ms ] thread[1] https://github.com/gruntjs/grunt-contrib-watch
I'm also a big fan of BrowserSync. Can be used for a similar use-case, and lets you (for example) see the site updated on your phone, tablet and laptop whenever you make any change. http://www.browsersync.io/
Most of the time I can afford to simply refresh and see the results. This applies to both my backend and frontend work some 99.99% of the time.
Occasionally, however, I find myself writing something slow, like a snippet that accesses the database and "mangles" some data. In these instances I try and write a bit more code before checking my progress, so as not to waste too much time watching reruns.
A while ago though, I was working on a C# .NET MVC application, debugging in Visual Studio, and the round-trip time for making a change in code, reloading the development server (hot-code reloading was not working, spent ~3 months trying to fix it but never did) and then refreshing the page, ended up being around 1 minute rather than the < 3 seconds I was used to. It was amazing how much this affected my productivity, it was a severe hit.
Paired with jasmine / karma / a guard runner to run any specs as files are changed there's not much need for the refresh button in development.