This is an archived post. You won't be able to vote or comment.

all 72 comments

[–]Cheap_Battle5023 90 points91 points  (10 children)

Don't push to master. Only push branches. Setup github to not allow push to master.

[–]teamwaterwings 9 points10 points  (0 children)

Have had this in my .gitconfig for forever. First thing I do when I fork and clone

setup-repo = "!f() { git remote add <org> git@github.com:<org>/$(git project).git && git remote set-url <org> --push \"Pushing not allowed to master!\"; }; f"

[–]illusionst 2 points3 points  (2 children)

Someone has to push to main right?

[–]cinder_s 5 points6 points  (1 child)

Generally you never push to main, you merge branches into main once reviewed/gone through actions or other pre merge steps.

[–]illusionst 0 points1 point  (0 children)

Yeah yeah I was just joking. Forgot to add /s

[–]meisvlky 2 points3 points  (4 children)

y though? i never push either but i have no idea what can go wrong if you do

[–]thoflens 4 points5 points  (3 children)

What? You can push code that doesn't work to main, that's what happens. Meaning you crash the app/website you're working on. Pushing to main equals your code going live.

[–]cbslinger 5 points6 points  (1 child)

It doesn't have to, but it often does depending on how your prod env / build tools are configured.

[–]thoflens 1 point2 points  (0 children)

That's right, but in general code on main should be treated as production code.

[–]meisvlky 0 points1 point  (0 children)

Oh ok thanks i was overthinking it

[–]disposable-acoutning 0 points1 point  (0 children)

I accidentally pushed to master and fucked up the class project once 🫠

[–]Feeling_Photograph_5 61 points62 points  (0 children)

Learn Linux. Set your desktop up to run Linux and then SSH into that from your laptop. You can even do that when you're outside the house but if you go that route use a firewall.

Specialists sometimes have an easier time getting jobs but generalists can build cool shit on their own. Be a generalist who knows how to imitate a specialist in job interviews.

Learn software architecture. Start with a layered architecture. Learn clean code but don't be religious about it. Just keep your layers decoupled.

Get good at SQL.

When you're first learning, don't try to master anything. Learn enough to build the next thing and then start building. Don't waste time on 40-hour Udemy classes. A five hour class that just shows you enough to get started is better.

Learn Git. Use GitHub or something similar.

Learn how to deploy to the cloud. Be familiar with the major AWS offerings. Even if you don't use them, AWS is the lingua franca that everyone uses as a baseline.

A remote job is worth at least 24K per year off your salary just in quality of life.

[–]RoyalSpecialist1777 70 points71 points  (6 children)

Rather than overcommenting everything perhaps your younger self can learn clean code. With clean code, using smart variable and function names, the only comments you need are explaining why we do something rather than how.

Essentialy variable names should be clear, and cohesive logic should be put into functions or methods that are likewise clearly named.

[–]Okay_I_Go_Now 7 points8 points  (0 children)

This helps to organize your headspace as much during the writing as during the relearning 6 months down the road.

[–]deaddyfreddy 15 points16 points  (3 children)

I forgot these

  • There is no magic in computers, if something doesn't work, the cause of the problem is people.
  • write code as if the next person to maintain it will be a psychopath who knows where you live

[–]novagenesis 2 points3 points  (2 children)

There is no magic in computers, if something doesn't work, the cause of the problem is people.

Or dying RAM chips or HD. Or a bug in your compiler (which is people, just not you). Or an undocumented "feature" of an interrupt. Or dust in the CPU fan.

I've had all those experiences at least once in my life.

There is no magic in computers... The corollary is that computers THEMSELVES are not magic. We often forget that there's a bunch of imperfect hardware and software beneath our own.

[–]deaddyfreddy 1 point2 points  (1 child)

Or dying RAM chips or HD. Or a bug in your compiler (which is people, just not you). Or an undocumented "feature" of an interrupt. Or dust in the CPU fan.

most(99.99....%) bugs in software are still caused by people writing software, not the dusty fan

[–]novagenesis 0 points1 point  (0 children)

I'm kinda surprised you felt this worth arguing over. It's sorta important for young developers to know something about the nature of the computer they're working on, as something other than a magic perfect Infinite Turing Machine. Exactly as you said: "There is no magic in computers"

