r/learnprogramming Mar 26 '17

New? READ ME FIRST!

830 Upvotes

Welcome to /r/learnprogramming!

Quick start:

  1. New to programming? Not sure how to start learning? See FAQ - Getting started.
  2. Have a question? Our FAQ covers many common questions; check that first. Also try searching old posts, either via google or via reddit's search.
  3. Your question isn't answered in the FAQ? Please read the following:

Getting debugging help

If your question is about code, make sure it's specific and provides all information up-front. Here's a checklist of what to include:

  1. A concise but descriptive title.
  2. A good description of the problem.
  3. A minimal, easily runnable, and well-formatted program that demonstrates your problem.
  4. The output you expected and what you got instead. If you got an error, include the full error message.

Do your best to solve your problem before posting. The quality of the answers will be proportional to the amount of effort you put into your post. Note that title-only posts are automatically removed.

Also see our full posting guidelines and the subreddit rules. After you post a question, DO NOT delete it!

Asking conceptual questions

Asking conceptual questions is ok, but please check our FAQ and search older posts first.

If you plan on asking a question similar to one in the FAQ, explain what exactly the FAQ didn't address and clarify what you're looking for instead. See our full guidelines on asking conceptual questions for more details.

Subreddit rules

Please read our rules and other policies before posting. If you see somebody breaking a rule, report it! Reports and PMs to the mod team are the quickest ways to bring issues to our attention.


r/learnprogramming 2d ago

What have you been working on recently? [October 12, 2024]

3 Upvotes

What have you been working on recently? Feel free to share updates on projects you're working on, brag about any major milestones you've hit, grouse about a challenge you've ran into recently... Any sort of "progress report" is fair game!

A few requests:

  1. If possible, include a link to your source code when sharing a project update. That way, others can learn from your work!

  2. If you've shared something, try commenting on at least one other update -- ask a question, give feedback, compliment something cool... We encourage discussion!

  3. If you don't consider yourself to be a beginner, include about how many years of experience you have.

This thread will remained stickied over the weekend. Link to past threads here.


r/learnprogramming 19h ago

The "I don't know what to build" community support thread

110 Upvotes

There are always posts acknowledging that building software is the best way to learn once you know the basics, and then people asking, "But what should I build?" I'm hoping this thread can help with that.

In the comments below, briefly describe one to five of your hobbies. Even if they are well known, easy to understand hobbies, explain them like the reader is five. Describe what they involve, what tools/equipment/"hardware" they involve, how you measure progress, how you improve, what sticking points there are, what challenges they involve, what you're struggling with in them, or whatever else might be relevant. Try to keep this concise, but informative. Keep it to about one paragraph per hobby.

In response to those posts, others can say, "For this hobby, build something that does X." Try to make an easy, medium, and hard version.

So for example, let's say one of my hobbies is reading. I might describe it like this: "Reading involves selecting books, which tell stories, and reading them. Books are characterized by having an author and a genre. I have a lot of books I've read, some I've liked, some I haven't, some I didn't finish. There's not really an 'improvement' but some books are recognized as harder than others. New books are often recommended based on being from the same author as others a reader has read, or being in the same genre."

And a response could be something like, "Why don't you build a book tracking app. At the easy level, just track what books you've read. Put in the title, author, and genre, and whether you finished the book or not. Then give it a rating. Have it be queryable so that you can list all of the books you've read in total, or by author or genre or both. Maybe you could even put in the date when you read the book so you can track how many books you read per year, and at the end of the year it could list all of the books, when you read them, and your ratings. Medium level could be to build a nice UI for this that can visually show by month how many books you read, how many you finished, and your ratings. Hard level could be to build a multi-user book website that would track each user's ratings, but also source and group similar ratings for common books/authors, and provide recommendations between the users if they opt in to such recommendations."

As another example, "I like disc golf. Disc golf generally involves discs, which can be drivers, mid range, or putters. Drivers go the furthest, putters go the shortest, and mid range are between drivers and putters. Discs can also be characterized as stable, left-turning, or right-turning. I can track my progress in disc golf by tracking how far I can throw each disc, and whether I can get it to go straight, turn left, or turn right. I also track my progress based on golf scoring at various courses, lower scores being better. So I could see improvement either by learning how to throw further/more accurately, or by seeing my scores decrease at a given course."

