Finding Well-Written Software
-
Just my $0.02 but I think you can only get so far by looking at other people's code. Just like writing a book, the only way to do it well is by actually writing a lot. Do look at good code, but don't spend too long on it. Another thing is there is no objectively "well written" software. When you go out into the industry (I'm assuming you still haven't or are new to it), you will come across all kinds of a-holes who find fault with every f-ing thing no matter how well it's written. I think there was someone who posted here about how the boss rejected his code because the others were too incompetent to understand it. Of course this is no reason to write shoddy software, but it is better to adopt your style to the situation at hand, and to develop your own style irrespective of what others are doing. There is no reason to reinvent the wheel, but even less reason to not innovate just because something good enough is already available. From personal experience, I am less and less inclined to actually create anything because it is so easy to string together other people's code (employers seem to expect it too, given the tight deadlines and ridiculous budgets), and it has had a detrimental effect on my work quality.
California 90025 wrote:
California 90025
I assume this means you're around WeHo? I'm in Studio City.
Jeremy Falcon
-
So one thing I'd love to do more of is reading/studying clean code/software. I've been reading material by Steve McConnell and Uncle Bob, which are fantastic... But I'd like to see more examples of the principles actually in code. I tried searching for Uncle Bob' GitHub and found it, but it's rather limited.. And haven't even been able to find any code by Steve McConnell online. Are there any other folks who are known for writing good code that you'd recommend I check out? I'm looking for actual source code... Because just roaming around the web everywhere, I've found all kinds of nasty stuff! Bonus points for C# but really, C++, and Java would be understandable as well.
The problem with that is a lot of it is subjectivity. For instance...
// some think this is cleaner
var x = (y == 5) ? 0 : 1;// and, some think this is cleaner
var x;
if(y == 5) {
x = 0;
} else {
x = 1;
}// or this
var x;
if(y == 5)
{
x = 0;
}
else
{
x = 1;
}// or this too
var x;
if(y == 5)
x = 0;
else
x = 1;And who's really right or wrong?
Jeremy Falcon
-
You're a cruel man! :thumbsup: I suspect that Win10 was actually pretty well written - the problem is that it's badly designed. It fits an "ivory tower" ideal rather than the real world, and that's where the problems start. Then patches get chucked in to make the ideal sort-of-work in the real world (despite the real world's strenuous objections) and that makes the situation worse.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
Whoa! Are you saying that the ribbon and baby blocks are "ideal world"? Only smoke the wool from the black or white sheep, Griff. Leave the green ones be.
I wanna be a eunuchs developer! Pass me a bread knife!
-
The problem with that is a lot of it is subjectivity. For instance...
// some think this is cleaner
var x = (y == 5) ? 0 : 1;// and, some think this is cleaner
var x;
if(y == 5) {
x = 0;
} else {
x = 1;
}// or this
var x;
if(y == 5)
{
x = 0;
}
else
{
x = 1;
}// or this too
var x;
if(y == 5)
x = 0;
else
x = 1;And who's really right or wrong?
Jeremy Falcon
Jeremy Falcon wrote:
And who's really right or wrong?
COBOL's right, of course:
IF y = 5 THEN
x = 0
ELSE
x = 1
END-IF.(Whatever you do, don't forget the fullstop)
I wanna be a eunuchs developer! Pass me a bread knife!
-
Whoa! Are you saying that the ribbon and baby blocks are "ideal world"? Only smoke the wool from the black or white sheep, Griff. Leave the green ones be.
I wanna be a eunuchs developer! Pass me a bread knife!
Nope, they're solidly Ivory Tower! :Laugh:
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
-
Jeremy Falcon wrote:
And who's really right or wrong?
COBOL's right, of course:
IF y = 5 THEN
x = 0
ELSE
x = 1
END-IF.(Whatever you do, don't forget the fullstop)
I wanna be a eunuchs developer! Pass me a bread knife!
Mark_Wallace wrote:
COBOL
How DARE you mention that... that... THING here in the Lounge! To the Soapbox with you!
What do you get when you cross a joke with a rhetorical question? The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism. Do questions with multiple question marks annoy you???
-
So one thing I'd love to do more of is reading/studying clean code/software. I've been reading material by Steve McConnell and Uncle Bob, which are fantastic... But I'd like to see more examples of the principles actually in code. I tried searching for Uncle Bob' GitHub and found it, but it's rather limited.. And haven't even been able to find any code by Steve McConnell online. Are there any other folks who are known for writing good code that you'd recommend I check out? I'm looking for actual source code... Because just roaming around the web everywhere, I've found all kinds of nasty stuff! Bonus points for C# but really, C++, and Java would be understandable as well.
To me, studying what good code looks like and the best practices thereof has more value than looking at somebody else's code. I consider the reference article here[^] to be of more value than a bunch of code. If you want to lose your mind, read the source for the stl libraries.
I'm retired. There's a nap for that... - Harvey
-
Mark_Wallace wrote:
COBOL
How DARE you mention that... that... THING here in the Lounge! To the Soapbox with you!
What do you get when you cross a joke with a rhetorical question? The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism. Do questions with multiple question marks annoy you???
-
So one thing I'd love to do more of is reading/studying clean code/software. I've been reading material by Steve McConnell and Uncle Bob, which are fantastic... But I'd like to see more examples of the principles actually in code. I tried searching for Uncle Bob' GitHub and found it, but it's rather limited.. And haven't even been able to find any code by Steve McConnell online. Are there any other folks who are known for writing good code that you'd recommend I check out? I'm looking for actual source code... Because just roaming around the web everywhere, I've found all kinds of nasty stuff! Bonus points for C# but really, C++, and Java would be understandable as well.
As a recommendation I'd always suggest having a look at the GitHub repo for Doom & Doom3 (from John Carmack at id Software). Doom written in C and Doom3 in predominantly C++. GitHub - id-Software/DOOM: DOOM Open Source Release[^] GitHub - id-Software/DOOM-3-BFG: Doom 3 BFG Edition[^] Although a lot of the work is in game development and graphics (and in C), I found it useful to look at how it highlights good project and code layout. Like people have said already in this thread, I wouldn't look at the code to "learn how to write code" but rather to learn what good "coding practices" result in. Keep in mind some of this code has been cleaned up before publishing on GitHub.
K
-
The problem with that is a lot of it is subjectivity. For instance...
// some think this is cleaner
var x = (y == 5) ? 0 : 1;// and, some think this is cleaner
var x;
if(y == 5) {
x = 0;
} else {
x = 1;
}// or this
var x;
if(y == 5)
{
x = 0;
}
else
{
x = 1;
}// or this too
var x;
if(y == 5)
x = 0;
else
x = 1;And who's really right or wrong?
Jeremy Falcon
-
As a recommendation I'd always suggest having a look at the GitHub repo for Doom & Doom3 (from John Carmack at id Software). Doom written in C and Doom3 in predominantly C++. GitHub - id-Software/DOOM: DOOM Open Source Release[^] GitHub - id-Software/DOOM-3-BFG: Doom 3 BFG Edition[^] Although a lot of the work is in game development and graphics (and in C), I found it useful to look at how it highlights good project and code layout. Like people have said already in this thread, I wouldn't look at the code to "learn how to write code" but rather to learn what good "coding practices" result in. Keep in mind some of this code has been cleaned up before publishing on GitHub.
K
Thank you! Yeah, it seems writing good code stems from both design and good coding practices... Currently, I am reading the books Code Complete and Clean Code by Uncle Bob. Code Complete seems to focus more on the design aspect stuff, and Clean Code seems to focus more on the actual code-writing practices. However, Simply looking at projects gives me at least some insight into the coders' styles out there and what type of code I will run into out there.
-
As a recommendation I'd always suggest having a look at the GitHub repo for Doom & Doom3 (from John Carmack at id Software). Doom written in C and Doom3 in predominantly C++. GitHub - id-Software/DOOM: DOOM Open Source Release[^] GitHub - id-Software/DOOM-3-BFG: Doom 3 BFG Edition[^] Although a lot of the work is in game development and graphics (and in C), I found it useful to look at how it highlights good project and code layout. Like people have said already in this thread, I wouldn't look at the code to "learn how to write code" but rather to learn what good "coding practices" result in. Keep in mind some of this code has been cleaned up before publishing on GitHub.
K
-
So one thing I'd love to do more of is reading/studying clean code/software. I've been reading material by Steve McConnell and Uncle Bob, which are fantastic... But I'd like to see more examples of the principles actually in code. I tried searching for Uncle Bob' GitHub and found it, but it's rather limited.. And haven't even been able to find any code by Steve McConnell online. Are there any other folks who are known for writing good code that you'd recommend I check out? I'm looking for actual source code... Because just roaming around the web everywhere, I've found all kinds of nasty stuff! Bonus points for C# but really, C++, and Java would be understandable as well.
First, reading lots of code is the RIGHT approach. Kudos. To put it into reading/writing books, I would say that someone who actually writes a (decent) book has read THOUSANDS of books first. It just makes sense. Second, you can learn from ANY code. Even if you learn "Ouch. That's terrible". B-Movies exist. They remind us what works in good movies, and what doesn't work. Third, consider reading the (source code for) well understood concepts. Compilers (GCC?). Compiler theory is pretty stable. the concepts of cross compilers, linkers, etc. are all well understood. Optimizers, for example, re-teach indirection (converting code to pseudo assembler, optimizing that, then generating the assembler already optimized). Allowing the optimizer to be shared! Finally, a discussion about engineering... Most people think that engineering is about perfection. It is actually about making things Good Enough. Optimizing the 3 corners of the triangle of (Fast, Right and Cheap). You can only optimize 2 of the 3, and you agree to sacrifice the third. You can optimize only 1, and sacrifice the other 2. I learned about this from an engineer neighbor who was designing a factory floor with equipment mounting technology. His junior engineer was calculating the EXACT bolt sizes required based on the machine and the other variables. He made him go back and find the Most Common Denominator to reduce installation issues and mistakes. In words developers can understand. I have a compiler to sell you. It's NEW warnings are guaranteed to reduce the number of bugs by 10% in your code. It costs $1 Million per seat. Interested? I hope not! So, keep reading code. Then find useful code, like Notpad++, and work on compiling it and testing it. Then find a list of bugs for that Product and start fixing them and testing your solutions. You should quickly learn a couple of things. Like having a set of automated tests makes you feel safer to make changes and know if you actually broke something. I would finish it off with. BREAK the software. Find what tests fail, and how. It's insightful!
-
So one thing I'd love to do more of is reading/studying clean code/software. I've been reading material by Steve McConnell and Uncle Bob, which are fantastic... But I'd like to see more examples of the principles actually in code. I tried searching for Uncle Bob' GitHub and found it, but it's rather limited.. And haven't even been able to find any code by Steve McConnell online. Are there any other folks who are known for writing good code that you'd recommend I check out? I'm looking for actual source code... Because just roaming around the web everywhere, I've found all kinds of nasty stuff! Bonus points for C# but really, C++, and Java would be understandable as well.
You are asking a FANTASTIC question, and you should be HIGHLY commended for your EXEMPLARY judgement and acumen for seeking such recommendations. (Of course, I can say that because I asked the same question myself about six months ago! :-D ) Among the many helpful replies that I got in that thread, the one from BillWoodruff[^] was the most extensive and helpful.
-
So one thing I'd love to do more of is reading/studying clean code/software. I've been reading material by Steve McConnell and Uncle Bob, which are fantastic... But I'd like to see more examples of the principles actually in code. I tried searching for Uncle Bob' GitHub and found it, but it's rather limited.. And haven't even been able to find any code by Steve McConnell online. Are there any other folks who are known for writing good code that you'd recommend I check out? I'm looking for actual source code... Because just roaming around the web everywhere, I've found all kinds of nasty stuff! Bonus points for C# but really, C++, and Java would be understandable as well.
Starting in 1975, when I had an epiphany, I have been writing code that I find I could easily maintain. The code was written for clients, both in-house and external. It ranged from real-time to interactive financial systems; from assembly language to high level languages (yes, even COBOL and FORTRAN). The key to my success was, I believe, the strict use of coding standards. These coding standards were applied to all my code, not just deliverables to clients but also to code developed during research and experimentation. When a chief programmer (team leader, these days), I required the entire team to use an unambiguous set of coding standards. I have published some of these standards on CP under the guise of "guidelines." But more importantly, I offer as examples the code in any of the articles I have published on CP. As I said, I use the standards whenever I develop code. It is now so automatic that I seldom need to think about it (so much for the argument that standards slow you down). There is an unfortunate perception that applying standards makes software cost more. Agreed, as an organization starts using standards, code reviews are needed to assist programmers in achieving standards compliance. But once it's happened, you'll be amazed at the result. Not only is the software maintainable (reducing the long-term cost) but it is reusable (as a colleague once said "good software that you do not need to write is very cheap").
Gus Gustafson
-
The problem with that is a lot of it is subjectivity. For instance...
// some think this is cleaner
var x = (y == 5) ? 0 : 1;// and, some think this is cleaner
var x;
if(y == 5) {
x = 0;
} else {
x = 1;
}// or this
var x;
if(y == 5)
{
x = 0;
}
else
{
x = 1;
}// or this too
var x;
if(y == 5)
x = 0;
else
x = 1;And who's really right or wrong?
Jeremy Falcon
your first example is not the same as the others:- ?: is NOT if-then-else...
// is cleaner; is wrong!
var x = (y == 0) ? 0 : z / y;// is ugly; is correct!
var x;
if (y == 0) x = 0; else x = z / y;If it were easy then anybody could do it. Wait, .... what!
-
your first example is not the same as the others:- ?: is NOT if-then-else...
// is cleaner; is wrong!
var x = (y == 0) ? 0 : z / y;// is ugly; is correct!
var x;
if (y == 0) x = 0; else x = z / y;If it were easy then anybody could do it. Wait, .... what!
I'm not sure if this is sarcasm or not. :~
Jeremy Falcon