
Write code every day - brettlangdon
https://brett.is/writing/about/write-code-every-day/?hn=1
======
copsarebastards
> _More times than not the above exercise leads me to a problem that I then
> can go off and solve. For example, a few weeks ago I sat down and decided I
> wanted to write a web server in go (think nginx /apache). I knew going into
> the project I wanted a really nice and easy to use configuration file to
> define the settings. So, I did what most people do these days I and used
> json, but that didn’t really feel right to me. I then tried yaml, but yet
> again didn’t feel like what I wanted. I probably could have used ini format
> and made custom rules for the keys and values, but again, this is hacky.
> This spawned a new project in order to solve the problem I was having and
> ended up being forge, which is a hand coded configuration file syntax and
> parser for go which ended up being a neat mix between json and nginx
> configuration file syntax._

You make a persuasive argument for why someone should _not_ write code every
day, but instead step away from the keyboard occasionally and get a sense of
perspective.

No, your mix between json and nginx configuration file syntax is not "neat".
It's pointless, and doesn't solve any real problem. In fact, if anyone ever
uses your idea it will _cause_ problems, by adding another random pointless
format for the rest of us to have to support.

And did you miss the beginning of what you said? You set off to write a web
server and instead you got bogged down in parsing the config files. Your
efforts did not produce a web server. Writing code every day has apparently
not taught you how to focus.

In short, quantity of code does not beget quality. Quality code isn't just
code that's nicely formatted, clear, terse, etc., it's also code that solves a
real problem that you've set out to solve. And just writing more code isn't
going to help you learn what a real problem is, let alone how to solve it.

~~~
furyofantares
The goal, as stated, was to have the experience of writing code. Bringing
another web server into existence was not the goal, it was a potential means
to the goal.

~~~
hoers
Why not set the goal to 'make something that works'? You'd get the whole
'experience of writing code' with it for free

~~~
furyofantares
For the same reason athletes have practice routines that are not "play a game
of <sport>" \-- it allows you to focus your practice. If OP wants to practice
writing nontrivial code, re-implementing something is a good way to avoid the
MORE difficult problem of having to invent a product. It allows him to
concentrate on having a nontrivial coding experience.

As an aside, I personally code just for fun. Not for practice, and not to make
something. I write a lot of code nobody but me will ever see because I enjoy
doing it. Putting pressure on myself to turn each thing into a product can
ruin the joy of experimentation. I'm doing it for the joy of doing it, for the
same reason I might watch TV or play a video game or do a sudoku puzzle.

~~~
copsarebastards
Who said anything about a product?

You can solve real world problems with code without creating a product. Things
don't have to be monetizeable to be useful (and indeed many things that are
monetizeable aren't useful (except to make money)).

And experimentation is totally a necessary part of solving real-world
problems. I'm not sure where you get off representing "solving real problems"
as being anti-experimentation.

~~~
furyofantares
The reason I responded to someone else rather than you is that you do not
appear to be making much of an attempt to understand the things you are
replying to. You are, to my best estimation, simply being argumentative. For
example, in your previous post, you said you could just write echo "Hello
World" over and over, which clearly does not give you any practice at writing
code and is clearly not related to the conversation. In this post you talk
about monetization, something I didn't mention at all, and while "product" may
not have been the best possible word I could have used, it makes me think you
didn't make much of an attempt to understand my point.

~~~
copsarebastards
> For example, in your previous post, you said you could just write echo
> "Hello World" over and over, which clearly does not give you any practice at
> writing code and is clearly not related to the conversation.

No, it definitely _is_ practice at writing code; it's just not useful
practice. My point is that not all practice is useful. If you're going to
accuse me of not making much attempt to understand my point, maybe don't
dismiss what I said so easily?

------
throwaway12309
Actually, spend time with your kids every day. Or your special one. Or
kitesurfing. Or playing pool. Or just learn about chess and play folks in the
park.

Do other things and let your mind expand and bring those benefits to your
code. It will make you a better coder (and person) and life will actually be
interesting.

~~~
dominotw
what? How did you come to those conclusions ?

~~~
veb
I think his point is quite obvious, which is basically "don't forget there's a
life outside of the tech world".

I know that I'll sit here doing nothing on the Internet when I'm not
constructive yet the hours still fly on by. Realistically, I should realise
when things won't get better, get up, go for a walk or play with my son. On
the off chance I've done this in the past, I always feel more refreshed and
can turn a previously crappy day into something positive.