And an app could be, "Easy level: just track what discs you own, how far you can throw them, and whether you can get them to turn left, turn right, or go straight. Mid level: track each course and your scores at each course over time, which discs you use on each hole, par for each hole, and your performance over time at each course. Hard level: do the same but for multiple users, share what discs are used at each hole (if the users opt in to allow their data to be shared), how far each person's discs are thrown, and a recommendation engine for new discs you might like based on other users' discs."

Let's help each other out!


r/learnprogramming 13h ago

How do I hide my Back end API key in a python project?

36 Upvotes

I use supabase as my back end for a project of mine. But I need to hide my public key which I use to append data into the program.

How do I hide the API key?

I'm new to back end development as well.


r/learnprogramming 3h ago

Can you really specialize in one thing only?

5 Upvotes

I see that most people specializzati exclusively in onet hing like front end, back end (now full stack became more common), or AI engineer, data scientisti etc... Is it really that impossible to improve your knowledge by specializing in more activities? For example being a great full stack, AI engineer and data scientist all in one.

I feel like once you get into the mindset, it's not that hard learning those new related specializations... maybe It's just me...


r/learnprogramming 32m ago

Seriously, how do you learn to engineer software correctly?

Upvotes

I am decent at programming, albeit not the best. I also know enough theory in CS due to almost being done with a degree. So on that front I'm all set.

But I actually never figured out how to correctly engineer software.

I have some private projects under my belt and school has also had enough projects that I roughly know my way around.

But everytime, it looks the same:

  1. Haphazardly designing something that sounds solid

  2. Plan on using git correctly and document everything meticulously

  3. Abandon a lot of your ideas half way through

  4. Getting sloppier and sloppier with your code architecture

  5. Your clean git pushes and branching turn into a giant mess

  6. In the end you get something that is barely working on a codebase that looks messy and your 'engineering principles and design' went missing

Oh and testing is more like "yeah I think there are supposed to be unit tests so lemme just write some test classes. Works? Great." and then never touch it again.

It's all just very chaotic.

How can I change this and learn software engineering properly without having all the projects just turning into a mess?

I need some tips on how to learn a systematic and correct engineering workflow and design good software.


r/learnprogramming 1h ago

Are design patterns a subset of software architecture?

Upvotes

I am trying to understand the difference, or whether design patterns are tools under an umbrella term called software architecture, and if so what else does that umbrella encapsulate?


r/learnprogramming 1d ago

Topic Just. Be. Consistent.

167 Upvotes

The most important factor in learning a skill is consistent time spent over years. This is the same for athletes, dancers, musicians, and especially programmers.

If you were raised to play an instrument, like I was with guitar - I learned how to play classical music the “correct way” - teachers emphasize fundamentals like scales, theory, finger drills, etc. But I stopped playing in high school because I didn’t like classical music. And I noticed that a lot of my friends who played guitar were way better than me - and they mostly taught themselves by copying songs they liked.

But the important thing was they played all the time. And then when they reached a point where they needed more technique, then they started learning theory or drills.

I believe learning how to program is exactly the same. THERE IS NO WRONG WAY except for forcing yourself to do something you hate until you quit. Just do what’s fun for you, and make sure you code at least 2 times a week. The more you code, the faster it will go, but don’t get burnt out. This really does take years.

So in contrast to a lot of advice I see here, mainly saying to avoid tutorials or advanced frameworks, I say just do what you think is cool.

I’m a senior FAANG engineer with 8+ years of professional experience, and I learned how to code by writing macros in WoW…


r/learnprogramming 5h ago

I need a BIG project that i can start with little knowledge.

4 Upvotes

Basically, ive been trying to learn programming (specifically C++) since a while now, but im really struggling with motivation, which results in me programming for a month, stopping for like 5 months and forget everything. That's why i think i'd need a HUGE project, that would take me a very long time to finish, and would give me good knowledge. I have a bit of knowledge about everything so i dont really have an issue learning new stuff. I wanted to start building an OS but apparently its like the end-game of programming and not really recommended. Any idea on what i should go for? Thanks :)


r/learnprogramming 2m ago

Completely new to programming

Upvotes

I'm a student in architecture and engineering and in our introductory calculus class, as well as other math classes, we have to do some programming. Anyways, I am completely new to this so sorry if my question is stupid. We are supposed to find all extreme points to a function by using fminbound.

