this post was submitted on 04 Dec 2024
84 points (97.7% liked)

Ask Lemmy

28605 readers
1352 users here now

A Fediverse community for open-ended, thought provoking questions


Rules: (interactive)


1) Be nice and; have funDoxxing, trolling, sealioning, racism, and toxicity are not welcomed in AskLemmy. Remember what your mother said: if you can't say something nice, don't say anything at all. In addition, the site-wide Lemmy.world terms of service also apply here. Please familiarize yourself with them


2) All posts must end with a '?'This is sort of like Jeopardy. Please phrase all post titles in the form of a proper question ending with ?


3) No spamPlease do not flood the community with nonsense. Actual suspected spammers will be banned on site. No astroturfing.


4) NSFW is okay, within reasonJust remember to tag posts with either a content warning or a [NSFW] tag. Overtly sexual posts are not allowed, please direct them to either [email protected] or [email protected]. NSFW comments should be restricted to posts tagged [NSFW].


5) This is not a support community.
It is not a place for 'how do I?', type questions. If you have any questions regarding the site itself or would like to report a community, please direct them to Lemmy.world Support or email [email protected]. For other questions check our partnered communities list, or use the search function.


6) No US Politics.
Please don't post about current US Politics. If you need to do this, try [email protected] or [email protected]


Reminder: The terms of service apply here too.

Partnered Communities:

Tech Support

No Stupid Questions

You Should Know

Reddit

Jokes

Ask Ouija


Logo design credit goes to: tubbadu


founded 2 years ago
MODERATORS
 

How do I go about this? Are there any free resources that’ll help me get started?

I see people advising to start with a small project, but you need to get some basics down right? What language? How to develop it and stuff?

My only experience is some very basic C programming classes I took during school.

top 50 comments
sorted by: hot top controversial new old
[–] [email protected] 1 points 2 months ago

Language: Python. It does reasonably well at staying out of your way from learning programming instead of the quirks of your language.

It's so long ago I learnt to program that it feels like my sources are outdated by now.

[–] [email protected] 3 points 2 months ago* (last edited 2 months ago)

There's lots of options for starter projects, but I'd say a great place to start is making yourself a personal web page in html, css, and js. you can host it for free on github, neocities, or nekoweb, and its really cool to make something you can show off.

Even if you don't stick with html as your primary language, the web is so ubiquitous now that you'll want to know it eventually!

[–] [email protected] 6 points 2 months ago

Like others have said it depends on the field you want to code for and language choice. The field might inform your language choice.

I'd highly recommend python as your first if you're just looking to get stuck in. It'll teach good fundamentals, it doesn't have a steep learning curve and it has a very wide set of applications plus loads of community support. This website is what I recommend to anyone wanting to learn python: https://futurecoder.io/

Good luck!

[–] [email protected] 5 points 2 months ago

IT guy here, I don't really program, but I do write scripts in Powershell and Bash from time to time.

I mostly learn by doing, so I have a task that I need to write a script to accomplish.

One script I often use is a tool I made to ping devices in a network range.

This breaks down into several smaller steps.

  1. Define the start IP address
  2. Define the stop IP address
  3. Issue a ping command
  4. Repeat the ping command for every adress in the defined range.
  5. Output the data
  6. Colour code the data
  7. Make every IP address ending with a 0 be colourded in the output.

Each step is fairly simple to find out how to solve, together they make a good script to solve the initial issue.

[–] [email protected] 4 points 2 months ago

Code combat

[–] [email protected] 4 points 2 months ago* (last edited 2 months ago) (1 children)

Learning a programming language , is pretty simple (didnt say it was easy)....its memorization. Maybe less so now with the advent of things like Copilot/AI assistants.

Understanding what you're trying to accomplish is possibly the harder part. I would rephrase your statement: "I want to learn how to build an application". For this you can butter toast...with instructions.

Pretend there are two people, one is the instructor and one is the toaster/butterer. There is a wall between them so one cant see what the other is doing and the end result is buttered toast. There are a couple resources; bread, butter, knife, toaster, plate.

1st attempt the instructor says: Pick up bread, put it in toaster, take out bread and put on butter. Result: Untoasted bread, butter on hands

2nd attempt the instructor says: Pick up bread, put in toaster, push switch down to toast, take out bread and use knife to put on butter. Result: Loaf of untoasted (did you check if toaster is plugged in?)bread with butter on both sides sitting on the counter (remember the plate?).

See how specific you have to be about certain things? I would call this functional programming. Object oriented program takes it a bit farther in that the toaster is now classified with things like; browness level, electricity/plug state, slice/bay current occupancy, toast switch etc.

[–] [email protected] 2 points 2 months ago* (last edited 2 months ago)

