this post was submitted on 12 Jul 2023
29 points (93.9% liked)

Programming

17313 readers
215 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities [email protected]



founded 1 year ago
MODERATORS
 

I’ve been wanting to learn how to code for a while so I figure now is as good a time as any to start. I downloaded VS code on my laptop for python but I don’t really know end product I should try to code and I also am just bad and barely know what I’m doing. Does anyone here have any advice on what to code and how best to learn?

you are viewing a single comment's thread
view the rest of the comments
[–] beregoth 19 points 1 year ago (5 children)
  • Hello World
  • Read a file
  • Write a file
  • Read a file and loop through it line by line, printing each one (for loop or equivalent)
  • Program that consists of 2 or more source files

What I'm getting at is instead of a full program, write code snippets and small programs. In doing this eventually an idea for something larger will pop into your head.

[–] dbaner 7 points 1 year ago

When I'm learning a new language I like to try and solve problems from sites like https://adventofcode.com/ or https://projecteuler.net/ I find this gives my learning more of a focus. After you've done a few of these you should have enough confidence to attempt your own projects

[–] [email protected] 4 points 1 year ago (1 children)

In addition to what this guy said, don’t just use libraries to skip steps when writing small programs.

For example when parsing a file you will often use the split and strip functions in python, but learning how to implement these by yourself will teach you more.

To really learn fundamentals you should try and implement most operations yourself. It’s why in my opinion C is a better language to start with, because it forces you to learn the fundamentals.

[–] [email protected] 3 points 1 year ago (1 children)

I'd say it depends on the learning style. For some people, it's a lot less demotivating to start as just plumbing libraries together to get the end result than starting from the deep end. Same debate as starting with ASM vs starting with Python.

[–] [email protected] 2 points 1 year ago (1 children)

I see your point, but I would almost argue that starting out with all these shortcuts available in high level languages is ‘jumping into the deep end’ itself.

When a newbie sees obscure error messages in some of these libraries they might not have any idea what they mean or why they were triggered. My opinion is that having a smaller set of tools to start is actually simpler despite being able to do less with them.

I’m slightly biased because I started with C 😅

[–] [email protected] 4 points 1 year ago (1 children)

Started with C++, definitely wasn't easy. I ended up giving up and revisiting a couple years later and PHP/HTML was a fair bit less to take. I did end up revisiting C++ and making an archive format for my game engine. These days I definitely start by the low level, even libraries I jump to the low level features/long form before going to the nicer abstractions for the sake of understanding what's going on under the hood. It's definitely valuable too.

Just pointing out different styles of learning exists, OP can choose whatever fits better for them. I've known people that good completely demoralized because it was a bit much to take to think about how big an integer is in memory and arrays and whatnot. Especially if you approach it with making games, focusing on player moment and map scrolling can be more intuitive to learn the basics and slowly migrate to lower level things. I have friends that started with 6502 or Z80 assembly (good ol' Ti 83+ calculators) and they liked that way better because it made them appreciate what compilers really do better. Really dependent on the person.

I advocate for whatever works better for the learner, whatever makes them not give up and whatever keeps them going.

[–] abhibeckert 1 points 1 year ago* (last edited 1 year ago)

Started with C++, definitely wasn’t easy. I ended up giving up

I made it about as far as std::cout << "Hello World!"; and couldn't figure out wtf cout was or progress from there.

Eventually, nearly a year later, I started over with a simpler language (Basic) and maybe five after that I realised my IDE just wasn't setup right - so cout literally did nothing at all.

[–] [email protected] 2 points 1 year ago

Yep! And then read argv for command-line parameters + a parser. File IO + command-line controls gets you a shell of a utility to work with. Then grab a package you like the look, bring it into your project, and do something with it (image manipulation, network stuff, whatever....)

[–] slazer2au 2 points 1 year ago

This is a good start.

My latest python script loads my monthly banking CSV, arranges the columns in the correct order, assigns categories based on the merchant, and finally exports the data to a new CSV.

[–] [email protected] 2 points 1 year ago

I agree with this comment. Get these down then you can check this out