7 ms·
What I've Learned So Far as a Programmer
- alexfi 9y ago"Error establishing a database connection" This is also what I learnt as a programmer.
- devwastaken 9y ago"Error establishing a database connection" The greatest knowledge by experience for all for us in devops.
- nautilus12 9y agoHahah, that was my thought too. The wisdom is to always do load testing.
- hugo9099 9y agosame here.. lol
- beobab 9y agoIt is a very important lesson. Caching is your friend.
- blojayble 9y agoHas anyone measured how much traffic can being on the front page of HN generate?
- jsjohnst 9y agoIt's not as bad as you'd think in total volume, it's just you get a lot of bursty concurrent traffic. Something as simple as a hundred requests in roughly the same second crash many blogs sadly.
- eljimmy 9y agoI don't think there could have been a more hilarious response to clicking a link with that title. Got a good chuckle out of it.
- admira1Ackb4r 9y agoI'm guessing it's a wordpress site? Try disabling php xml rpc.... It could be getting hammered by spambots or malware vectors.
- ohkaiby 9y agoAuthor 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.
- velebak 9y agoAlways build scalable web presences.
- majewsky 9y agoI hope to once make the frontpage on HN. Not for the fame or anything, just to check how scalable my blog really is. :)
- sunnyam 9y agoDo you know of any way of testing your website to see how many concurrent users it can handle?
- shorsher 9y agoCheck out something like locust[0]. It's a web load testing framework in python. [0]:http://locust.io/ http://locust.io/
- Mikushi 9y agohttp://locust.io/ http://locust.io/ for example
- autokad 9y agoa long long long time ago (~2009) i used jmeter. it spawns aws instances and pegs your website in ways of your choosing. by now I am sure they got something even more advanced
- shakna 9y agoSiege [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/ https://www.joedog.org/siege-home/
- 9y ago
- theossuary 9y agoWhile Hacker News hugs the site to death: http://webcache.googleusercontent.com/search?q=cache:http://copygrammer.com/learned-far-programmer/ http://webcache.googleusercontent.com/search?q=cache:http://...
- jerrylives 9y agoI think there's more wisdom to be found in the error page than the original article
- trollster 9y agoIs that you can never predict a traffic spike.
- fareesh 9y agoYet to be learned - caching?
- philbarr 9y ago"Identify exactly what you're weak at" and "learn quickly" are two of his notes so...
- Adamantcheese 9y ago"HTTP 500 Internal Server Error Most likely causes: The website has a programming error." Thanks IE, you really know how to make me laugh.
- mezuzi 9y agoNeeds to dispatch a team of highly skilled monkeys.
- mattkenefick 9y agoThis is one of the funniest headlines I've read considering the site seemingly crashed. I'm hoping the punchline was actually "Error establishing a database connection" but I doubt it.
- s_dev 9y agoMirror: http://webcache.googleusercontent.com/search?q=cache:http://copygrammer.com/learned-far-programmer/ http://webcache.googleusercontent.com/search?q=cache:http://...
- Kenji 9y agoEveryone 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.
- Mouse47 9y agoReads more like good-natured ribbing imo. We've all been there.
- yoz-y 9y agoIs 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.
- siliconwrath 9y agoI've had a good experience using https://loader.io/ https://loader.io/
- mixedCase 9y agoNo, for a blog you don't. You make a static website. HTML, CSS, maybe some JavaScript.
- yoz-y 9y agoI suppose the millions of wordpress blogs disagree with that statement. Some people like to format their content in a wysiwyg environment.
- mixedCase 9y ago> I suppose the millions of wordpress blogs disagree with that statement And crumble under the weight of real traffic. > Some people like to format their content in a wysiwyg environment. Those exist for HTML and are just fine for writing a blog, assuming markdown is too hard. We're talking about a programmer's blog here, however.
- sk5t 9y agoWithout judging the author, I think it's fair to say there's nothing to be learned from this article by 90% of regular HN readers.
- knieveltech 9y agoI think that statement might have been true years ago.
- jayeola 9y agocurl --head http://copygrammer.com/learned-far-programmer/ http://copygrammer.com/learned-far-programmer/ HTTP/1.1 500 Internal Server Error Date: Tue, 01 Aug 2017 15:02:57 GMT
- deleted 9y ago[deleted]
- deleted 9y ago[deleted]
- kutkloon7 9y agoWhat I Didn't Learn So Far as a Programmer: - How to properly encode text
- mcguire 9y ago"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 algorithm. "Learning algorithms" isn't about memorizing known facts, it's about learning how to think about programming.
- Xorlev 9y agoThose that don't study algorithms are doomed to reinvent them, often poorly. Totally agreed. A knowledge of "conventional" algorithms influences how you write code. Sometimes it manifests as knowing which algorithm to choose, sometimes it manifests as intuition into the performance (or lack thereof) of something you're writing. It's not required by any means, but don't turn down cheap knowledge on how to gain an edge.
- khedoros1 9y agoSome basic algorithmic knowledge is definitely essential. I remember the first time that I found a need for sorting. I designed my own algorithm, and I learned years later that I'd basically recreated bubble sort. It worked fine in my little QBasic program, but would've made anything serious fall flat on its face.
- kutkloon7 9y agoI 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.
- deleted 9y ago[deleted]
- k__ 9y agoSome 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 and try to write code more readable and not as short as possible. IDEs help with autocompletion and code gets read more than written anyway.
- ethbro 9y ago> 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.
- nhteou79snt 9y ago> Premature refactoring is incredibly harmful to readability. Is that a thing? If it is, I've never run into it. I always run into the opposite - never refactoring and everything turning into a god object. It never occurred to me that premature factoring would be bad because I can't recall ever running into it!
- 9y ago
- fouc 9y ago"Learn to learn quickly" cringe
- Sir_Cmpwn 9y agoThe 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.
- flavio81 9y agoFor me it was rather: Complex is OK, complicated is wrong.
- akvadrako 9y agoTrue. Aim to reduce your code to one button that does one obvious thing.
- ccarse 9y agoManaging complexity is our main responsibility.
- pmiller2 9y agoSimple things are easier to fix when they do break.
- olegkikin 9y agoThe problem is "simplify" means different things to different people. For some it's write everything in vanilla JS. For others it's install libraries for everything, write the least code.
- flavio81 9y agoLesson learned: Always make sure to establish a database connection.
- faragon 9y agoMy two cents: - Time don't make you [much] smarter in the "brute force" sense, however it allows you doing less errors, avoiding unnecessary stuff, and in general making you more productive. Also, it allows you to enable others to be more productive, e.g. giving some hint to a coworker so he/she can simplify his work. - Focus is all: understand the problem, do a good planning, and stick to the plan. - For critical projects trust people you really know (their capabilities, potential, character, etc.). And DON'T trust people you don't know, in the sense of: tracking, ensuring people know what they are doing and that they're capable, etc. - The wrong people can ruin any project, no matter how smart you think you are, so: do risk analysis, always.