The instructions just tell you to draw the function and then (roughly) write:

from scipy.optimize import fminbound

xmin=fminbound(f,1.5,2)

But when i run it, it just plots my graph and I can't see any points plotted. I also can't see any values being returned in text either. This is the code that I wrote, and all I get is a (correct) graph

import numpy as np

import matplotlib.pyplot as plt

def f(x):

return (1+x**2-1.5*x**3+0.5*x**4)/(1+x**4)

x=np.linspace(-5,5,200)

plt.plot(x,f(x))

from scipy.optimize import fminbound

xmin=fminbound(f,1.5,2)

What am I doing wrong? How do I plot the extreme points?


r/learnprogramming 11m ago

Database design for file sharing systems like Google drive

Upvotes

I want to design a system like Google drive in which I can share files and folders .. Iwant to design a optimal design for the database tables I am planning on using relational database postgres for this system.

I tried implementing it for files only and managed to do it but when I later thought about introducing folders I can't decide how to move from there. Sharing is also possible in this system the user can share files with other users of the system

My current design contains three tables

Users (userid,username,hpassword)

Userfiles(fileid,filename,filelocation,createdby)

Permissions(fileid,userid,accesslevel,sharedby)

I store Metadata of files in the db not actual files

I use permissions table to track who can access files..now I want to introduce folders into the system but I can't decide how?


r/learnprogramming 18m ago

Debugging PHP code impossible to process in localhost

Upvotes

Hi guys! So basically, I have a web application that I'm hosting with XAMPP. However, when I load it with localhost, it just prints the code on the browser and doesn't display any of the PHP code. I'm trying to determine if a module in my XAMPP apache is missing, but I can't find the full XAMPP download files, and when I downloaded XAMPP again in my download folder, all the apache module files were there. Has anyone ran into the same problem? Many thanks.


r/learnprogramming 4h ago

Which software to use for collecting data for later analysis?

2 Upvotes

Hi everyone! This is my first post, I am hoping I don't break any rules :)

I am a cardiac surgeon in Bosnia and Herzegovina but I like to do some programming, mainly on FileMaker Pro and Python a little bit.

I made application for collecting patient data (see attachment) for later analysis. There is only text, numbers, date and time type of data entered. With a few clicks I can export data in Excel or SQL tables. Claris FileMaker Pro is quite expensive. That goes for software and server renting, so I am off to find another way for creating the same application but in other programming language. I have spent months searching online what to use or learn. Google's search results recently became just sponsored links for web applications. I do not want my database to be online, I would prefer it to be on our local server in hospital. Do you have any suggestions of what to learn and use? Is there similar solution as FileMaker pro? Thank you all in advance.


r/learnprogramming 36m ago

I want to launch a startup, best resources for learning programming, UX/UI, and Development for this goal?

Upvotes

Hi everyone,

I'm planning to launch a tech/online startup based on a great idea i had recently, involving web, mobile, and AI features. the challenge is that i'm starting from zero,without previous coding or design knowledge/experience. to build this product, i'll need to learn everything from programing to ux/ui design and probably alot more.

I've seen a ton of courses but most seem focused towards helping people find tech jobs rather than building your own products as an entrepreneur. I want to find great resources that help learn all of this without getting stuck in "tutorial hell" or following a path to strictly find a tech job.

I am pretty inspired to dive deep into all things tech as this is something i see for my lifetime. Does anyone know of amazing resources - whether courses or full platforms (free/paid) that can be suitable for entrepreneurs who want to successfully create their own tech products?

Any and all advice/recommendations would be really helpful, thanks!


r/learnprogramming 39m ago

What authentication middleware could I use in my portfolio project?

Upvotes

I'm building a mini-blog for my portfolio using React. For the backend, CoPilot suggested the following stack:

  • Node.js + Express for the backend setup;
  • Passport.js for authentication;
  • MongoDB for data storage;

The first and third seem solid, but I haven’t heard much about Passport.js, and I don't see many job listings mentioning it. I'd like to use an authentication middleware that’s more in demand so I can highlight it on my resume. Any suggestions would be greatly appreciated.


r/learnprogramming 49m ago

Can you run redis or a lite version redis on the client side

Upvotes

I want to make a redis visualizing tool for learning purposes. Is there anyway I can run reids on the client side? Something like redis compiled to javascript. If this is not possible would I be able to compile redis or a fork of redis like val-key to js or WASM.


