Live data from Hacker News

What I've Learned So Far as a Programmer

copygrammer.com

41–50 of 62 posts

Re: What I've Learned So Far as a Programmer

#42
post #38

Some stuff I learned: Don't write/use abstractions you won't understand later. Often you start with 2-3 copies, try to merge them and end up using it at a place were it doesn't fit 100% anymore. Keep nesting low. Often it's faster to scroll over one big okay-ish structured function than to find all the clean tiny things around the the project. Same goes with Objects/Classes/Components etc. Stop using abbreviations an…

> Keep nesting low.

This so much. One of the bigger differences between academic and professional coding is software system longevity.

Premature refactoring is incredibly harmful to readability.

1. You have no idea what the future will require. You will always know more about the requirements in the future.

2. You have no idea how the current use and system will need to evolve. You will always learn more about this in the future.

3. You have no idea how long the current system will be used. Could be 20 years; could be a week (if it's an executive's pet project).

4. Time to MVP > perfect code in almost all instances.

Writing code with clean, documented potential refactoring points, but stopping short of actually pulling all those things apart has served me far better than the alternative.

If you have one function that may not be applicable to a future use case, and you refactor it into two, now you have two functions that may not be applicable to a future use case.

Develop a feel for what's "reasonable" in an initial write, and don't code yourself into an inflexible corner, but defer actual refactoring until it's necessary. Because then you'll have the benefit of knowing far more about the new needs and how the system is used.

Re: What I've Learned So Far as a Programmer

#43
post #4

Always build scalable web presences.

When I was on the front page of HN, IIRC it meant about 5k visits in an hour. How can such a low number kill a webpage... Or do other on the front page experience much higher traffic?

I also got to the front page and saw similar, low numbers that were trivial to handle. I suspect they can get much higher.

Re: What I've Learned So Far as a Programmer

#44
post #24

Earlier quoted context omitted.

I hope to once make the frontpage on HN. Not for the fame or anything, just to check how scalable my blog really is. :)

Do you know of any way of testing your website to see how many concurrent users it can handle?

Siege [0], is my go-to. Easy to add to CI, because its on most platforms, and has decent output configs. You can vary headers and pages to hit, and how long connections get held open, or just reject them. And of course, it has great concurrency.

It can bring down most servers that aren't configured to prevent DOS attacks, like naive nginx or Apache configs. Usually somewhere between 5-10mins.

[0] https://www.joedog.org/siege-home/

Re: What I've Learned So Far as a Programmer

#45
The most important lesson I've learned is simplify. Simplify everything. Simplify your problem. Simpilfy your approach. Simplify your architecture. Simpilfy your data model. Simplify your build process. Simplify your release process.

Complicated things break. Simple things also break, but a lot less often.

Re: What I've Learned So Far as a Programmer

#46
post #29
post #17

Everyone is so smug here, wow. If you have a little web presence with 5 visits per day, of which 3 are bots, you don't cache, you don't use AWS or any of the big services, you just spin up a tiny Linux machine with a LAMP stack and that's it.

Is there a good (preferably free) service to load test ones own website? I imagine that something like this is quite hard to test for a beginner and I admit I have never tried to do it on my site either.

I've had a good experience using https://loader.io/

Re: What I've Learned So Far as a Programmer

#47

"Error establishing a database connection" The greatest knowledge by experience for all for us in devops.

Author made an edit:

> THE BIGGEST LESSON I LEARNED TODAY

> Don’t forget to turn on your caching plugin and CDN. I submitted this blog post to Hacker News and this website can’t be accessed.

> And I HOPE it won’t crash right after I wrote this. I hope! Haha.

Haa... nice.

Re: What I've Learned So Far as a Programmer

#49
post #35

" It doesn’t matter if you don’t know algorithms… But it doesn’t hurt to learn about it (because it might help you in the future). This is important. Usually you don’t use algorithm in programming a system but if it’s something that will scale fast, your understanding of algorithm might be useful. " Sigh. I'm really tired of this misunderstanding. Literally everything you type in to an editor is an algori…

I remember a recruiter that tried to convince me some job would be interesting for me: "It's really complicated work. We use algorithms." after which she dropped a dramatic pause to let me recover from that shock.

Re: What I've Learned So Far as a Programmer

#50

The most important lesson I've learned is simplify . Simplify everything. Simplify your problem. Simpilfy your approach. Simplify your architecture. Simpilfy your data model. Simplify your build process. Simplify your release process. Complicated things break. Simple things also break, but a lot less often.

True. Aim to reduce your code to one button that does one obvious thing.
Post reply on HN