Live data from Hacker News

Write code. Not too much. Mostly functions.

brandons.me

21–30 of 362 posts

Re: Write code. Not too much. Mostly functions.

#21
post #11

I would say functions are important, but absolutely pale in comparison to modeling[1]. If you are unable to describe, on paper, what your problem domain actually is , then you have no business opening up an IDE and typing out a single line of code. I will take that further. If, with your domain model, you are unable to craft a query that projects a needed fact from an instance of the model, the you should probably st…

What are the good learning resources to get started with this? Thanks

Re: Write code. Not too much. Mostly functions.

#22
post #5
post #2

And functions should be no bigger than your head.

This is my least favorite programming advice. Splitting functions for no reason other than "it's too long" is a bad practice. https://news.ycombinator.com/item?id=25263488

This is the first time I've heard "functions should be no bigger than your head" and I actually really like it. Rather than prescribing some arbitrary function length, it highlights that functions are meant to be understood and the appropriate length should come from that.

Re: Write code. Not too much. Mostly functions.

#23

Earlier quoted context omitted.

Hah, I wrote it in a comment myself a while back :) (I'm the author of the article): https://news.ycombinator.com/item?id=24919615

Oh, nice! Seems like we got the same thing out of the article.

Oh yeah! I didn't even notice our comments were on the same article haha

Re: Write code. Not too much. Mostly functions.

#25

I like the sentiment of this article. It's a great analogy. Might be a little off topic, but it reminds me how I am happy that the Go programming language and its philosophies gained popularity even though I don't use the language regularly. Watching Go talks made me appreciate simplicity and clarity. It made me accept that I don't always need to use every design pattern in the book. It made me think about the reader…

I take issue with some of the decisions that went into Go, but I definitely respect the overarching philosophy of keeping things simple and not giving teams enough rope to hang themselves with

Re: Write code. Not too much. Mostly functions.

#26
post #11

I would say functions are important, but absolutely pale in comparison to modeling[1]. If you are unable to describe, on paper, what your problem domain actually is , then you have no business opening up an IDE and typing out a single line of code. I will take that further. If, with your domain model, you are unable to craft a query that projects a needed fact from an instance of the model, the you should probably st…

>"If you are unable to describe, on paper, what your problem domain actually is, then you have no business opening up an IDE and typing out a single line of code."

I agree with this part assuming that graphics and video along with the words are allowed.

>"I will take that further. If, with your domain model, you are unable to craft a query that projects a needed fact from an instance of the model, the you should probably start over."

This is very narrow minded approach that will only work for a very limited set of possible domains. Simplest example to the contrary: the domain is a creation of efficient way of solving some math related problem. What query?

Re: Write code. Not too much. Mostly functions.

#27

Earlier quoted context omitted.

What if my cranium is extra large? Do I get to write bigger functions?

Python's developers must have enormous heads if that's the case: https://github.com/python/cpython/blob/b8fde8b5418b75d2935d0...

God I love reading code like that. Makes me feel better about the complex mess I produce thinking if it could be done in a clean way.

Re: Write code. Not too much. Mostly functions.

#28

Earlier quoted context omitted.

Python's developers must have enormous heads if that's the case: https://github.com/python/cpython/blob/b8fde8b5418b75d2935d0...

It's mostly a giant switch case for opcodes though, that's not really what is meant here.

They could have had inlined functions or macros if they would have wanted to keep the function lenght down for the table.

Re: Write code. Not too much. Mostly functions.

#29
post #19
post #11

I would say functions are important, but absolutely pale in comparison to modeling[1]. If you are unable to describe, on paper, what your problem domain actually is , then you have no business opening up an IDE and typing out a single line of code. I will take that further. If, with your domain model, you are unable to craft a query that projects a needed fact from an instance of the model, the you should probably st…

What if code is needed to explore the problem domain? There is utility in discovery, especially for analysts/data scientists who tend to write a surprising amount of code.

I think you’re both right. If you frame the original comment as “don’t write final production code without thorough modeling” it works both ways. If you want to counter with “well our non-final code always goes to production anyway!” You have a cultural problem that needs addressing.

Re: Write code. Not too much. Mostly functions.

#30

Earlier quoted context omitted.

Oh, nice! Seems like we got the same thing out of the article.

Oh yeah! I didn't even notice our comments were on the same article haha

Write posts. Not too plagiarized, and only from yourself.
Post reply on HN