TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: How to write OO JavaScript that is both readable and IDE-compatible?

2 pointsby andrea_sdlalmost 10 years ago
Lately one of my coworkers started refactoring some JS using inspiration from John Resig advice (http:&#x2F;&#x2F;ejohn.org&#x2F;blog&#x2F;simple-javascript-inheritance&#x2F;). Until this, we were writing plain old js.<p>The code now is more structured, clean, and obviously better.<p>My coworker is a super-great programmer, I personally respect him very much both humanly and professionaly, but this whole refactoring has made me thinking about one thing, and that is: IDE Compliance.<p>We are using an IDE (netbeans in this case) to develop our app, but I found that if we write JS this way the IDE won&#x27;t give autocomplete suggestions decently. So, while we get all the beauty of OOP, we don&#x27;t get to know what are the available methods of an object unless we &quot;remember&quot; them.<p>Personally I think this can and should be improved because if another person comes onto the team he&#x2F;her wouldn&#x27;t know how to interact with our &quot;framework&quot; unless he starts digging into the code.<p>What was your experience on this? Is there a way we can write clean OO JS code that is also indexable from an IDE?

3 comments

rnovakalmost 10 years ago
I&#x27;d personally suggest using a better IDE. It may be &quot;expensive&quot;, but I&#x27;ve bought personal licenses for IntelliJ products a while ago, and renew yearly. It&#x27;s a very small price to pay for productivity. Not to mention, they&#x27;re truly cross platform, and I can go from working on my Windows box at work, to working on my Linux or OSX box at home, all in the same exact IDE.<p>WebStorm seems pretty good at JavaScript prototyping&#x2F;inheritance and auto-complete.
评论 #9777688 未加载
woahalmost 10 years ago
Try babel
评论 #9766200 未加载
zerralmost 10 years ago
The less new JS code we write the better for humanity... :)<p>Why don&#x27;t you try TypeScript? Can be easily integrated with the existing JS codebase.
评论 #9766207 未加载