This is a great analogy! To build on these points and the analogy: I like to think of my coding in terms of inputs, outputs, and what needs to happen to the inputs to get the outputs I want: that is, inputs->how->outputs. So for this buttered toast analogy, your inputs would be:

  • toaster
  • electricity
  • bread
  • butter
  • knife
  • plate
  • operator's hands

The desired output: toasted bread on the plate with butter spread on one side.

The "how" is the sequence of specific instructions the instructor gives to the operator.

This approach is even more helpful as you start working on larger projects; as you think about a problem you're trying to solve, try to break the overall input->how->output into smaller modules of input->how->output, and then you can use those modules (often called "functions" or "methods") in the overall "how." Let's say you want the instructor and operator to prepare a full breakfast with bacon, eggs, and buttered toast. You'll have some more inputs, of course (frying pan, raw bacon, shelled eggs, stove, in addition to the toast components), but since you already made a known-good make_buttered_toast function, you can incorporate that function into the pipeline to go from your more comprehensive set of inputs to the full breakfast outputs, and you can make separate functions for making the bacon and making the eggs. Finally, your overall program can then call your bacon, eggs, and toast functions to result in the desired output of a full breakfast.

Now here's where breaking the problem down into smaller input->how->output chunks really comes in handy: one day, you are tweaking your breakfast-making code, and suddenly, your overall outputs have good bacon and good toast, but the eggs wind up dumped half-cooked on the stove. But since you made nice, modularized functions for toast, bacon, and eggs, you automatically know more where to start looking for the bug: the eggs function.

There's a lot of good advice in the responses to this post! Overall, I just wanted to emphasize what I wish I had learned much earlier on in my career: the benefits of thinking in terms of inputs->how->outputs and modularizing sub-problems in the overall program's "how" into subproblems that can be independently considered, debugged, and re-used on future projects. (A secret for you: those of us who have been coding for a while often don't start everything from scratch--we'll re-use some functions or classes we wrote in the past, tweaking them as necessary for new applications, but not needing to start from a blank text editor :) ) Learning to write applications in code is exploring a new way of thinking about problems and how to solve them, and personally, I find it very rewarding!

I wish you all the best on your coding journey!

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

Start my picking what you want to do with programming. Then do a couple of simple challenges in any language like advent of code and such in python just to get your feet wet and solve some problems.

After that you should have the main building blocks and then you scale up into making a "thingy" sized project. I personally liked making games with progression like.

  1. Text adventure
  2. Tic tac toe
  3. Another text adventure but with battles and hit points.
  4. Tetris

Then you can start learning separation of code into modules like "This is the game and this is just how it's shown" which applies to pretty much every application with a user interface.

After that you have enough skill to learn anything and you can go about learning a specific skill or technology that you want to work with and you'll be at a skill level of a junior programmer.

Advancing beyond that I'd recommend reading a couple of books (crazy I know) that go over best practices and why they exist. You use those guidelines and get better at working with larger amount of code and then you get to mid level. During this time you should also basic rules of thumb on how long each thing takes to run, both algorithm complexity and how http requests are usually the bottleneck.

For senior level you'll need to gain a lot of experience and become a library of solutions and bug knowledge while also having a good grasp of tradeoffs. You'll need to know when to insulate yourself from change and when it's overkill to deliver the code in a timely manner while not sacrificing tomorrow.

It's very hard to skip any step in my opinion but reading a couple of books really helped me advance through the junior phase quickly just by knowing what solutions are out there. Books are not as valuable when you don't have experience since it'll stick 10x better if you encountered the problem described in the book.

To get started just pick anything and get your feet wet. Good luck!

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

Any books you would recommend?

[–] [email protected] 3 points 2 months ago* (last edited 2 months ago)

Clean Code, in overly idealistic and speaks like it's the holy truth but ideas are generally good. Same with Clean architecture. The guy talks like it's the only way but in my experience it's just a collection of tricks you could do but maybe shouldn't because of time pressure. One off code with a single purpose doesn't have to be that clean and functions almost never have to be that small.

Pragmatic programmer is also good and there are also more books on non-programming part as well. You could also ask ChatGPT since it's really good at exactly these questions.

Still, no use reading this until you ran the gauntlet of building up basic programming skills :)

[–] [email protected] 5 points 2 months ago

Pick a language to start. If you want to automate CAD, maybe it has an existing scripting language built-in?

Learn the basics from the documentation. Look at the examples. Learn how to search for specific answers.

Finally, practice a lot. Most of the challenge is breaking a problem down into discrete steps (your algorithm), which can be written in pseudo-code. The implementation of that algorithm may look different depending on what the target language is, or what library/tools you can leverage within that language.

