Tips
Hi!
This is a mini-tutorial I am doing during my free time!
Lets get into it!
A few things to keep in mind(for any level of programming you may be in)
Programming is a complex world of algorithms and patterns.
And this is where my first tip comes in.
DO NOT STRESS TOO MUCH OVER A CONCEPT!
Lets say the concept is staring at a image of a syntax tree for a programming language.
DO NOT take that image literally and attempt to code the exact tree in code. I promise you, it won't work. Lol. I learned the hard way(smh :/).
Taking things way too literally in the world of programming is just not the thing to do. In the end, you will end up causing more stress on yourself rather than actually getting any progress on what it is you're wanting to build.
A few tips: Think of the logic behind what it is you're looking at(or thinking of). Thinking of the logic behind it instead of the straightforward image it might look like(or that you may see) is better than attempting to code something strictly off of something you're thinking of or seeing.
Logic is a huge part of programming. If you cannot apply logic to your code, I don't know what you're doing coding.
Take your time
Do not rush at learning new things. It will never end well.
I wish I would've known this when first learning C. I instantly dived into some heavy features of the language and instantly got confused and gave up. This is not a good mindset to have when learning a new language(or learning something new in a language you already know).
Now, usually when it's a language you already know, it's no problem. But, it's normally a problem with new languages.
Learning that new fundamental knowledge of a language is, boring. Believe me we've all been there and we're going to continuously find ourselves back at that point sometime in our lifetime.
But, don't rush. It will be boring. But stick through it. Learning a language doesn't come easy. Not only do you have to learn it, but you have to learn how to apply the logic of the language afterwards. Which is a timely thing.
Do NOT stress over new concepts
New concepts are like new math problems.
You won't understand all of them ASAP. So, if you don't understand a concept, don't stress. Maybe move onto something else, and, if you don't feel comfortable doing that, walk away for 15 minutes, take a drink of water, and come back to it.
Not everything will come easy when learning a programming language. And I can almost guarantee you, some of the things you will struggle the most to learn you might never even use. And if you do, it's rare for you to use.
Stay away from high-level languages(FIRST)
You saw this coming, lets be honest :)
But, let me tell you why. High-level languages tend to come "easier" unlike mid-level/low-level languages such as Rust and C#.
Higher-level languages will bind a programmers mindset to built-ins where languages like C# and Rust you can't depend so much on built-ins.
But starting off high-level will never increase your chances in becoming a flexible developer. If you start high with a language like Python and you work for a job that tells you that you need to learn Rust in 3 weeks. You're gonna struggle.
Don't give up
No matter how hard it gets, don't give up.
When I first started with C, I struggled with primarily everything coming at me. I struggled with the basic hello world program. And I am now writing security applications in the language.
Regardless of the fact I've been writing the language for well over a year. That just supports my reasoning to not give up. If I would've given up, I would've been stuck with higher-level languages because I would've never wanted to touch a lower-level language again because I would've set my mindset to "quit, it's too hard".
Which is not good. So, I don't give two flying DUCKS(yes, ducks) how hard it gets. You chose to learn the language. Don't walk away :)
Take your time
Don't rush to learn new things. Go at a even pace as you learn each new concept and learn in the order the tutorial/documentaion is teaching you.
Some things will come easier than others, as I described above. But when things get hard, don't get up. Take your time. Like I said:
New concepts are like new math problems.
Enjoy the learning experience
Enjoy the time learning the language. You'll look back someday and think, "wow, I really made it!"
would you consider java a high level lang or mid level lang?
mid-level
Rust and C#
Duck yeah!
Also good tips lol
A really good post, very thankful and hopeful that you will write many more posts like this one.
Perhaps one where we work with pixels?
I'm in
@MocaCDeveloper I suck at Rust, but I'll try to help :)
don’t worry i’m not at all that good with Rust either but this will be fun, there’s no doubt about it
@MocaCDeveloper Cool! So when you say pixels, do you mean pixels in an image, or pixels on a display/window?
pixels in an image
@MocaCDeveloper Cool, I'm down (still)
i think it would be pretty fun trying to read a PNG image file format in rust and working with its pixels. it will be hard, yes. but hard is fun and if you’re working in a fun language like Rust or C, time flies!
We’re about to make a whole library to read a images pixels.
perhaps working with jpeg files or png?
do you have discord
@MocaCDeveloper But also 2 things:
- I won't be online much over the weekend (reasons)
- I kinda don't have access to my discord account until tomorrow night (also reasons)
Alright sweet! i’m gonna be available tonight. when are you free?
that is fine! we can “initialize” the project tonight and get some work done. i’m just hoping it’s not to heavy on memory since we’re using repl. unless we use vscode but i’ve never used that...
@MocaCDeveloper I'm free tomorrow night and all weekend, but I have other stuff to do so I might not be online much. I'll be able get some coding done next week, but I probably won't be on discord.
that’s fine. i can give u my number if nothing else so if i’m not online u can text me?
@MocaCDeveloper I'll have access to my PC again tomorrow which (for me) means:
- Faster compile times
- Debugging
- Testing code on Ubuntu as well as Windows
- Using VSCode alongside Replit
But until then I'll use Replit (and hope there aren't too many package installs)
that’s fine. i can give u my number if nothing else so if i’m not online u can text me?
I know it sounds stupid and childish, but I don't feel comfortable giving my number to strangers.
let’s attempt to create it from scratch in Rust. i want to avoid as much package installations as possible. also staying away from CLA’s(Command Line Arguments). i hate using clap in Rust it makes no sense to me
i want to avoid as much package installations as possible
cool.
i hate using clap in Rust it makes no sense to me
same lol
Also, one thing: can we set up the project using Cargo? It makes it easier for me to organize my projects that way.
@MocaCDeveloper I actually ought to be free all of tomorrow evening. (As I've said, I don't sleep)
Me neither lol. I am pretty much going to be available all night tonight.
@MocaCDeveloper Same. I probably won't be available much during the day for the next few days, though. A relative of mine is visiting (Who happens to be as software engineer, so I'll probably be coding other stuff lol)
Sounds good! When we aren't working I will just work on my JPEG contrast application in C where I take pixels and match them to there neighbors and then I brighten them or dim them dependable.
It's quite hard, however.
we can brainstorm a little tonight on what we want to make. then we can get started on the initializing of the code we need to get it going
@MocaCDeveloper I've got a couple of ideas:
- Stenography with PNGs (It's super easy with BMPs, but the PNG encoding should add some challenge)
- Reduce the size of an image (perhaps by splitting an image into 2x2 'chunks' of pixels, and then converting each 'chunk' to a single pixel on the output image by averaging their RGB values)
let’s do both!
we can add functionality for both concepts
@MocaCDeveloper Ok, I'll have to study the PNG encoding then (compressed images are much harder to work with). Perhaps we could decompress the PNG to a BMP to make it easier to work with, then recompress the output image once we're done?
that would make things easier. i agree.
i too will have to study the format. i tend to be good at finding useful resources so i’ll do some research here in a bit and give you the sources i found
well just have to reference the sources we find throughout the project
@MocaCDeveloper If we could figure out how to do the PNG/BMP conversion, that would make both concepts much easier.
it shouldn’t be too hard but it might take us decompressing the file in order to convert it into a bmp. a bmp is like 10x simpler than a png or jpeg
@MocaCDeveloper Yeah, since it can be easily converted from an array of bytes to an array of pixels, and better yet, you don't even really need to convert it at all since it's not compressed (working with compressed files is weird)
i believe jpeg files are compressed. jpeg file formats are weird. each format differs from file to file.
but yeah converting from a png to a bmp will be easy it’s converting from a byte array to an array of chars.
this is going to be fun
@MocaCDeveloper PNG and JPEG are both compressed, although they use different algorithms
well i sure would think they’re different algorithms. they’re compressed differently. hence as to why they’re different file names
@MocaCDeveloper
this will probably be the most fun project I've done in a while (other than maybe the parser I'm working on)
this will definitely be an interesting project. it’ll be a timely project but that’s the fun of it. contributing over a series of days possibly weeks
i agree. besides the jpeg contrast app i’m doing imma be stacked up with projects and this one we’re doing in rust will probably be my favorite
@MocaCDeveloper Cool. I would honestly do stuff like this way more if I was good at coming up with ideas (and if I was competent)
i’m just looking forward to working with someone on a project that takes time to do instead of 4 days and then it’s done and we both move on
@MocaCDeveloper Same, I just hope I can keep my attention one 1 thing for that long :p ADHD
i have ADD lol. it sucks
but i think it’ll be interesting enough to keep our interests up!
just writing a little program in rust is fun. this is finna be greatly fun :D
@MocaCDeveloper I was originally diagnosed with ADD, but a lot of doctors nowdays say that it's pretty much the same thing
Rust is a fun language to do bigger projects in. As much as I love C++, it can get a bit frustrating sometimes (I can write basic assembly but I can't quite manage the lowest-level aspects of C :/)
i can somewhat manage the lower ideals of C. but not osdev lol. i struggle with osdev.
and this will be my first project in rust. i’m already in love with rust so this project will just make me like rust even more.
@MocaCDeveloper OSdev (or anything bare-metal) is just way too much for me.
I like rust overall, but there are some things about it that keep me from replacing C++ with it
@MocaCDeveloper As dumb as it sounds, I think Rust will actually replace Python for me. At this point I only use Python for web dev and APIs, and Rust has proven to be quite good at those, as well as being a much better language overall.
Rust replaces C++ and Python for me. no language will ever replace C lol. i’ve absolutely fallen in love with C
@MocaCDeveloper I get that. My main problems with Rust are pretty simple:
- Variables are stored on the heap rather than the stack, so you have to deal with cloning and copying even for basic operations, as well as making the language slightly slower than C, which utilizes the stack
- Rust's object orientation really isn't that good, and that makes it a smidge annoying to use for larger projects
Other than those 2 issues, I absolutely love Rust
i’m planning on releasing my first tutorial over jpeg decoding tonight
i completely agree on that. the most annoying thing to me is the having to copy and clone things to avoid errors and borrowing of the value
@MocaCDeveloper Sick! I'll probably read it and pass out from exhaustion, the order of those 2 events depending on how late you release it
I really liked your tutorial on BMP rendering in C, that post is what got me into the idea of binary file I/O in C++
yeah BMP image rendering in C was awfully easy.
which is why i am going into working wth jpeg and png. hence as to why we’re doing this project
i completely agree on that. the most annoying thing to me is the having to copy and clone things to avoid errors and borrowing of the value
Yeah, I wish Rust would just use the stack by default. The only other langs that exclusively use heap allocation are Python, JavaScript, and the other scripting languages. You know what I think of those (Look at my bio if you haven't lately, I think I settled on a good one lol)
i wish the same it would make it easier but hey it’s what makes rust unique. and i love rust because of the fact it’s unique
this is definitely going to be a project to remember. and afterwards i’d be more than happy to collab with you again!
and afterwards i’d be more than happy to collab with you again!
Same here! Maybe a language dev project? That's something I've been wanting to learn for the longest time (ok more like a few months, but that's a lot of time for me)
@MocaCDeveloper I'm signing off soon, I should really get some sleep. I'll probably start working on decompressing the png tomorrow
alright sounds good. make sure to ping me!
@MocaCDeveloper At first I was thinking C++, but now Rust seems appealing
i’d be down. building everything from scratch in rust? i think building from scratch is funner
I attempted to make a programming language in rust and uh it went pretty well :)
Omg, thank you, this actually answered the majority of my doubts, all i have left is ¨the code¨ but this really motivated me... :´)
You got this! Don't give up.
I am always available if you need help!
Yeah, these tips are good, but you know what? Nobody will make this post recognized as it should be. Why? because people are going to go and upvote the 1,459,903th Python tutorial out there on replit, that only teaches you about variables and printing. I feel sad
Agreed. So many other posts deserve more attention than the same old Python posts.
the 1,459,903th Python tutorial out there on replit, that only teaches you about variables and printing
And a lot of these tutorials get basic stuff wrong. It makes me sad to see people get misinformed because the person making the tutorial didn't put in the effort to fact-check.
@OldWizard209 I wish people would make quality tutorials for low-level languages, but they won't, because it would take a ton of effort.
I do!
I am learning how to decode a JPEG image rn and write a decoder in C for it so I can post a tutorial over it.
It's hard tho.
ikr. they do it only for upvotes, and people are silly to fall in the trap. @ANDREWVOSS
I do!
Truedat.
I am learning how to decode a JPEG image rn and write a decoder in C for it so I can post a tutorial over it.
That sounds really cool!
It's hard tho.
That's why so few people do it :(
I enjoy it though
@MocaCDeveloper
You probably wouldn't be doing it if you didn't lol
I know I only do this stuff because I find it fun
I mean if u count me not getting any sleep last night, literally zero seconds of sleep, then ya you can count it as fun lol.
I really enjoy working with images at a low level.
I mean if u count me not getting any sleep last night, literally zero seconds of sleep, then ya you can count it as fun lol.
If sleep was more fun than writing terrible homebrew apps for the GameBoy at 1:00 AM, then I'd sleep :)
I'd rather lose sleep to code than sleep and not code.
Speaking of code. I am in the search of contributing with someone to make a Rust project.
Speaking of code. I am in the search of contributing with someone to make a Rust project.
What kind of project?
@MocaCDeveloper and @ANDREWVOSS , would you mind to stop commenting on this thread. I am trying to focus on my studies and soo many e-email notifs don't help. Thank You. If you want to continue your conversation, please start a new thread. Sorry
Perhaps one where we work with pixels?
umm please can u stop? @MocaCDeveloper
@OldWizard209 sorry :(
@OldWizard209 *1,459,872,903th
You forgot the 872
Lol I despise Python for various reasons.
@MocaCDeveloper I don't despise the language itself
However, I DO despise the gods know how many tutorials that cover print and variables
ok let me rephrase. i don’t despise python as a language. i like it for my hacking needs. but it’s simply too easy
lol I knew you would say that
@DynamicSquid Seriously, though, I wish I had started with Rust or Go
@CodeLongAndPros Same
@DynamicSquid
Let’s be honest here, why wouldn’t i say that? Lol
@CodeLongAndPros
I think any developer who writes C or Go or Rust or any other low level language who started higher level wishes the same thing!
i know i sure do!
@MocaCDeveloper Though D is nice
except for the docs
@CodeLongAndPros
I've never gotten into D. I've heard i'd be better off writing just C code instead of going into D since it's primarily just C on steroids(primarily speaking, disregarding the fact C++ exists).
Rusts docs suck too. Some of the explanations aren't very good.
@MocaCDeveloper
D is pretty cool; it's a compiled language with high-level features.
Dynamic typing is opt-in, and is interoperable with C
Just the docs though: https://dlang.org/spec/struct.html
@MocaCDeveloper Dlang also has memory safety like rust: @pure; @trusted
@CodeLongAndPros
Do you recommend I learn D since I know Go, Rust and C? And also some C++ but I don't really write it lol.
@MocaCDeveloper
Ikr, the docs are easily the worst part of using any package or feature in Rust.
@DynamicSquid
I might be doing a tutorial over decoding a JPEG image. Would u be down to see it?
@MocaCDeveloper yes!
I started with BASIC, still feel good about it. The fact that C was my 2nd language might have something to do about it but BASIC was epic.
@TheDrone7 I'm not old enough to have done BASIC as my first language :/