TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: Web dev's – how often do you run your code?

7 点作者 KhalPanda超过 10 年前
For web developers: How often do you run your code? Due to the nature of hot code reload&#x2F;interpreted languages like PHP, how often do you find yourself flicking back to the browser to check on things?<p>Just curious. Despite knowing that 99% of the code I write will work as intended, I can&#x27;t help but play with whatever functionality I&#x27;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?<p>I suppose test-driven development somewhat combats the need to check on things for reassurance and this doesn&#x27;t apply as much to front-end devs, since that&#x27;s a large part of the job.

7 条评论

stelian超过 10 年前
I do the same. I don&#x27;t trust myself to not make a typo or a mistake. Even with CSS, I will rarely write more than a class without checking the result. Because debugging is hard.
nkantar超过 10 年前
It depends on what I&#x27;m doing.<p>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.<p>Occasionally, however, I find myself writing something slow, like a snippet that accesses the database and &quot;mangles&quot; 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.
onion2k超过 10 年前
Often enough that I use the livereload feature in grunt-contrib-watch[1] so whatever I&#x27;m working on is reloaded in my browser without me needing to refresh it. I&#x27;ve found that automating things like that has made me check things are working a lot less often.<p>[1] <a href="https://github.com/gruntjs/grunt-contrib-watch" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;gruntjs&#x2F;grunt-contrib-watch</a>
评论 #8782872 未加载
danpalmer超过 10 年前
I&#x27;d definitely echo @nkantar&#x27;s comment, I generally refresh every 2-10 lines, depending on what it is I&#x27;m writing. I&#x27;ll very often just dump out raw results from whatever database querying and data mangling I&#x27;m doing until it looks right, then start tidying up the output.<p>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 &lt; 3 seconds I was used to. It was amazing how much this affected my productivity, it was a severe hit.
mikewhy超过 10 年前
I don&#x27;t manually reload, and haven&#x27;t for years. Like others, we use browser-sync for reloading of front-end assets. Each save either reloads the browser or applies the changes live, if you don&#x27;t care to see what the output is yet, don&#x27;t look at the browser.<p>Paired with jasmine &#x2F; karma &#x2F; a guard runner to run any specs as files are changed there&#x27;s not much need for the refresh button in development.
woah超过 10 年前
I write js, but I often won&#x27;t run code for a long time. I put together a project, using the code almost just as notation for ideas, and then go through testing everything to bring it to completion. I suspect that frequent running of code and heavy use of the debugger leads to, or at least makes it easy to write spaghetti.
jhildings超过 10 年前
Almost all the time, for nearly every if condition or new function. When I&#x27;ve got the basics right I contiune with error handling etc and tests that also