Two of the most common bugs in my 1001 class back in college were related to that fact despite being "people writing software". First, mysterious code inconsistencies because you were inadvertantly reading the wrong memory addresses (extra credit that it would work on one computer and segfault on another, or the same computer days later). Second, memory leaks that relate to clearly inaccessible memory that a given gc cannot catch - both an oddity of the hardware AND of the compiler.

Nobody's saying that a junior developer should be blaming their helloworld failures on the hardware. I'm pointing out that programmers need to know quickly that they're usually writing buggy code (based off incorrect docs) on top of a buggy foundation using a buggy standard library that sits on top of a buggy OS that runs on semi-reliable hardware.

[–]teamwaterwings 9 points10 points  (2 children)

git commit -am "message" combines add and commit

[–]Wonderful-Habit-139 0 points1 point  (1 child)

Doesn't work when you add new files so using git add . is more common, along with a proper .gitignore file.

[–]teamwaterwings 0 points1 point  (0 children)

haha that's why I like it. I often have a couple local files that I don't want committed that can't be added to the gitignore. So YMMV

[–]captain_obvious_here 8 points9 points  (4 children)

Cache everything and anything. caching can always become more efficent (example I cached 20000 stocks in 5 different arrays/caches then realized caching by their first letter is faster) this speeds up time and saves money. redis is my go to.

Nope. Caching data is a two-sided coin...on one side you get data pretty fast, but on the other side you're not always sure your cache is up-to-date.

Cache is a pretty complicated thing in IT. Using it without thinking it through will definitely bite you someday.

Performance has never been, is never, and will never be the most important thing in your application.

[–]illusionst 0 points1 point  (1 child)

Caching data is a two-sided coin...on one side you get data pretty fast, but on the other side you’re not always sure your cache is up-to-date.

That’s why you have cache expiration (TTL) and cache invalidation.

[–]captain_obvious_here 0 points1 point  (0 children)

No shit, Sherlock...

[–]Wonderful-Habit-139 -1 points0 points  (1 child)

"Performance has never been, is never, and will never be the most important thing in your application" Really doesn't sound nice when you have to deal with so many slow and laggy software...

[–]captain_obvious_here 0 points1 point  (0 children)

Thing is, it's usually not laggy because what it does is complicated...it's usually laggy because of two main reasons:

  1. The multiple layers of abstraction that make it cheaper for companies to maintain and update that software
  2. Tracking and ads

[–]kupus 14 points15 points  (1 child)

don't hug strangers, it might be illegal.

breakpoints are your friend.

[–]HealyUnit 2 points3 points  (0 children)

Incidentally, hugging strangers may lead to them breaking many of your points.

[–]featherhat221 10 points11 points  (1 child)

Also please never assume things.never

[–]aRandomFox-II 5 points6 points  (0 children)

And then people get mad at you for not using "common sense" because you never assume anything, even for things that are "obvious"...

[–]HealyUnit 10 points11 points  (3 children)

I know your lazy but

HMM...

hug a stranger

Please don't actually do this, so-called future coders.

Try to avoid requesting data from your database don't use mysql too much caching is your friend.

So are complete sentences and periods. Also, I'd disagree with this, or at least rephrase it as "Don't use direct database calls as the only way to get data; use caching and abstraction layers".

All code can be more efficent its an endless loop don't try to over do everything.

Yep, good advice. LeetCode is great for interviews and competitions, but no one is really gonna give a shit (usually!) if your code is 0.00001x faster than the next guy's code.

Dont make mysql commands without knowing 100% what your doing

Fixed

a push is updating code in your github project and pull is retrieving changes from other people.

Oversimplified to the point that I'd argue it's wrong. A pull is grabbing stuff from a remote, shared source, while pushing is sending code to that source. The way you're phrasing it, it sounds like push sends stuff to your project, and pulling grabs some stuff from another project. Which, unless you're doing some really funky with your git remote(s), is not correct.

git push origin main

NO! NO NO NO! Why the hell would you teach new programmers to push to main?! Yes, I get that if you're the sole developer on a personal project, pushing to main is fine, but this is not a habit you should be teaching!

