Live data from Hacker News

One Way to Improve Your Coding

changelog.com

91–100 of 121 posts

Re: One Way to Improve Your Coding

#91

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.

There are many darker gray options to pick from though... I'm not as good as I was when I was younger, so fine detail is hard... I'm using a 40" 4K display at native resolution, and most of the websites I use I bump between 125 and 150% to be readable. These tiny devices with really tiny fonts kill me... I don't use the FB app in particular, because even with the accessibility settings turned all the way up, I can't read the damned thing on my phone. Really wish FB would fix this, but there are other web offenders too.

I get design is important, but it should NEVER be at the cost of removing usability.

Re: One Way to Improve Your Coding

#93

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 recall a blog post by Ian Storm Taylor [0] that suggested it from the perspective of a painter. Not sure how well it applies to screens, but it's definetly not a thoughtless move to use #222 for your fonts.

0: https://ianstormtaylor.com/design-tip-never-use-black

Re: One Way to Improve Your Coding

#94
post #62

When I was teaching at General Assembly, I always tried to encourage students to read more code. Could you imagine someone studying writing in college without reading a TON of books, analyzing, and critiquing the writing other others? Where all they did was simply write, but never read anything from great writers? No, clearly not. Yet, that's what I see most new programmers doing. There's an urge to do it all on thei…

I'm not sure this is a fair comparison, because books are written to be read , but code is (usually) written to be executed . As much as we all agree that code readability is important, the simple fact of the matter is that executability matters a helluva lot more. We're paid to write code that executes, and many people stop there. The result is that there is a lot of code out there that executes just fine but is com…

Code is primarily for communicating between programmers, if it were mostly meant to be executed it would just be object files.

Being a great coder means being adept at reading code however its structured. Reading unclear code is important because it helps you avoid making the same mistakes... it's also an important skill in practice: You will often encounter unclear code and have to understand it.

The idea that there is one true good form is a misconception often held by novices. An expert should be able to read and write in a multitude of styles so that they can conform to whatever codebase they're working on and apply the best practices within that context.

Re: One Way to Improve Your Coding

#95
post #62

When I was teaching at General Assembly, I always tried to encourage students to read more code. Could you imagine someone studying writing in college without reading a TON of books, analyzing, and critiquing the writing other others? Where all they did was simply write, but never read anything from great writers? No, clearly not. Yet, that's what I see most new programmers doing. There's an urge to do it all on thei…

I'm not sure this is a fair comparison, because books are written to be read , but code is (usually) written to be executed . As much as we all agree that code readability is important, the simple fact of the matter is that executability matters a helluva lot more. We're paid to write code that executes, and many people stop there. The result is that there is a lot of code out there that executes just fine but is com…

[deleted]

Re: One Way to Improve Your Coding

#96
One point not covered by the article is how reading real world code will also help set realistic expectations, especially if you are a relative newbie. The truth is that there is a lot of code in the world, even in popular frameworks and libraries, which does its job but which does so in clunky or unreadable ways. I don't blame this on the developers, on the contrary it's my experience that any codebase will develop a number of FIXMEs and TODOs over time because the initial design very rarely matches the final design and because there is not a business case for making everything shine. Perfect code is a noble goal but prohibitively expensive to implement.

This is a nice lesson for a novice programmer to let sink in. That software is written by humans. Mostly clever people but not infallible. And subject to all kinds of tradeoffs. They call it computer science at university, but most of the time we are craftsmen working on buildings evolving as we go.

I recall my personal eureka moment in this regard. 2001, final year of university, writing Java code for my thesis. Downloaded the source code for the official Java APIs, I think it was, to better understand how they worked. I was genuinely surprised by the amount of critical comments and "fix this" comments strewn throughout the code. It was a great learning experience and took the pressure off my shoulders to be "perfect".

Re: One Way to Improve Your Coding

#97
post #94

Earlier quoted context omitted.

I'm not sure this is a fair comparison, because books are written to be read , but code is (usually) written to be executed . As much as we all agree that code readability is important, the simple fact of the matter is that executability matters a helluva lot more. We're paid to write code that executes, and many people stop there. The result is that there is a lot of code out there that executes just fine but is com…

Code is primarily for communicating between programmers, if it were mostly meant to be executed it would just be object files. Being a great coder means being adept at reading code however its structured. Reading unclear code is important because it helps you avoid making the same mistakes... it's also an important skill in practice: You will often encounter unclear code and have to understand it. The idea that there…

These are all great points, and I'm realising now I have missed the point a little. Reading arbitrary code is good, because you learn something regardless of whether the code is "good" or "bad" -- you learn how to understand more styles of code, and which patterns tend to be easy to understand and which tend to be hard. I guess the part that was tripping me up is that you shouldn't necessarily try to emulate all code you read.

Re: One Way to Improve Your Coding

#98

One point not covered by the article is how reading real world code will also help set realistic expectations, especially if you are a relative newbie. The truth is that there is a lot of code in the world, even in popular frameworks and libraries, which does its job but which does so in clunky or unreadable ways. I don't blame this on the developers, on the contrary it's my experience that any codebase will develop…

Good point. I'm always thinking my code is crap (it is) and inferior. But reading other code has made me realize that others code often has its warts too.

The key is seeing others code warts (or lack of them) makes you identify your own warts.

Re: One Way to Improve Your Coding

#99
What I missed in the article is a suggestion to also try and fix the problems you find in the code. Creating patches that macthes the style of a project, submitting them and handling the communication that usually follows including update to the patch until accepted is a good learning process too. And then you've also helped the project. Win win win win.

And finally. Remember to go back to your own code. You'll be amazed at how many warts you suddenly see. Things to improve, fix, change and cleanup.

Re: One Way to Improve Your Coding

#100

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…

Very good. Libraries are what everybody relies on, but IMHO gets to little attention and appreciation.
Post reply on HN