r/learnprogramming 1h ago

What’s the best way to learn how to program? Not code in x language but really learn the transferable skill that can be used to pickup languages whenever needed.

Upvotes

I have coded before and enjoy the phenomenal and endless possibilities that coding provides. But I have also found that I never learned how to program, I couldn’t write my own logic, abstract thinking was absent, followed tutorials without having a clue why or what things were doing what they were thing. I would stare at a block of code hoping it would run if not go online and copy and paste another possible solution. This time is different, I don’t only want to develop software I want to become a software engineer by learning the best practices. My goal is get a job and also build projects for personal use.


r/learnprogramming 1h ago

Radix 4 Booth Multiplier not working for some specific values

Upvotes

The following code doesnt work for some values like a= 24720 and b=44720, while the datasizearb =16 the result is wrong. If we change the datasizearb to 32 then the result of a,b comes correctly can anyone diagnose what can be the possible issue?

`include "defines.v"

module MBA_module ( input clk, reset,

input [`DATA_SIZE_ARB-1:0] a, b,

output reg [2*`DATA_SIZE_ARB-1:0] product

);

reg [2*`DATA_SIZE_ARB-1:0] ans;

integer i;

reg [2:0] lookup_tbl;

reg [2*`DATA_SIZE_ARB-1:0] out1,out2;

reg [`DATA_SIZE_ARB-1:0] a_r, b_r;

always @(posedge clk or posedge reset) begin

if (reset) begin

out2 <= 0;

a_r <= 0;

b_r <= 0;

end

else

begin

a_r <= a;

b_r <= b;

out2 <= out1;

product <= out2;

end

end

always@(*)

begin

out1 = 0;