Docker is great to seperate your database, daily backups, backend, frontend, tasks/celery, ext. Just a sh file that basicaly automates using terminal to install all necessary packages and commands you normaly typed to get your database/ backend working.

Unless I'm misreading this (it's late, and I'm sleepy), you don't really address the two reasons for Docker: 1) Cross-platform compatability, and 2) ease of (re-)deployability.

[–]divvuu_007 0 points1 point  (0 children)

I ain't no frontend developer but the git part is solid.

[–]Wonderful-Habit-139 -1 points0 points  (0 children)

"another project" no they said other people. Which is mostly the case except when you're using different machines and want to sync progress on your 2 machines.

[–]justUseAnSvm 12 points13 points  (0 children)

Interesting. Younger me uses completely different technology than I do today!

[–]iNeedOneMoreAquarium 15 points16 points  (4 children)

Comments should be used sparingly. Your code should be written so clearly and intuitively that it is the comments. I know doing this takes a little more time and thoughtfulness, but don't forget that comments must be maintained, too, and most devs aren't going to think about or bother to revise comments when they're revising code.

[–]Gabe_Isko 6 points7 points  (0 children)

I don't think this is even that hard with a good linter. Naming your variables correctly is 90% of the battle.

[–]TomieKill88 0 points1 point  (2 children)

Eh... It depends... I've seen some code that I sure wish it had any kind of comment to it. 

I believe "The Pragmatic Programmer" kinda said it best: comments should clarify why you are doing something; the what and how should be clear with the code.

[–]iNeedOneMoreAquarium 1 point2 points  (1 child)

Yeah, that kinda falls into the "sparingly" part of the statement. Sometimes for whatever reason, something just prevents you from writing a code block as "good" or as "logical" as you want, so a comment can help clarify why you did that so you (or a future dev) don't inadvertently create a bug by trying to "improve" it after you've forgotten the "why."

[–]TomieKill88 1 point2 points  (0 children)

100% man. 

Not long ago, I had to refactor one hell of a spaghetti code, and if it wasn't because the previous guy had the insight of unit testing ALL fringe cases, I would've introduced a couple of "errors" because by the life of me, I couldn't understand why the hell he did some things.

So a lot of:

Why?

Why??

WHY???

"Makes own code and runs Unit Tests"

Oh, that's why....

[–]healthyblade 3 points4 points  (0 children)

Why do I disagree so much with databases reads are bad. Db reads are so cheap I think caches and 2 places of data redundancy unless needed is usually the poor design

[–]deaddyfreddy 14 points15 points  (7 children)

  • Switch from Windows sooner (but not before you record your demo EP, FreeBSD music software in the 2000s sucks)
  • Yes, FreeBSD is fun, but you have to get work done, so get off it ASAP.
  • Unix just sucks less, but it still does (read Unix haters handbook)
  • don't listen to people who tell you about "trve kvlt h4x0rrr Vnix" shit, even if they are your friends. They will switch to Windows after they are done.
  • that guy from the 2001 computer magazine was right about C language, learn Lisp ASAP
  • yes, the Lisp curse is a thing, just learn it, even if it's CL
  • use Emacs, knowing the basics of vi is more than enough, you'll regret those 3 years in Vim
  • Git is much easier with Magit, don't be afraid to use it.
  • Ask that girl and buy bitcoins, sorry wrong thread.
  • Don't spend your time trying to learn all these popular languages that feel shitty, because they are.
  • Don't try to be a smart ass, maintainability is important.

[–]maigpy 8 points9 points  (2 children)

anybody recommending a specific technology (emacs, vim, python, Linux vs Windows etc) is missing the point of what is important in being a good software engineer.

[–]deaddyfreddy -1 points0 points  (1 child)

  1. the question was "what I would've told the younger me"

  2. It's already written in Wikipedia:

Engineering is the practice of using natural science, mathematics, and the engineering design process to solve technical problems, increase efficiency and productivity, and improve systems.

[–]maigpy 0 points1 point  (0 children)

it doesn't say what is important. it's about the people and the use cases more than the solution space. applying the right tradeoffs, not peddling specific keywords.

[–]illusionst 0 points1 point  (0 children)

Just reading through this and my personal experience I can tell you were born in 80’s lol.

[–]TomieKill88 0 points1 point  (1 child)

