Listener Question: Sean asks, "Where Can I Find Well Written Code?"
Published 11/4/2015
Sean asked me where to find well written code in Slack. (You can join us by going to http://spec.fm/slack)
- @fat's article on Medium's CSS
- Chris Coyier's article on Codepen's CSS
- GitHub's CSS
- IRC
- jQuery IRC
- Trending repos on GitHub
- Microsoft on GitHub
- Google on GitHub
- NASA on GitHub
- SassConf
- SassSummit
Today's episode is sponsored by Hired.com! If you are a developer or a designer looking for a job, Hired is a fantastic place to begin your journey! The special link for a doubled bonus is https://hired.com/developertea.
Lastly: Be sure to rate and review Developer Tea on iTunes!
Transcript (Generated by OpenAI Whisper)
Hey everyone and welcome to Developer Tea my name is Jonathan Cutrell and today I'm going to be answering a question from listener Sean. Sean is in the Slack group that we've started at speck.fm slash slack. You can join for free. It'll always be free for anyone who joins that Slack channel. We have nearly 2,000 members in Slack now. It's pretty awesome. You should come and join us. Sean asks about finding good code. But before I read Sean's question I want to thank today's sponsor hired.com. If you are a designer or a developer and you are looking for a job, hire.com is a fantastic place to start that journey. You can go and check it out at hire.com. Later on we'll talk about a little bit of an incentive for people who aren't looking for jobs but may know someone who is. So stick around for that we'll talk about hired a little bit more later. But first I want to talk about Sean's question. I'm going to read it directly how Sean asked it to me in Slack. He said, do you know where I can view other people's well written code? I've done so much reading to try to learn some code and I've tried building my own things. But being self-taught I feel like I'm teaching myself poor practices. Essentially I'm looking for something similar to FATS article on mediums CSS. Should I scour popular GitHub repos? Sean I think this is a great question. I'm very glad you asked it. And I think a lot of people are going to get a lot of value out of what you have asked. And I hope it starts some good conversation around where good code can be found. So I want to dive right in to answer this question. But first I need to start out with kind of a caveat. We need to start with a definition of what well written actually means. Because when we say well written code we typically mean code that is written by people or companies who are well known. However the truth may be very different. These companies can and many times have written code that contains oversights, that cost that company or that person millions of dollars in time and a lot of long nights and weekends for Developer To fix the problem. Sometimes it actually costs material resources. And that's just not a good situation to be in. So I wouldn't consider that good code even though sometimes we assume that because it was written by a big company or because it was written by somebody who is known in the development community that it is inherently good code and that's not necessarily true. So what constitutes good code? Well, perhaps it's code that supports services, products or other projects that have been successful for a long time. But most of the time as developers good code means writing code that is maintainable. One code that is readable and flexible to future change and doing so without going away over budget. This is only a common definition though. So for any given person good code could easily be seen as something different entirely from this. So keep that in mind as you go and look for this that your definition of what good code is maybe a little bit different from somebody else's definition of what good code is which means that it's a little bit difficult to search by just saying good code. You may have to determine what kinds of qualities you are looking for in code that make it good to you and then search for that. So that's kind of a prerequisite to this conversation about finding good code on the internet. So let's dive into some recommendations for you and for anyone who is listening to this episode Sean. For the sake of this discussion I will assume that you mean that good code is part of a relatively successful piece of software that is used by a significant number of people and that is still updated regularly. This often fits the definition of code we want to write as developers. So I'm assuming that you're looking for code that you would consider the style and maybe the maintainability that you aspire to accomplish in your own code. So unsurprisingly Sean, you have to first determine what those projects are. Determine the projects that you say are successful. Determine the ones that you want to emulate the success of those projects in your own projects. That's kind of the first step. Start by finding where the community exists for the language that you are wanting to research. For example, the Ruby community is active in IRC. We're active on GitHub and we're active on Twitter. But we're probably less active on messaging boards, forums, Facebook and pretty much any other venue. We're also pretty active in blogs as well. This gives you a strong consistent channel of advice and discussion that is occurring in the community when you find these different channels that they're talking in and will also give you some idea of the voices you can trust in the industry. Another good idea is to try to find out if there are any kind of Slack communities or something similar that the people who are writing in that particular language are involved in. I personally remember when I was first picking up jQuery, for example, I sat in the jQuery IRC room and pretty much everybody who was on the jQuery core team used to stick around in the jQuery IRC room. So finding those locations will help you determine what voices to listen to and kind of where that code is going to be coming from, the code that you consider good or successful code. My second tip for you, Sean, is that code isn't a lot of places, but honestly you hit the nail on the head. GitHub is a fantastic place to browse code. That's because on GitHub, you see code in the context of the community that is developing that code. You see the people, you see the discussions, you see the history. If you dive deeply, you can see the specific code that addresses issues that have been closed in the past. You can look at poll requests. You can learn common patterns of developers working on major platforms, including just about every major tech company on the planet, excluding Apple. Apple has not gotten involved on GitHub, but Microsoft, Facebook, Twitter, pretty much any company you can imagine. NASA is on GitHub, Google is on GitHub. In fact, Google has over 32 pages worth of projects on GitHub. That's not 32 projects. That's 32 pages of projects, hundreds and hundreds of projects that Google is a part of on GitHub. So I do recommend looking at GitHub. Of course, it is necessary for you to weed out the things that aren't necessarily going to be good code. But part of that comes from actually learning what it means to write good code, learning what it means to write maintainable code. That is an entirely different process from where to look. We'll cover that in other episodes. In fact, we talked about similar things in past episodes, but there's just simply not enough time to talk about how to determine what code is considered maintainable, what types of practices you need to be looking into. But taking some time to look over the projects that you consider to be successful on GitHub can definitely be illuminating. It's also illuminating to look on GitHub to find common practices for a given language, and also to find out how people manage the projects themselves, how people manage dealing with issues over time, how long it takes people to close out certain issues. For example, the behavioral patterns of developers, the language they use to talk about the stuff that they're developing, whether it's features, or the issues themselves. All of this can add to your collective knowledge of how these developers are doing their projects, which is really the question that Sean is asking, the underlying question here, which is how are developers actually doing their projects? How is FAT's article on Medium's CSS? That's showing you how FAT and the people at Medium are actually managing the CSS at Medium. You're not really necessarily wanting to see the exact code that Medium is using, but rather how Medium is solving the problems that they encounter when they are writing CSS for a major website like Medium. So I have one more recommendation for you, Sean, and everyone else who is listening. But first I want to talk about today's sponsor, Higher.com. Now we were talking about how every tech company pretty much in the world is on GitHub. In another place you can find a ton of tech companies, including GitHub themselves, is on Higher.com. Higher. It has over 2,000 companies that you can get offers from. And in fact, in just 10 minutes, you can get up to 10 job offers from the top tech companies around the world. The salaries are ranging from $75 to $250,000. They have different job types, for example, if you want to work part-time or you want to work full-time. Those are both options for you at Higher.com. You are a designer or a developer. Hired is for you. Now I mentioned at the beginning of the show that there is an incentive for people to use hired who aren't looking for a job. And that incentive is if you know somebody who is looking for a job and you refer them and they end up getting a job through hired, then you can get a referral bonus of $1337. Now if you are the one who is looking for a job and you end up taking an offer through hired.com, normally hired provides a $2,000 signing bonus just as kind of a thank you. But if you use a special link that you can find in the show notes at spec.fm, you can instantly double that bonus to $4,000. Make sure you use that link when you sign up. You can find that link again in the show notes at spec.fm. Thank you again so much to today's sponsor, hire.com. So I've been talking about Sean's question about where to find good code and we've been talking about the definition of what good code actually is. And I have one more recommendation for you, Sean. Let's go back over the first two just so we can keep them fresh and our memories here. Start by finding the community that exists for the language that you are wanting to research. You want to find the people who are building the projects that you care about in that particular language, for example, Ruby community is active on IRC and GitHub and Twitter and also in blog comments. The second recommendation was that code isn't a lot of places but GitHub is a great place to browse code because of the context that it provides around the code. Number one, and number two, because so many major companies are on GitHub and there is a lot of really high quality code that you can peruse on GitHub. And number three, you mentioned FAT's article on medium CSS but the reality is that CSS doesn't have much of a standardized format or style for writing. But most other languages do. So I would recommend for most languages that you refer to the base documentation of that language and maybe even dig into the standard libraries for that language. You'll find that there is usually a consistent style and some patterns that the authors of the code in a given language tend to use. And with languages like CSS that don't have much of an official standardization of patterns, there are usually methodologies that you can find online that address the lack of standardization with an opinionated solution. For example, with CSS, you can find BIM CSS or OOCSS. You want to be careful with these opinionated solutions as these languages are often built flexibly on purpose, right? So that you can fit them to your problem that you are trying to solve rather than writing the code based on that methodology that you found that may or may not map very well to your problem, right? So people are coming up with these methodologies all the time. They're coming up with patterns and ways of dealing with code that aren't necessarily prescribed by the code itself. And a lot of the time, these are really useful things for us to learn about. BIM or OOCSS for CSS can help you think about the problems that CSS has on its own and think about ways of mitigating those problems. But sometimes those patterns aren't necessarily the best solution for your problem. So keep that in mind as you go forward, Sean. Keep everything in context and realize that most solutions are just another way of saying opinion. A lot of solutions in computer science end up being opinion. And it's good to formulate your own opinions and to learn why other people have their opinions. There are so many different ways to write CSS, for example. I mean, there are so many different ways to write CSS because the language is incredibly flexible. You can contrast this with something like Python where the community basically believes that there's only one way to solve a given problem. So stay aware of those opinions. Stay aware of the community guidelines and the common practices in a given language. Make sure that you are finding where that community is active online. And of course, GitHub is just as you asked, Sean, and just as you expected. GitHub is absolutely a fantastic place to find the context around the code that you were looking at. Thank you so much, Sean, for sending in this question. And thank you so much, Sean, for being in the Slack channel for spec. If you would like to join Sean and the other 1900 people or so who are in our Slack channel, you can join us by going to spec.fm slash Slack. It's free for you. All you have to do is enter your email and we'll send you an invite directly to come and join our Slack channel. I wanted to mention to everyone who may or may not be in the area that I will be at SAS Conf. Was at CSS DevConf last week at the time that I'm recording this. And I'm going to be at SAS Conf from November 11th to November 14th. I'll include a link in the show notes for you to go and pick up a ticket if you're interested in joining me at SAS Conf. I will also be speaking at SAS Summit, which is actually an online conference. If you are interested in SAS, you should definitely check it out. And I will include a link in the show notes for that as well. Thank you so much for listening to today's episode. And thank you to today's sponsor, hired.com. Hired is a great place for you if you are looking for a job as a designer or a developer, or as we mentioned before, if you know someone else who is, you can get a referral bonus if you refer someone and they end up getting a job through hired. Now, you're going to want to go and check it out through the special link in the show notes that you can find at spec.fm because that doubles the signing bonus if you end up getting hired through hire.com. Thank you so much again to hire.com. And thank you to you for listening to Developer Tea. Make sure you go and subscribe to Developer Tea and whatever podcasting app that you use. And until next time, enjoy your tea.