Live data from Hacker News

One Way to Improve Your Coding

changelog.com

101–110 of 121 posts

Re: One Way to Improve Your Coding

#101
post #18
post #4

So this is a good place to list really nice codebases. sqlite is a fantastic piece of source code, totally worth reading.

For Python, I really like reading Kenneth Reitz' code. For example the Requests library is pretty good reading [0]. When reading code, I like to have the documentation handy as well [1]. The Django project is also good reading. [2], [3] [0] - Requests code: https://github.com/kennethreitz/requests [1] - Requests documentation: http://docs.python-requests.org/en/master/ [2] - Django code: https://github.com/django/dja…

Django does have some really clean code and it is very easy to navigate. I feel like I only grokked Django after I started going through its internals.

I also highly recommend giving Tornado[0] and Bottle[1] a read. Outside of the the web stuff, Sqlalchemy[2] is good

[0] - https://github.com/tornadoweb/tornado [1] - https://github.com/bottlepy/bottle [2] - https://github.com/zzzeek/sqlalchemy

Re: One Way to Improve Your Coding

#102
post #55
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…

Depends what you are wanting to achieve, to be honest. Writing the same code can help make you faster at writing that code. This can be annoying to people who are higher level coders, but the reality is that intrinsic quality of code is easy to complain about, but hard to model the importance of. In large because its importance is quite low. That is, if what they are writing works, despite having what could be seen a…

That is, if what they are writing works,

You make a good point, but imo in real life there is more nuance to it than just works/doesn't work. Which again I've seen with the same collegues: the software works, sort of, yes. Despite some annoyances and known bugs and corresponding workarounds it does what it's supposed to do. But it's oh so brittle. So while you could argue that it works so there is no problem, in fact there is: on every single change which has to be made half of the software falls apart and it takes insane amounts of patching to hold things together. Sure, afterwards it works again, but adding more of the same code, no matter how fast it was written, made things surely not better. I admit this is of course like the worst example and I'm sure there are indeed occasions where the code quality doesn't have that much of an impact. For instance especially in small applications/tools/extensions this is true.

Re: One Way to Improve Your Coding

#103

It doesn't look like a good approach to me. There are a lot of bad code out there and the only thing you can learn from it is how to write bad code. The important things are the right mindset, the ability to reason about code quality, and good set of more concrete skills: algorithms and data-structures, beginner level understanding of different programming paradigms and their applications (class-based OOP, prototype…

"There are a lot of bad code out there and the only thing you can learn from it is how to write bad code." Oh, I dunno. I've done it a bit and found value in it. I spend big chunks of time writing customizations or extensions for WordPress plugins. It's not exactly a fun way to make a buck but it is easy to be better than most folks writing for WP and I work remote from a tourist town... but my point is that I have r…

I get your point. One of my points is reading somebody else's code isn't for beginners. This looks aligned with your last sentence.

Re: One Way to Improve Your Coding

#104
This is a good suggestion. I'd also add answering questions on stackoverflow to this list. Often times you'll know the answer, but need to refresh yourself with the documentation before answering. Great way to keep skills sharp and help someone out.

Re: One Way to Improve Your Coding

#105
I think the quickest way to improve most code is to write it in functional style. You don't need a functional programming language you can write in functional style in pretty much any mainstream language without difficulty. Freedom from side effects makes composition and testing so much easier.

Re: One Way to Improve Your Coding

#107
One great resource I found recently is the series of books called The Architecture of Open Source Applications.

http://aosabook.org/en/index.html

Books are available for free on the website. I'm currently making my way through volume 1, and I can say this is exactly what I was missing - a real-life study of "the bigger picture", of how the code is structured not just on the class/method level, but on the subsystem level too.

Re: One Way to Improve Your Coding

#109

To save anyone the trouble: the way is supposedly to read code. Here's a counterpoint I find pretty convincing: http://www.gigamonkeys.com/code-reading/ Here's a brief excerpt: > Seibel: I’m still curious about this split between what people say and what they actually do. Everyone says, “People should read code” but few people seem to actually do it. I’d be surprised if I interviewed a novelist and asked them what th…

How do you read a novel? Start at the first page. How do you read a codebase? Uhh...

Re: One Way to Improve Your Coding

#110
I have found that reading shit code improves mine more than anything (my own included). Whenever I can't comprehend something easily, its usually time for it to be refactored. I think about how I would expect it to be if written well.
Post reply on HN