for(i = 0; i <= `DATA_SIZE_ARB-1; i = i + 2) begin

lookup_tbl = {b_r[i+1], b_r[i], ((i == 0) ? 1'b0 : b_r[i-1])};

case(lookup_tbl)

3'b001, 3'b010 : begin

ans = a_r << i;

out1 = out1 + ans;

end

3'b011: begin

ans = a_r << (i + 1);

out1 = out1 + ans;

end

3'b100: begin

ans = a_r << (i + 1);

out1 = out1 - ans;

end

3'b101, 3'b110 : begin

ans = a_r << i;

out1 = out1 - ans;

end

default: ;

endcase

end

end

endmodule


r/learnprogramming 1h ago

Advice on Choosing a Programming Language for High-Speed API Integration

Upvotes

Hi everyone,

I’m working on a project that involves retrieving live trade data from two sources via their APIs, and I’m looking for some advice on the best programming approach. Here’s the setup:

One API is available in C++, Java, C# (.NET), and Python (I assume the Python option is a wrapper for the C++ API).

The other API is written in .NET.

Speed is critical, as I need to process the data in real-time. Currently, I’m using Python and interacting with one of the APIs via pythonnet, but I’m wondering if I should consider switching to a different language for performance reasons.

Here are my key questions:

  1. Is it generally better to interact with an API in the same language it was written in? In this case, would using C# for a .NET API be more efficient than using Python (also thinking about debugging issues as well)?
  2. Since speed is a priority, would a language that supports true multithreading and multiprocessing be essential? I haven’t worked much with multithreading yet, but I feel it could be important here.
  3. I’m familiar with Python, but I’m considering learning C#/.NET for this project. Does that seem like a good idea, or is there another language that might be better suited for high-performance, real-time API interaction?

Any insights would be greatly appreciated!

Thanks in advance.


r/learnprogramming 10h ago

Writing a Logo compiler in Rust

5 Upvotes

For uni this term I’ve taken a Rust course as I was interested in learning a new language and have heard lots of hype around Rust. I'm a first year student and have realised that I've definitely bitten off more than I can chew for this course.

Our task this term is to write a Rust program that can take a .lg (Logo) file and output and svg or png file.

I have a very basic program currently. Right now my program reads through the .lg file, breaks it down in an vector of vectors of strings - so that a logo file that looks like this:

PENDOWN
TURN "45
FORWARD "50
TURN "135
FORWARD "50

Would be processed and turned into

[["PENDOWN"],["TURN","45"],["FORWARD","50"]...]

From here, I run a loop and match across all instruction and perform the necessary action on the output image.

This worked well for the early stages of the assignment. The requirements for the later stages are much more complicated and I am finding this iterative method quite difficult to code. My tutor recommended using an "Abstract Syntax Tree" to complete this assignment, although he wouldn't really explain how it works. How might I apply an AST to my program? How do I implement it?

I've also run into an issue of how I should store the Logo program's variables (which are defined with the "MAKE" call). Currently I am storing variables in a hashmap, but I am finding this method to be a bit tricky too... I have no issue with continuing with this hashmap method of storing variables but is there an alternative method that may benefit me?

Overall I'm feeling a bit stressed with this assignment, so any advice would be greatly appreciated.


r/learnprogramming 5h ago

Hello frontend and Vue enthusiasts! We invite you to take part in the Vue Odyssey contest!

2 Upvotes

Join our online competition "Vue Odyssey" and travel to Mars by solving a unique expedition. Are you ready to conquer the unknown?

What do you have to do?

Solve 3 VUE frontend challenges and you can get exciting prizes: vouchers for specialty coffee from our sponsor, YUME and DojoCoins that can be used in our online store.

Link to contest


r/learnprogramming 2h ago

Info on BeachCoders programs?

0 Upvotes

I'm looking into bootcamps/programs and am wondering if anybody has info on BeachCoders. From what I've read it's a fairly cheap option that offers 1-1 training. Has anybody heard any good/bad reviews about it?


r/learnprogramming 1d ago

Somebody wrote a good post here about just writing programs for learning

62 Upvotes

How do I learn? Write programs. How do you know so much? By writing programs.

But my question is, How do I know what program to write? I’ve done a todolist, a calculator, ping pong game. Like how do you guys come up with a program idea to write? For me that’s the hard part


r/learnprogramming 3h ago

Resource Please suggest FREE question-based learning website for JS.

0 Upvotes

Hi all, I want to learn JS, I come from a Java background, so programming is not new to me, but I am the type of guy who enjoys reading the concepts and solving a related question.
I am referring to websites like:
1. Free Javascript challenges online | JSchallenger

But unfortunately, they are paid, please suggest some similar website for Js.


r/learnprogramming 3h ago

Topic Creating doc or pdf templates from webpage elements

1 Upvotes

My Node.js web-project has an EJS HTML with

  1. A fetched user list from an API listed in a table-element and
  2. A rendered ChartJS diagram as a bar chart.

    I'd like to have a button 'export' what is on the page, which would: a. Pass my selected webpage-elements (userlist or chart) into the server.js Node-backend. b. Use a local static template to add these elements into document placeholders (marked as eg. <<chart>> or <<userlist>>) in my PDF or DOCX-template. c. Download the finished file locally as a new file or alternatively upload the new file to the signed-in user's Google Drive using Google API's.

If possible i'd like the userlist and chart to look visually the same on the template as on the webpage aka. include all CSS & JS rendered in the page. How can this be accomplished? Any pre-existing libraries? Do you have another suggestion to this?


r/learnprogramming 3h ago

Going back to school for CS degree?

1 Upvotes

Hi all, currently in the healthcare field and went to a bootcamp around 2022(truecoders), I was not able to find a job and the blame is also on my part as I did not apply myself to my fullest. I was putting the effort(again, not to the fullest I admit), but I realized I did not really have a clear direction. I went straight back to my healthcare career about a month or 2 after graduation. I own up that I should have gave it way more time and not given up so quickly. I have much more urgency now that I am older and a bit more mature, I understand that this route will not be easy but I want to at least give it another chance.

I was set on advancing my career in healthcare, but here I am again in 2024 wanting to try and dive back to the tech(SWE specifically) world. Would you guys recommend going back to school and get a CS degree? I've pondered if going back to my community college to get started is the way to go.

If anyone has any tips in general to get my foot in the door, it would be much appreciated. Thank you v much.

Background - Occupational Therapy Assistant with a Bachelors of Science in Health Sciences living in LA, CA


r/learnprogramming 3h ago

Study Group

0 Upvotes

Hey there!

I’m a first-year AI/ML student who’s taking an OOP course in Java this semester, and I thought it might be fun to gather some people from around the world who are also taking it this year so that we can share discussions, work through tasks together, ask questions, and help each other find answers.

Just let me know if you wanna join!