https://codingbat.com/ if you choose Java or Python

https://www.freecodecamp.org/

https://adventofcode.com/ has easy-to-challenging problems suitable for any language

[–] [email protected] 3 points 2 months ago

Check out https://roadmap.sh/ for a guideline on your set goal!

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

Step 1 is determining what kinds of projects you want to make and selecting a language and/or libraries that will help you do that. Eg. if you want to code for the web, there's JS. Then you can follow tutorials, and/or jump into making small projects.

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

Yeah, although some languages can be used for practically anything, including JS. Some people program microchips with it. Lol

[–] [email protected] 3 points 2 months ago

I am a JS apologist

[–] [email protected] 7 points 2 months ago (2 children)

To add to the list, Codingame.com

It wouldn't be the first thing to try. Get the basics down on your own machine/environment. Try this for something additional.

CodinGame gives you the IDE and build environment in your browser, so it's for learning/practicing/testing coding knowledge without building/deploying locally, or worrying about UI/persistence/networking etc.

It's filled with coding puzzles and competitions. I started where they give you animated scenarios (to look like part of a game or engine), and you contribute a small, missing unit of code to complete the challenge.

You can choose from 25 languages, they encourage unit-testing, and there are global coding competitions and company outreach to top coders. I don't wanna say they gamified it.. but they did.

But once you're comfortable with those, CodinGame lets you practice different concepts & algorithms without having to come up with the bigger systems around them.

I've loved it for getting back to coding after a while, tinkering with certain concepts, or trying other languages.

I'm not affiliated with it. Just loved the idea & execution. Except for Mars Lander III challenge. That can get @#$&ed.

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

I think it is!!

Gather food & liquids, cancel any plans tomorrow, fire it up in a browser.

Y'welcome.

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

My journey went codecademy -> codingame -> quitting my job and going to university -> first job

I went to University to get more problems to solve after grinding codingame and decided to overkill them and had fun while doing it. I remember Mars lander, it was really hard, hahaha.

[–] [email protected] 2 points 2 months ago* (last edited 2 months ago)

Yeah that sounds like a good path!

I used to love advanced math, physics and game coding, so I've revisited the 'Landers several times over the years (a day here and there in the middle of life/emigrating/careers).

If you also Google for solutions to the 'Landers you'll find people have done hardcore analysis and genetic algorithms!

(cough like this)

Next mission: somehow hack UE5 into CodinGame and let it sort it out.

[–] [email protected] 2 points 2 months ago

Just search for tutorials, and then follow the steps in them.

[–] [email protected] 7 points 2 months ago

One thing that has not been mentioned that will make a big difference: join an online community.

When you get stuck or you're confused and need to ask a question, you need to have a place you can reliably go to for that. You will also be able to see others go through their learning journey which will encourage you to keep going.

Someone mentioned The Odin Project already, but they have a very big and wholesome community.

My specialty is web development, but the concepts of programming is pretty universal. Feel free to DM me personally if you want some help.

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

I've been going through The Odin Project for full stack web development. It's been great and is completely free.

I would advise against using Chat GPT or any other LLM; they "hallucinate" and can give you wrong information.

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

Imo, the main problem is that it does the job for you and you don't learn anything. It's great at explaining concepts though.

Along the same lines, I would suggest to never copy/paste code. Physically writing it helps your brain remember.

[–] [email protected] 4 points 2 months ago

Yea, just copy/pasting code without already understanding it is a bad move.

If you deliberately drive GPT into a certain direction with the prompts about a specific topic and the model has been trained on the subject matter, its accuracy will be higher. If you ask GPT about a less popular language that it has little or no training on, its answer will likely be garbage.

[–] [email protected] 5 points 2 months ago

Not sure why nobody mentioned it, but use GPT or whatever you like to create code for you and explain everything. It is like talking to someone with some experience. Not everything is perfectly correct etc. if you get into more complicated stuff but you will certainly learn a lot and fast. The learning curve got a lot flatter with these tools.

[–] [email protected] 5 points 2 months ago

I always recommend https://automatetheboringstuff.com/ as it helps teach you python basics, as well as learning some coding fundamentals. Its free at the website, while offering a book version you can purchase. I have been coding in python professionally for 5 years, but I started with these tutorials (after doing a non-python coding bootcamp that focused on full stack web development)

[–] [email protected] 1 points 2 months ago* (last edited 2 months ago)

Just start with python or node.js and do some tutorial. :) If you want to get good, you should read a book though. There are many details about a language that online tutorials don't cover.

[–] [email protected] 2 points 2 months ago

Dr Chuck has some courses for free. They consist of youtube tutorials, books an slideshows.

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

