DEV Community

jD91mZM2
jD91mZM2

Posted on

A letter to my past self

A little more than a year ago, I was just about ready to move on. I had my fill of Java, discontinued my shitty "programming language" (which was just a bunch of startsWith("<command> ") statements), and I was making a crappy little chat-bot thing with TCP support. In order to connect to it, I realized I should look into some other language which was easier with this task. So I turned my attention on Go.
So that I was. Finally exploring a new language after a very long time of being addicted to Java Swing. I never liked front-end development, but I thought it was needed. Oh boy I was wrong.
Somewhere there my friend tbodt popped along. He started asking a little about one of my applications, which drove me interested in working more on that application. I don't know when it happened, but after some time it was clear to me this tbodt person was a better, smarter and more knowledgable person than I'll ever be. And I was right, a year later I am a completely changed person thanks to him. Now I want to see if I can be my own tbodt:

Dear past self. In order to improve, here are a few tips.

  • Font-end is trash. You don't like font-end development. You do it because you know that every user wants a GUI. That is incorrect, you're simply looking at the wrong target users. Start making terminal applications, it's way more fun.
  • Abandon Windows. What you used to call "Linux" (when you actually meant "GNU/Linux". Linux is just the core of the operating system, the kernel. You still need the GNU operating system to actually make a working system). It isn't what everybody says it is, it's not a pro 1337 h4x0r operating system for edgy people. It's for everyone. It's better than Windows will ever be. Also, don't worry about your C: and D: drive. On GNU/Linux they're for some reason one drive. I still haven't figured out why, but I guess Windows is just drunk. Or maybe they're different partitions (parts of the drive which pretty much act like separate drives). What distribution? Ubuntu. But don't stay there forever. Make a separate /home partition so you can keep all your files when you reinstall your system, and then when you've been on Ubuntu for a while and feel bored with it you can switch to Arch Linux. You won't get bored with Arch. Also look into the i3 window manager. It isn't as empty and scary as it looks when you first start it. You just need to configure it some. If absolutely needed, watch some YouTube video on i3 to really get motivation. By the way, don't bother with trying to get nvidia drivers. They're literally broken. You'll just ruin your computer trying to uninstall them and reinstall the open source ones. Stick with the open source.
  • Finally learn what the |, &, ^ and ~ operators are!!! I know you've really wanted to know but never been able to learn. Don't worry, it's simple. Just take a look at the binary values. 2 | 1 = 3 because 10 | 1 = 11. 5 | 3 = 7 because 101 | 11 = 111. It basically enables all bits from the second value in the first. ~1 is -2 because 00000001 inverted is 11111110. The reason it's 8 in length is because a byte is 8 bits in memory. And in memory, if the 1st bit is 1 that means it's a negative number, and starts subtracting everything from the max byte, 256. The rest you should be able to experment and learn on your own.
  • Abandon Java. This is the first time you'll really feel like staying. New languages look new and scary. You think you're confident with Java, and you doubt you'll ever be that confident with another language. You don't wanna throw away all your old skills for nothing. It isn't for nothing. You can fight through this. Stick with Go for a while, but don't stay. Go is just good to know, but it's not the end. Go forward. Get Rust. Rust is everything you've ever wanted. You can code with C-like performance and possibilities while still keeping built-in UTF-8 support, safe memory management. Also threading.
  • Start with Git and GitHub. Sharing code isn't as bad as you think. Nobody will read and judge your code. Plus, people can already decompile it. Trying to hide your code does nothing. Trying to produce binaries for all systems is a pain (not so much with Java as any other language). You can just give them the source and they'll compile it for themselves. Also versioning is nice for example if you're implementing a new feature but decide you wanna roll the changes back.
  • I know you think there isn't anything like "true multithreading". You think that computers are just shuffeling instructions. And that is partly correct. But most computers have multiple cores, so there is a chance that "data races" occur when accessing the same variable from different threads. That is where so called "Mutexes" come in. There are also "Atomic" variables for primitive types, which is what mutexes use under the hood. And yeah, you've been misusing Java's "AtomicX", thinking it's just a wrapper in order to edit a final field.
  • Learn what memory is. It's just a big pile of bytes. If you make the string "hi", that looks like 104, 105 plus a little extra information, depending on programming language. In C it would be [104, 105, 0] because 0 marks the end of a string. In most languages it would be something like [2, 104, 105], where the 2 shows the string length. And that's why pointers have "addresses". Because a pointer is just a number to a memory cell. Also, there are actually 2 different kinds of memory. Heap and stack. The heap is dynamic. That's where you can actually allocate more. Somebody correct me if I'm wrong with the following: The stack is faster to use, because it can never be resized. Once your program is started, you get the heap you ask for and then you can't make more. But yeah, in order to make your program faster, you don't need to do whatever you think you need to do. You just need to make sure to allocate less. Which Rust is awesome at.

Top comments (1)

Collapse
 
tbodt profile image
tbodt

I don't know when it happened, but after some time it was clear to me this tbodt person was a better, smarter and more knowledgable person than I'll ever be. And I was right, a year later I am a completely changed person thanks to him.

Well thanks ๐Ÿ˜Š