You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
113 lines
4.1 KiB
113 lines
4.1 KiB
11 months ago
|
<!DOCTYPE html>
|
||
|
<html lang="en">
|
||
|
<head>
|
||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||
|
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||
|
|
||
|
<!-- Enable responsiveness on mobile devices-->
|
||
|
<!-- viewport-fit=cover is to support iPhone X rounded corners and notch in landscape-->
|
||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, viewport-fit=cover">
|
||
|
|
||
|
<title>Julio Biason .Me 4.3</title>
|
||
|
|
||
|
<!-- CSS -->
|
||
|
<link rel="stylesheet" href="https://blog.juliobiason.me/print.css" media="print">
|
||
|
<link rel="stylesheet" href="https://blog.juliobiason.me/poole.css">
|
||
|
<link rel="stylesheet" href="https://blog.juliobiason.me/hyde.css">
|
||
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=PT+Sans:400,400italic,700|Abril+Fatface">
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
</head>
|
||
|
|
||
|
<body class=" ">
|
||
|
|
||
|
<div class="sidebar">
|
||
|
<div class="container sidebar-sticky">
|
||
|
<div class="sidebar-about">
|
||
|
|
||
|
<a href="https://blog.juliobiason.me"><h1>Julio Biason .Me 4.3</h1></a>
|
||
|
|
||
|
<p class="lead">Old school dev living in a 2.0 dev world</p>
|
||
|
|
||
|
|
||
|
</div>
|
||
|
|
||
|
<ul class="sidebar-nav">
|
||
|
|
||
|
|
||
|
<li class="sidebar-nav-item"><a href="/">English</a></li>
|
||
|
|
||
|
<li class="sidebar-nav-item"><a href="/pt">Português</a></li>
|
||
|
|
||
|
<li class="sidebar-nav-item"><a href="/tags">Tags (EN)</a></li>
|
||
|
|
||
|
<li class="sidebar-nav-item"><a href="/pt/tags">Tags (PT)</a></li>
|
||
|
|
||
|
|
||
|
</ul>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
|
||
|
<div class="content container">
|
||
|
|
||
|
<div class="post">
|
||
|
<h1 class="post-title">Things I Learnt The Hard Way - Code Style: Follow It</h1>
|
||
|
<span class="post-date">
|
||
|
2019-07-16
|
||
|
|
||
|
<a href="https://blog.juliobiason.me/tags/books/">#books</a>
|
||
|
|
||
|
<a href="https://blog.juliobiason.me/tags/things-i-learnt/">#things i learnt</a>
|
||
|
|
||
|
<a href="https://blog.juliobiason.me/tags/code-style/">#code style</a>
|
||
|
|
||
|
</span>
|
||
|
<p>If your project have a defined code style, you must follow it. Sometimes it
|
||
|
may not be clear ("this struct/class should be singular or plural"?), but do
|
||
|
your best to follow it.</p>
|
||
|
<span id="continue-reading"></span>
|
||
|
<p>If your project doesn't have a style, maybe it's time to pick one. There are
|
||
|
well established styles for almost every language today, so you can start with
|
||
|
that. You can even make your changes, but you need to realize that since it's
|
||
|
been established for a while, a lot of other people are using that style and,
|
||
|
thus, if you keep as is, your code will mesh better with the rest of the
|
||
|
ecosystem.</p>
|
||
|
<p>And remember that even your stupid code is <a href="/books/things-i-learnt/languages-are-more">part of the ecosystem of the
|
||
|
language</a> and the better you
|
||
|
interact with the ecosystem, the better citizen in the ecosystem you are.</p>
|
||
|
<p><strong>TIP</strong>: If you don't have a code style yet, and you're using a language
|
||
|
that's derived from C or C++, use <a href="https://en.wikipedia.org/wiki/Indentation_style#K&R_style">K&R
|
||
|
Style</a>; if you're
|
||
|
working with Python, there is only one style:
|
||
|
<a href="https://www.python.org/dev/peps/pep-0008/">PEP8</a>.</p>
|
||
|
<div>
|
||
|
|
||
|
<div style="float:left">
|
||
|
<< <a href="/books/things-i-learnt/code-formatters">Code Formatting Tools Are Ok, But No Silver Bullet</a>
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<div style="float:right">
|
||
|
<a href="/books/things-i-learnt/google-code-style">... Unless That Code Style Is The Google Code Style</a> >>
|
||
|
</div>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
</div>
|
||
|
|
||
|
</body>
|
||
|
|
||
|
</html>
|