https://scratch.mit.edu/
Also, before starting writing code: learn to break down things small things.

[–] [email protected] 5 points 2 months ago (2 children)

Could you elaborate please?

[–] [email protected] 6 points 2 months ago

Scratch is a coding tool and system that is primarily targeted at children, and relies strongly on a visual way of working. It is easy, can be switched feom visual to text, and ultimately switched to python.

[–] [email protected] 4 points 2 months ago

The visual coding style might help with learning the basic approach to problem-solving.

[–] [email protected] 2 points 2 months ago* (last edited 2 months ago) (1 children)

I'd say install linux first as it will make things easier as python is built in and ts just a better OS all around.

As for getting started you can use youtube Or some free books such as

https://automatetheboringstuff.com/ https://inventwithpython.com/

And more here https://pythonbooks.org/free-books/

After a few videos and a book you will get the hang of it and get more confident in your abilities. Then do a project of your own

There are other languages but python will allow you to make progress fast and you can branch out to a different language later of if you like.

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

I really wish I could run Linux but almost all of the software I use for work is only on Windows.

But I will say I am decent in following instructions and using the cli. My mum’s system runs linux and that has been a learning experience.

[–] [email protected] 2 points 2 months ago

Fair enough, you can always do it on windows too or use a virtual machine

[–] [email protected] 3 points 2 months ago

I personally really liked https://learnjavascript.online/ when I was just getting started with JS. I use the knowledge from that course like every day at work now. The same guy also made a general programming course for beginners, I bet it's good as well: https://learnprogramming.online/

What I especially liked about the course was that you got little assignments between each lesson, that you could just solve in their web IDE. So there's no fiddling around to set up an external IDE. Big big plus for me, I hate setting up stuff like that

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

I know you've heard it, but seriously, the biggedst hurdle to learning programming is having a solution looking for a problem. You can learn all kinds of stuff in the abstract, but your brain will either handwave over it or bounce off, if it can't contextualise the knowledge into a problem-solving tool.

A source of small but genuine needs is the scarcest resource.

I know the world has moved on to big cosy high-level languages that let you think semantically about everything but honestly I'm still a big fan of starting with C; it is something of an austere discipline, but it gives you a boots-on-the-ground view of the problems you're working with, and I think that really helps shape your understanding of what you're dealing with.

(you could do a fair bit worse than the game 'human resource machine' for a slightly gentler introduction, then pick up some exercises in C, then move to python or similar - it will let you appreciate the cosy high-level stuff, and have a better feel for why you're doing stuff)

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

My only real exposure to coding is C in Turbo C++ it was not a nice surprise when I later looked at other IDEs and was not sure where to begin. Maybe I’ll just get started with Turbo again lol.

[–] [email protected] 2 points 2 months ago

aw hell yeah, that ruled back in the day.

Might be challenging to get it running in a modern environment, but I admire your taste in the classics :)

[–] [email protected] 1 points 2 months ago* (last edited 2 months ago)

I have a similar issue... I have done slightly more than nothing, I really struggle trying to think of small projects that actually work for me.

The few things I've done I stop at a certain point because I have no motivation for the actual content* or there are platform* issues. One thing I made was maybe usable but was likely too much** of a time sink for me.

Though I keep trying other things hoping enough pieces fit that I can think of something.

EDIT: I don't know if it is any help but what I've mentioned were text formats+loaders.

spoiler

*=An adventure book (...if you go right, turn to page 100) reader (via declarative GTK framework). Using text files per page, allows linking to other pages (4 option IIRC, custom button name+description). Text was too small on buttons (no dynamic scaling), especially as I wanted to maybe use unicode 🔍

**= Polygon reader for Raylib (via bindings). Using text files, some data lines at top then an ASCII grid with manually-ordered points (1-9, A-F etc, mostly blank space for simple shapes) to create a seq[Vector2]. Unsure on usage (what users would use+understand more) of polygons that need different vertex order, trianglestrips vs trianglefan. For usability, I was thinking of making an editor for it.

I'm using Godot now and leaning more toward 3D (because vertex colors) and all I can really think of is maybe something like archery. Maybe a wizard boomer shooter, if that wasn't such a high goal.

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

What type of idea do you have? You can "generally" use any of the popular languages, but some are better suited to rapid/beginner use for certain applications

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

Some linux iso management, some CAD software steps that I want to automate. My very general target is to get comfortable with trying to look up documentation, scripting and make my own code bashes for local use cases.

[–] [email protected] 3 points 2 months ago* (last edited 2 months ago)

Interesting. One avenue of research I've found is to start with the target system and learn what interface they offer. Is it an API, a custom socket, etc. Then work back... you'll have some clues to make a language selection

load more comments
view more: next ›