But sitting on your chair, punishing yourself because you don't know what to
do/code, isn't very effective in bettering yourself.

I hope that's what OPs point was. :)

~~~
brettlangdon
I totally agree with this. And is actually a really good point I missed in my
article.

You cannot, and should not, force yourself to sit in front of the computer
non-stop just because you "should". You need to take those breaks too, they
are just as important as the work you put towards mastering your craft.

------
davelnewton
No no, don't.

Athletes don't practice every day, they rest.

The brain needs rest, just like the body. Take some down time. Come back
refreshed. Practice deliberately.

~~~
ggreer
I'm sorry, but your comment is doubly-wrong.

First, most athletes _do_ train every day. Even tapering before an important
competition involves training daily. I ran track and XC competitively in high
school and college. Some of my teammates hadn't missed a day in _years_. Most
of us only skipped training if we were injured or very ill.

Second, the brain is not a muscle. Sleep deprivation and stress hormones can
diminish its abilities, but no amount of thinking or drudgery can damage it.
Neurons can't tell if they're reading, playing video games, or debugging code.

An examination of history also supports this. A mere century ago, people
toiled far greater for far longer than we do today. The average work week was
over 60 hours![1] Despite such exertions, even the _concept_ of burnout didn't
exist. It _still_ doesn't exist in some cultures, and in the cultures it does,
burnout doesn't affect everyone. Unlike sleep deprivation or physical
exhaustion, some people just don't burn out. If you start looking at studies,
you'll find papers like, _Is burnout separable from depression in cluster
analysis? A longitudinal study_.[2] The answer: no. So far, researchers
haven't been able to reliably differentiate between burnout and depression.
This indicates that burnout _is_ depression, not a guaranteed consequence of
working.

Of course, one should still be wary of depression, and work is one piece of
that puzzle. Yet work alone is neither necessary nor sufficient to cause ruin.
Exercise, social gatherings, and friendships are equally (if not more)
important.

As one more piece of evidence that work alone doesn't cause burnout, I submit
myself. I have written code every day for the past 908 days.[3] That's almost
8% of my existence. Those commits aren't just whitespace or linter changes.
Every day, I write real code that runs in production. I also exercise,
socialize, and generally live a fulfilling life. People sometimes voice their
concerns about burnout. But to me, it's as if they'd asked, "Are you worried
about getting burnt out from reading so much Hacker News?"

