Live data from Hacker News

One Way to Improve Your Coding

changelog.com

41–50 of 121 posts

Re: One Way to Improve Your Coding

#41
post #38

The most obvious way to improve your coding is to write more code. This is a bit too simple: writing more of the same, in the same style, usually won't cut it and unfortunately I've seen people being stuck like that for years: always producing more code, without any improvement whatsoever and instead just repeating the same mistakes. Once those mistakes become a habit they are extra hard to get rid of. So actually wr…

I want to recommend everyone who sit infront of a screen for several hours per day to invest a few hundred dollars extra on the monitor. The extra contrast makes a huge difference.

Re: One Way to Improve Your Coding

#42
A lot of people will recommend reading great code -- well known open-source libraries etc. That's good, but one thing I think is useful is to read your dependencies. Then you can get a better picture of what "regular" code is like. Most popular libraries are not great to read because they are often very abstract, or they use so much helper code that it's hard to see what's actually going on. But fairly small libraries are usually easy to understand and usually are also fairly straightforward, but by reading code you'll be able to put yourself in the shoes of someone who will be reading your code one day, which is the most important things to keep in mind.

I'm mainly a front-end developer, and the nice thing about the npm/node ecosystem is all of your dependencies are right there in node_modules, so feel free to read them to see how they work, or why something isn't doing what you expect -- you can even add debugger statements or console.logs.

In some ecosystems this is harder because you might have to hunt for the source, or only have headers. For example in ruby, use bundle show my_dependecy to see where the code is stored.

Re: One Way to Improve Your Coding

#43
post #38

The most obvious way to improve your coding is to write more code. This is a bit too simple: writing more of the same, in the same style, usually won't cut it and unfortunately I've seen people being stuck like that for years: always producing more code, without any improvement whatsoever and instead just repeating the same mistakes. Once those mistakes become a habit they are extra hard to get rid of. So actually wr…

Exactly. It's like claiming that because I drive to work every day I can eventually become a racecar driver.

Re: One Way to Improve Your Coding

#44
post #35

This is one thing I need to do more often. I came from a school and industry segment (.Net) that very highly discourages reading other people's code, and even years later I feel guilty trying to read jQuery's source when I run into a weird edge case. Is there projects out there that are easy for beginner code readers to grok? I've tried reading libraries you've all heard of, but even after an hour of jumping between…

Keep in mind that part of what makes reading code beneficial is that it's not necessarily easy - in fact, it's often rather hard! The benefit is developing a set of "mental heuristics" to figure out what parts of a codebase are useful, so that when you have to dig through someone else's code you can figure it out just a little bit faster. That said, here are a couple suggestions. I'm not sure what you use other than…

Thank you! I'll have to look at these later on!

Still feels like stealing, but that's my problem :)

Re: One Way to Improve Your Coding

#45

I'm going to be "that guy" in the comments section this time, largely because I feel like I've been seeing this more recently and I've had to fix it myself: I don't really get why it seems to be a "thing" recently for websites to have low-contrast text colors. This is at least the second time in a week I've seen light gray text on white background, and to not strain my eyes I went into the CSS for the website and fix…

> I don't really get why it seems to be a "thing" recently for websites to have low-contrast text colors.

It doesn't need to be any more complex than "designers think it looks nice". Black text obviously has a better contrast but I bet it doesn't look as good.

Re: One Way to Improve Your Coding

#46

I'm going to be "that guy" in the comments section this time, largely because I feel like I've been seeing this more recently and I've had to fix it myself: I don't really get why it seems to be a "thing" recently for websites to have low-contrast text colors. This is at least the second time in a week I've seen light gray text on white background, and to not strain my eyes I went into the CSS for the website and fix…

I've been a UX designer for 10 years and I can tell you why. (Or at least why from point of view.) It's a deprecated design practice to make font rendering looks smoother in a world where retina screens were not ubiquitous. Back in the old days (so like 3 years ago) before the majority of screens were 'retina' (aka you can't see the pixels at normal viewing distances) fonts always rendered with jagged edges. Turning…

> Back in the old days (so like 3 years ago) before the majority of screens were 'retina' (aka you can't see the pixels at normal viewing distances) fonts always rendered with jagged edges. Turning down the contrast between a font and its background is effective in reducing this effect.

Interesting perspective. I was a designer a while back and every designer I've ever worked with has never done this for the reason you state. In fact they always have the latest and greatest monitors and resolutions so they'd never see the issue anyway. They always told me it was "because it looked better".

I always fought to change it and got it changed in every case but the difference in perspective is interesting so I thought I'd chime in.

Re: One Way to Improve Your Coding

#47

A lot of people will recommend reading great code -- well known open-source libraries etc. That's good, but one thing I think is useful is to read your dependencies. Then you can get a better picture of what "regular" code is like. Most popular libraries are not great to read because they are often very abstract, or they use so much helper code that it's hard to see what's actually going on. But fairly small librarie…

It's not really any harder to modify the dependencies in Ruby (or Python, or I'd guess most other dynamic languages). They're usually all stored deep in a subdirectory, but a little find-fu typically gives them up quickly enough. I agree that people should be more willing to dig underneath the covers and see how the code they depend on handles things.

Re: One Way to Improve Your Coding

#49

Can anyone recommend good tools for reading code? I find github.com to be very klunky for this purpose, and even emacs/vim make the task much more troublesome than it could be. Is there such a thing as a "read-only IDE" anywhere out there? (Ideally features would include click-to-definition, navigate back and forth, add bookmarks and annotations.)

Check out this recent comment and discussion. User TeMPOraL describes a similar wish and gets many nice responses. https://news.ycombinator.com/item?id=13020845

thank you! that is a very helpful thread

Re: One Way to Improve Your Coding

#50

Can anyone recommend good tools for reading code? I find github.com to be very klunky for this purpose, and even emacs/vim make the task much more troublesome than it could be. Is there such a thing as a "read-only IDE" anywhere out there? (Ideally features would include click-to-definition, navigate back and forth, add bookmarks and annotations.)

I thought sourcegraph did something sort of like this.
Post reply on HN