4 ms·
This is an interesting discussion. I'm deep into a project now (as the sole developer) where I was surprised to learn that the frontend js is about 30% bigger t
by aidos 13y ago
This is an interesting discussion. I'm deep into a project now (as the sole developer) where I was surprised to learn that the frontend js is about 30% bigger than the backend (python).
In ipython I use autoreload (thanks to a tip on HN) so that the code in the objects in memory is kept in sync with my editor. My workflow is: load up a bunch of objects I'm working on, try to get the expected output, fail, change code in my editor again, check the the output, repeat. Within ipython you can even '%ed obj.broken_function' to edit it directly in vim. There's no doubt that the auto reload discovery improved my efficiency. Aside from the time it saves, I'm able to think of my running code and on disk code as the same thing. Don't underestimate how powerful that is.
But as I said, my code is now mostly frontend code. After over 15 years in web development the reload cycle has become second nature to me. It's silly though. I have a lot of state to maintain in the js and every reload is expensive. In my specific case I could be looking at 2 minutes to even load the objects from the web server.
I'm going to have a look at the chrome options to see what's available in terms of hot code swapping. I disagree that it's important for all browsers to support it. Even just finding a good solution in the browser I do most development in (chrome, presently) would be a major win.
- chii 13y agothis autoreload/live edit is sounding more and more like a REPL...
- brown9-2 13y agoIpython is a REPL.
- aidos 13y agoHmm. Evidently I didn't explain that very well. In ipython you're working in a REPL. Say you have a good many classes loaded up with data but some function deep inside one of them isn't producing the correct output. You can debug as you normally would inside the REPL. Use a debugger, deconstruct the function etc. When you get to the end you now have a fix for your function. Make that change in your file and, thanks to auto reload all of the objects in memory are immediately running the fixed function. You can then carry on working with the objects as though the bug was never there. Depending on your scenario this can be a major win. On my project it's not uncommon for it to take 10 minutes to load and process that data from disk to get it into objects in memory. For me I can do that once and then carry on working with my data an code all in unison. Whatever works for you. I'm pleased with my current environment on the server-side. It works very well for me.
- swannodette 13y agoI think chii was referring to a much more sophisticated REPL experience which doesn't require blowing away application state. This is possible in truly live environments like Smalltalk (checkout Squeak) or a competent Lisp environment. You can incrementally update your program from your editor and keep going all without reloading. This is how ClojureScript developers interact via the browser REPL for example.
- aidos 13y agoAh ok, fair enough. I'd heard that Smalltalk had a really good environment for this but I've never looked into it. Let me rephrase then. There are amazing server side REPLs that allow me to change code on the fly, why can't I change code in my editor and have it reflected directly in my browser?
- gngeal 13y agoYou can, if you're in control of the framework you're using.