1\.
[https://en.wikipedia.org/wiki/Working_time#Gradual_decrease_...](https://en.wikipedia.org/wiki/Working_time#Gradual_decrease_in_working_hours)

2\.
[http://geoff.greer.fm/files/Bianchi_20R__20et_20al__20_28in_...](http://geoff.greer.fm/files/Bianchi_20R__20et_20al__20_28in_20press_29.pdf)

3\.
[http://geoff.greer.fm/images/github_streak_908.png](http://geoff.greer.fm/images/github_streak_908.png)

~~~
atinoda-kestrel
Great response!

There's also the lovely condescension that I can't help but sense when someone
tells me why writing code every day shouldn't be as fulfilling as it is.
That's a big part of how some people get a sense of fulfillment, myself
included. I suck at drawing and painting, and programming is my main creative
outlet. Implying (or sometimes stating!) that I should be spending less of my
time coding so as to spend more time doing something that they find more
fulfilling is... rude at best.

~~~
davelnewton
Nobody said anything even _remotely_ rude, let alone "rude at best". Nobody
said you don't find coding fulfilling, and nobody said you should do something
_they_ find fulfilling. Nobody said coding isn't creative, either.

 _I_ think if _all_ one does is code then the vast possibilities life offers
is being ignored.

~~~
atinoda-kestrel
I wasn't responding to the parent poster directly, but rather addressing some
comments I've heard in meatspace. Sorry I didn't make that clear!

~~~
davelnewton
My bad.

I'll grant you that a lot of people (a) assume coding isn't a creative act,
and (b) assume that what they enjoy _everyone_ will enjoy.

------
lewisjoe
I see a lot of negative comments here. The point being missed is doing
something is better than doing nothing.

Yes he might not have ended up finishing with the web server what he started.
But I'm pretty sure he did NOT set out to build something that would be a
product or a startup someday. He set out to do something repeatedly, so that
he becomes good at it and uncover new problems that are interesting to keep
working on. None of this relates to productivity or writing the best code
possible.

You start out with something; end up finding pleasure in doing something else;
then you keep on doing it until you've written enough code to know where you
stand and keep improving.

The take away for me is this. As for me it always was the chicken to the egg
problem. I need to be keep working to find new problems. However, I need to
start somewhere with a problem that I don't know yet. Trying to rewrite
existing stuff was something I'd do to learn new tech. Now it hits me that I
could use the same, to keep my fingers stuck to the keys.

I'd love to read more writes like this. Sharing how you overcame something is
noble. It helps more people than you anticipate.

~~~
brettlangdon
Thank you. This does a great job of summing up the article. It was exactly
what I hoped people would take away from it.

------
chipz
[do something here] every day is the key to master everything.

~~~
melling
Yes, the 10,000 hour rule.

Except that's wrong...

~~~
shogun21
How is it wrong?

~~~
melling
Are you asking me to Google that for you? I just got downvoted for simply
pointing out that they're wrong.

~~~
mcbutterbunz
No, he's asking you to back up your claim. If you're going to make a statement
like that, you should be prepared to provide some information. Dont make
others do the research.

~~~
melling
Here:
[https://www.google.com/#q=10000+hour+rule+wrong](https://www.google.com/#q=10000+hour+rule+wrong)

The first couple of results are great. However, if you really are interested,
I would look through Google's entire first results page.

------
anoplus
For me the whole point of technology is to free us. I want to write code that
solves a real problem. 90% of my time is spent thinking about what problem to
solve.

------
meowface
Off-topic, but why did you decide not to go with YAML? Did you just want a
version of YAML that wasn't whitespace-significant? Forge just looks like an
nginx-y YAML, with no arrays and `=` instead of `:`.

~~~
brettlangdon
Was mostly just how it turned out. A lot of the decisions were mostly
arbitrary, I wanted something that look/felt like an nginx config but was more
generic (didn't have application specific directives), it just so happened to
end up looking a lot like yaml.

'=' was arbitrary, I think paired with ';' I was going for a programming
language type feel, which might not of been the best decision, but it is what
I did. I also have plans to add more features, there currently are references
(pointers essentially), intend on adding list/sets, operators
(merge/concatenation/substraction/union/intersection/etc) and being able to
reference environment variables. Not sure what else is to come.

Also, side note, I found writer a parser that deals with brackets '{}' to
define blocks was much easier than trying to do it via whitespace. So that
decision was mostly a time based decision.

I wrote an article about the project here:
[https://brett.is/writing/about/forge-configuration-
parser/](https://brett.is/writing/about/forge-configuration-parser/) It
doesn't give any good details into why I made the decisions I did, just a
quick overview.

------
tectonic
Always Be Coding.

~~~
orthoganol
Lol, that article when it came out was incredible. The author somehow failed
to realize that "ABC", from Alec Baldwin's psychopathic character, is actually
satire about the mindset of such psychopaths, not actual advice to live by.

~~~
current_call
How do you know it's satire?

~~~
orthoganol
General literary sense. Have you read the play?

~~~
current_call
That's vague. I'm not entitled to a thorough explanation, but I was hoping for
a better one.

I have not read the play, seen the play, or seen the movie.

~~~
orthoganol
It's similar to asking why I think Malfoy in Harry Potter is portrayed as a
bad person. There's nothing subtle about the GGR character. I recommend
watching the movie, primarily for the performances.

~~~
current_call
I've seen the speech. He isn't nice, but he's still right. "Do a good job or
be replaced by someone who can."

I guess I need to add the movie to my backlog now.

------
quii
While I appreciate the sentiment when you set your goal as coding every day,
that becomes your hammer to solve every problem.

The best example of this is your confguration project. I am amazed how many
well-intentioned projects there are to do with configuration when really all
you need is environment variables. No libraries, works everywhere, with every
language and easy to understand.

[http://12factor.net/](http://12factor.net/)

------
xacaxulu
Work at Wal-Mart every day.

Fix cars every day.

Perform brain surgery every day.

Fly passenger jets every day.

Flip burgers every day.

Hmmm. Doesn't really seem like a great idea.

~~~
Adlai
"Hey hey hey..." yep, that one doesn't quite work either.

"Do you want to know the secret of life? [I'll] tell you the secret of life:
it's not the amount of time we have... it's not quantity and it's not even
quality. It's variety." \- Bardo the Just, _Neverness_ (by David Zindell)

------
_RPM
And tell people who judge you for drinking too much coffee to kindly go f __*
themselves

