|
A very pork excuse for a pun.
If you're going to hit us with that slop I'm sure someone will squeal on you.
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein | "As far as we know, our computer has never had an undetected error." - Weisert | "If you are searching for perfection in others, then you seek disappointment. If you are seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010 |
|
|
|
|
|
a hogsfie ?
I'd rather be phishing!
|
|
|
|
|
If it was a prawn sandwich, would that be a selfish?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Though I'll go as far as the next man in search of a good pun I really have to put my pedant hat on and insist that a prawn is a crustacean and therefore seafood but never shellfish!
I am not a number. I am a ... no, wait!
|
|
|
|
|
[I hope this doesn't cross the line of what I shouldn't post about here...]
I was just reminded of the oft-given advice that to improve your coding skills you should "read lots of code". This made me wonder: What code should I read? If I were a painting instructor, I would advise my students to study the masters: Michelangelo, VanGogh, Norman Rockwell, Bill Watterson. But what about coders?
What are some of the classic code-bases that every aspiring software developer should read at least once in his/her life? Alas, some of the best are doubtless locked up behind proprietary firewalls, but of the code that is publicly available, which programs would you suggest are worthy of studying or even emulating?
|
|
|
|
|
IMHO, the advice is misleading. I think the author meant you should try to learn from other people's code in the context of the work you're doing.
For example, if you've been tasked with fixing a SQL injection bug in a method (easy enough to do), look for other places in the codebase where this has been done and see if the developer implemented other safeguards (e.g. validating or auto-fixing parameter values).
/ravi
|
|
|
|
|
Ravi Bhavnani wrote: ), look for other places in the codebase where this has been done and Copy/paste what you find there.
Yes, I have seen that project
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Eddy Vluggen wrote: Copy/paste Or refactor.
/ravi
|
|
|
|
|
There's a lot of the .NET world that is now open source (Roslyn code compilers, Entity Framework)...I'd say reading through how they organise their code would be somewhat informative.
|
|
|
|
|
|
Kevin Marois wrote: I've seen code from MS that leaves me scratching my head and wondering WTF was this guy thinkin?
That just means that he should be reading your code
We can program with only 1's, but if all you've got are zeros, you've got nothing.
|
|
|
|
|
You mean those "example code" sections that presume you have reached the page after having read the preceding twenty, when really all you did was search straight to this one?
I may not last forever but the mess I leave behind certainly will.
|
|
|
|
|
Great suggestion. In fact, at the time your post came in, I just happened to be reading this blog post, which pointed me in the same direction.
I also just happened to come across this tool, which I should think would come in very handy when spelunking some of the more cavernous codebases out there (like Roslyn).
Thanks!
|
|
|
|
|
If you're the person who wants to drive a humvee or a unimog, then microsoft code is for you. It's ugly. It's functional. It's uninspired. It's very durable. I have never seen microsoft code that was in any way elegant or subtle. It's ok code to learn on, but will never inspire you with beauty.
|
|
|
|
|
I'd have to agree somewhat with Ravi - but I don't think reading code improves your skills significantly.
The problem is that code is an end product - and often the almost irrelevant bit that has been churned out by the lowest level coder. The important stuff often happens a long time before the code is written, and the final product tells you nothing about the decisions, the false starts, the wrong directions which lead up to the final product. And it's those that make good code, not the mechanics of coding in a specific language. Yes, there are "generic style points" you can pick up and apply, but the code itself in isolation doesn't tell you much at all about how to produce quality code on a different project.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Come on, OG. I expected this from some of the others, but not from you! Would you advise an auto-designer not to study a Lamborghini? Would a growing architect gain nothing from a study of the Burj Al Arab, or the One World Trade Center? Can an aspiring composer learn nothing from analyzing the techniques Beethoven, Bach, and Bublé? The same argument about "the final product" could be made about each of those fields, but it wouldn't hold up. Of course I would love to study the personal notes of Tolkien where he divulges all his inner grapplings with plot twist connundrums, but in lieu of that I am still a much better author having merely read LOTR three times.
All I am saying, is that when it comes to code, it is much more difficult (for me, anyways) to find the open source code that is worthy of being studied. So I am simply asking for recommendations. Have you ever read a program -- perhaps in a completely different field than your own -- which made you say, "Wow, that was put together well. It's intuitive, clean, elegant, and robust." I think somebody needs to start compiling a list of such masterpieces for the rest of us to study and admire.
|
|
|
|
|
kdmote wrote: Would you advise an auto-designer not to study a Lamborghini? It's easy to spot a lamborghini by its smooth lines and the sound its motor makes. With code, you have to get it into your head before discovering if it's a lamborghini or a rusty Yugo with 100,000 miles on it. For every epic software poem, there are 10,000 drab tomes of uninspired code.
|
|
|
|
|
EXACTLY. Which is why I'm asking for recommendations. I'd like somebody to start compiling a list of the epics, so we can all benefit from studying them.
|
|
|
|
|
I've never looked at it in total to be sure, but Stepanov's original Standard Template Library is probably brilliant. Unfortunately, the version that comes with Visual Studio has been messed up with non-core stuff and compiler dependencies, so it's quite hard to understand.
|
|
|
|
|
While this might be reasonable there is a problem for beginners:
They usually can not know if the code has the quality to be suitable for learning.
On the other hand there is code to be known as "good" but might be too complex for beginners (or even intermediates).
My suggestion for beginners:
Buy a good book (should be no problem to find recommended ones). The code examples from those are usually good.
|
|
|
|
|
Well, you can't read the code you can't find ... which brings up the thought that you're best off reading code that interests you out of the gate.
(Short lesson on the dynamics of rectified electronic circuits over)
|
|
|
|
|
I feel your should learn from both Michelangelo (about what to do) and the street graffiti artist (about what not to do).
Look at some of the posts here[^], along with their responses.
This book[^], written in 1999, is a great read. Timeless, I feel.
|
|
|
|
|
Most of all you should read real working code, like which code you will write. The actual use of your language, API and libraries is important. Often you find on github nice code.
But more important than reading is writing: only by practicing you see your weaknesses.
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
The most productive code-reading I've ever done has been when I was implementing a well-known algorithm, and I looked at other implementations of the algorithm for suggestions and gotchas. If you know the algorithm fairly well, that helps you follow the code. The code in turn can help you understand corner cases and real-world optimizations that come up when implementing the algorithm.
Find an algorithm that you need to use, and then go looking for code that implements it. You'll find both good and bad in such a search, but reading the bad can be as useful as the good ("here's what not to do"). Learning to discriminate between the two is useful as well.
Software Zen: delete this;
|
|
|
|
|
Indeed. A fellow CP-er just posted this link in these very halls a couple days ago. Good reading for sure. But I would still like to get a bigger picture -- code samples that would help me to understand architectural solutions on a grander scale. Code that I can go sit in for a while -- like the cathedral at Notre Dame -- and just be able to look around in awe.
|
|
|
|