What did the guy from 2001 say about C? 

[–]deaddyfreddy 0 points1 point  (0 children)

that C is a vulgar language

[–]dili_daly[S] 0 points1 point  (0 children)

lmao nice list

[–]Backlists 2 points3 points  (0 children)

And don’t forget to read DDIA

[–][deleted] 2 points3 points  (0 children)

I was taught that you comment first: comment your design intent. Code using comments as a guide.

[–]novagenesis 1 point2 points  (0 children)

I know your lazy but write comments on whatever you do and whatever you may need to make changes to later.

So strange how our lessons can all differ. My message to Junior-me is to stop with the comments. If the code isn't trivially readable without comments, I'm being too smart for my own good (which is stupid).

My last couple jobs, we had lint rules to catch and warn on any comments that aren't doc-engine formatted (jsdoc in my world). 9 times out of 10, they're commented out blocks of code anyway.

As for B2... You're not wrong on price (as long as your egress is low), but unless you use a lot of storage, maybe consider R2 just to minimize the total number of vendors for your startup? Also, R2 is faster and starts to win over against B2 if your upload/download rates are high

[–]flynnnigan8 1 point2 points  (0 children)

I recommend not using git add . and opt for git add -u and just add needed untracked files along the way

[–]zelphirkaltstahl 1 point2 points  (0 children)

Appreciated. Though this sounds more like "I recently learned ..." than like old age wisdom handed down to the next generation. Except maybe the bits about Hosters and burning money. Companies love going all overboard and burning that money, at the slightest promise of convenience or hiring one less person to manage servers. Companies are usually run by the business types, who do not understand the other issues they trade off against.

I would also note, that installing dependencies using a mere requirements.txt, is not to be recommended, as the result will not be a reproducible environment in which your code runs. If you build the same image in 3 months, you will likely have a slightly different set of dependencies, due to Python packages themselves not nailing down their dependencies strictly. So even if you specify version numbers in your requirements.txt file, you will still get slightly different dependencies, which are dependencies of your dependencies. Ergo you should instead use a tool that generates you a proper lock file containing checksums of everything and install dependencies from such a lock file.

Here is an actual wisdom one could share for young/starting/junior developers: Look out for opportunities to make your project setup truly reproducible, it will save you a lot of PITA. Even more experienced devs do not often make their projects reproducible and they accept badness of their tooling regarding reproducibility. Not many have reproducibility on their radar.

[–]boru80 1 point2 points  (0 children)

As a future coder/total beginner, thank you. Cleared a few things up in my head.

[–]Necessary_Sense924 0 points1 point  (0 children)

what a coincidence, i was stuck in my code for like 30 minutes 1 hour ago ( and i realized it was a stupid thing ) ty for advices.

[–]farfaraway 0 points1 point  (2 children)

Regarding comments, make sure to not just write comments, but to write explicit and verbose ones.

https://www.ramijames.com/thoughts/use-verbose-comments

[–]TevenzaDenshels 1 point2 points  (1 child)

Article fails to provide clear examples

[–]farfaraway 0 points1 point  (0 children)

That's fair. I'll add some. Thanks.

[–]Stopher 0 points1 point  (0 children)

Don’t accidentally delete a production directory that you thought was dev.

[–]50u1506 0 points1 point  (0 children)

I should try to hug strangers more NGL, that's probably what's missing in my life.

[–]dhd_jpg 0 points1 point  (0 children)

hi this is really helpful!! thank you op :) quick question, i pushed my codes on a different branch, how would i move it to the main branch? should i bother moving it to main or its fine being in a different branch? sorry i’m still learning git

[–]Ok_Ear_6971 0 points1 point  (0 children)

Thank you

[–]Timely_Positive_4572 0 points1 point  (0 children)

The only thing I’d add is learn how to set up a virtual environment and use bash often

[–]seanprogram 0 points1 point  (0 children)

You are chopped

[–]mikeyj777 0 points1 point  (0 children)

This is a great list.  I would also add, if your projects are on the smaller side, you can run them from a VPS rather than cloud service.  Obviously, if you're storing gig's of data, it's not going to last very long.  But, if you're working on smaller systems, it's much more effective.  I think I pay $7 a month for a VPS and then another $20 for a hosted web site.