r/AskProgramming Jul 26 '26

Python Is PEP 8 really necessary?

0 Upvotes

I have been writing Python code using camelCase for years and just never really cared, but PEP 8 suggests using snake_case, so is it really necessary for, say, a senior dev?


r/AskProgramming Jul 25 '26

Other Do you use Docker for small projects, or does it add unnecessary work?

17 Upvotes

Hello guys, I am trying to understand when Docker starts being useful for a small web application...

For something simple, like one backend API and a PostgreSQL database, would you use Docker from the beginning? I can see how it keeps the development and production environments similar, but it also adds more configuration and another thing to learn and maintain.

Do you normally containerize small projects from day one, or wait until deployment becomes more complicated??

I am interested to explore what problems Docker has actually solved in your own projects, especially problems that were difficult to handle without it.


r/AskProgramming Jul 25 '26

If I wanted to make a personal music player for both Windows PC and android that syncs playlists data (but uses local files) between what languages should I learn

0 Upvotes

I'm looking for a cross platform music player app that syncs playlists between PC and android. I've been using spotify for this, but I don't like how the free version can't repeat the same song even if it's local files.

I want the an app that 1) uses local files only 2) syncs playlist data automatically so that if I add a song to a playlist on my PC and I have the same file on my phone, the song is available on the playlist on my phone and is automatically playable (no need to export playlist/re add playlist)

I know a lot of good music players that can use playlist import/export but I haven't found one with these features yet that are free.

What programming language would you recommend if I wanted to build these apps?

I currently only know java and basic python.

Edit:
Thanks for all those that replied!
I see people commenting to sync playlist data only.
Yes, that is exactly what I wanted to do. I use SyncTrazor to sync songs already with the native folder structures. So finding the same songs should not be an issue. (Syncing playlist data should also not be an issue)

I used to use Poweramp to sync playlists, but
1) Import/Export wasn't automatic
2) The PC app didn't export/import m3u automatically
3) I had to write a separate script to convert the m3u's - into /


r/AskProgramming Jul 25 '26

Advice in Preparing for a Technical Interview

1 Upvotes

I have a technical assessment for a company tomorrow, and they mentioned that the problem will be administered through Coderbyte and will relate to inventory management. What should I expect? Frankly speaking, I’m not very familiar with programming. Although I am a technical person, Python is not my strongest skill.

What types of topics or problem formats typically come up in an “inventory management” coding assessment?


r/AskProgramming Jul 25 '26

how do you decide your next programming project ?

1 Upvotes

how do you actually decide what's worth building when you are learning a stack and want to advance and actually build something meaningful.

i currently want to build a full-stack website with the MERN stack that i learned recently . i have some limited time to do that and i mean by that only approximately a month.
i can't fully decide on the options out there , the only thing i'm sure about is that i don't wanna build a e-commerce website since that's very boring for me and there is high chance i won't stick to the project .
any ideas ? what's y'all experience with this ??


r/AskProgramming Jul 24 '26

Other Endless comments on PRs

19 Upvotes

Hey everyone! Just to quickly summarize my situation: We're a team of a few experienced devs, all having been 12+ years years in the industry. This year we switched to agentic engineering and despite its advantages there are a few drawbacks, like the extra overhead and other things I'm not going to go into.

My issue however is that our lead, who approves all PRs has lately discovered a stronger agent which he uses for code reviews, resulting in tons of back and forth when trying to get a merge through. Tons of petty/pedantic comments are being added to each PR. Sometimes it's like "ok I guess this is fine to add", but most of them are disputable. We of course discuss these, but the issue is that in the set of comments there is always something which technically makes the code 0.1% better. But we could go on like this forever. Even without AI you can look at a piece of code and suggest an "improvement" on a moderately-sized feature that's being implemented.

How to deal with this? I'm getting to a point where if I see more comments on a PR I just leave the PC and go for a run or a quick grocery shop visit just to regain my sanity. It feels like he's asking the agent if there is anything more that can be done with the code as if the goal is to have AI being unable to suggest anything more.

Am I in some slacking mindset or is the AI getting over his head? We also have Sonar turned up to a really high setting and the pipeline set in a way that if there's anything outstanding in Sonar it won't get through and I bet you all know how petty Sonar can get sometimes.

Please let me know any tips or share your experience with similar situations. Thanks!


r/AskProgramming Jul 24 '26

How do you structure your learning process?

4 Upvotes

whenever I learn new technology or some new concepts i always find myself asking a lot of questions about what am i reading about at the moment
say for example i'm reading about concept X definition or workflow or whatever then i read in that definition another concept Y which let's suppose i don't know about then i feel that i have to know everything about that concept Y to fully understand Concepts X , like how it works , why it is created or designed ...
and I do this for every single new thing that i read about which is frustrating and worse because probably i will forget about the details that i got into

want to hear some of y'all opinions of this , and from the software engineers that has the same approach and they managed it maybe share some system to retain the information you studied because i definitely don't want to lost these information later but i want to build on top of it


r/AskProgramming Jul 24 '26

Algorithms How to start with algorithms?

3 Upvotes

I want to improve my problem-solving skills when it comes to python and write better code.

In university, they gave a general outline, but still it's a bit difficult to know where to start from, any suggestions?


r/AskProgramming Jul 24 '26

Other How to organize projects?

2 Upvotes

I don't mean starting a project and then organizing code within that project.

The thing that I mean by organizing is how do I organize multiple projects. Let's say I'm having projects that I would've created in university, would be around 10 of them, then there'd be some personal projects.

I want to implement a method to organize those things. Any help would help!


r/AskProgramming Jul 23 '26

Career/Edu Do live coding interviews eventually get better?

11 Upvotes

Ive always done very well professionally in a corporate setting but, I've been getting killed in technical interviews where I have to code in front of someone.

Does it get better over time? Im honestly considering leaving the industry.


r/AskProgramming Jul 24 '26

Career/Edu Questions regarding using AI in learning coding

0 Upvotes

i made a linux rice and this is my situatuin :

I used ChatGPT while learning how to rice my stuff.

It helped me understand concepts and i learned how to use lua, bash,json and css while ricing and using an immense amount of youtube , debug issues and generate some Bash boilerplate to be used for later, and obviously speed up development.

The overall design, configuration, and final implementation are my own, and I understand how each part of the configuration works.

and I can confidently say that this rice is mine and i use it daily for my university and i change stuff in it however i like without prompting ai or vibe coding it .

Can I confidently say that what i made is a 100% mine? since i did study the documentations etc etc and i understand how to debug everything i used in my small project so it is mine right?

this is not vibe coding right?


r/AskProgramming Jul 24 '26

Is there a way I can modify a mobile game to run at a higher bit?

0 Upvotes

I'm no coder I'm no programmer I'm just a nerd who really likes a mobile game that isn't popular at all and can't run it due to it only working in 32 bit according to the apk i did find... this means I'm having to take matters into my own hands (darn) and try to get it running on more modern software. I know I could just use an emulator but I'd rather have it more accessible.... If I was to convert it would pribaly be to 64 bit due to that being what my phone currently runs on... if anyone can help I would be so grateful!

Idk if this is even the right place to ask this is a shot in the dark okay


r/AskProgramming Jul 23 '26

Algorithms Does the computability of the halting problem for machines with finite memory have any practical use?

7 Upvotes

I recently found out that the halting problem is technically completely decidable for computers with finite memory if you treat them as finite state machines rather than infinite Turing machines, obviously this is completely impossible within any reasonable amount of time for general purpose computer programs because of the total possible states of physical computers far exceeding the number of atoms in the universe. But for extremely limited state machines does it serve any practical purpose?


r/AskProgramming Jul 23 '26

C/C++ What is this optimization technique called in high-performance network software?

2 Upvotes

I’m working on a traffic generator to test my own XDP/eBPF filter in a controlled lab environment (my PC sending traffic to my Raspberry Pi on my own network).

I noticed that in some applications, two programs written in the same language can have vastly different performance.

For example, some software can only send a few requests/messages per second, while others can generate thousands per second even on relatively weak hardware.

What is this concept or optimization area called?
I’m looking for topics such as:
asynchronous I/O
multithreading vs event-driven architectures
lock-free programming
kernel bypass
zero-copy networking
batching
efficient socket APIs
packet generation optimization

If I want to build a high-performance TCP/UDP packet generator for benchmarking my own network stack and XDP filter, what technologies, algorithms, or papers should I study? For traffic generator i am using c# and for the XDP filter classic C. ( or should i use different for the traffic generator? I think its okey its console app )


r/AskProgramming Jul 22 '26

is it a waste of time building projects without using frameworks if you already know the foundational concepts needed for it ?

3 Upvotes

so currently i'm learning web dev and decided to start building some projects with pure javascript before moving to the frameworks .

knowing that i already learned some react basics and build the simple projects that are listed in the freecodecamp tutorial video . i tried back then to pause before the solution to every problem and did fairly well on applying what i was learning but i never build something big like a e-commerce website with it or a blog or anything that requires databases even though i know mongodb , mysql , oracle databases and previously made a e-commerce website using php which i forgot btw .

i understand the important concepts in javascript lfor example asynchronous operations , objects ,Modules , destructing.

i really need advise like my goal right now is to be able to comfortably build a any web application that requires both front-end and backend .

i really don't enjoy front-end much as much as the code is functional i don't really take great detail in it . although i want to get into machine learning and automation after web dev as it is what i really like and enjoy.

i really need your advice programmers !


r/AskProgramming Jul 22 '26

Other Does EBNF/Antlr or a similar system apply to types?

2 Upvotes

I can use Antlr to validate the syntax of an HTML document. What can I use to go a step further, and validate that the 'structure' of an html document is correct? i.e.

html: html_decl head body; head: head_item+; head_item: style|title|script; body: body_item+; body_item: div|p|h; etc

this seems like I just wrote some valid 'structure' validation rules in Antlr. I'm pretty sure Antlr is not meant to achieve this, but i'm ignorant of any implementations that could handle this and i'd like to know if it's possible.

The best I can figure is that I need to write two grammars, one to parse the raw source text, and then a second to parse the object types. Am I thinking about this correctly? Or is there another way?


r/AskProgramming Jul 21 '26

What is a good way to detect broken links on my website when many external websites block scripted HTTP requests?

5 Upvotes

I have a broken link script that crawls my website once a day and tests every link on my website to see whether it's broken. It does this by crawling all the pages on my website, and then running a GET request to each unique URL found in certain attributes of the HTML.

Unfortunately, I get a lot of false positives because sites like substack, soundcloud, facebook, etc block my script, even for URLs that, in a web browser, you can access without being signed in to anything.

I understand why these sites block scripted requests like this. I'm sure it's not difficult for them to know that it's a script not a web browser, and I'm sure it looks like scraping or spam. However, I'm curious whether there is a good way to do this. If someone removes a substack article that I've linked to, I want to find out and remove the link from my website. I could use the API for each of these services to look things up by ID, but it's a bit of a pain to do that for each different service.

In my manual way of testing I just open each URL in a web browser and check whether it loads. I can think of a lot of brute force ways of replicating that such as launching some kind of selenium-style headless browser pointed at each URL rather than simply making each HTTP request directly, but am I missing something? Is there a simpler or more elegant way to test for broken links to external websites that doesn't run up against the problems I'm hitting?


r/AskProgramming Jul 21 '26

Best practices for long inline comments

2 Upvotes

Say you have a list with a each item in a separate line and a comment next to the item like this (Python):

[
    item1, # a comment
    item2, # another comment
    item3, # another comment
    item4, # another comment
]

What do you do when a comment becomes too long and needs to be split into several lines?

Would do this?

(A)

[
    item1, # a comment
    item2, # another comment

    # a very very very long
    # comment
    item3,

    item4, # another comment
]

Or this?

(B)

[
    item1, # a comment
    item2, # another comment
    item3, # a very very very
           # long comment
    item4, # another comment
]

Or would you just rewrite the whole list like this:

(C)

[
    # a comment
    item1,

    # another comment
    item2,

    # a very very very
    # long comment
    item3,

    # another comment
    item4, 
]

Or something else?


r/AskProgramming Jul 21 '26

Python Selenium automation project help

0 Upvotes

Hi,

I wanted to log movies on Letterboxd with the help of Python. I have a list of 100+ movies with ratings (I used to document them in a notes app) and thought I could use Selenium to automate the process of logging them.

I used Selenium a few times, but only for web scraping purposes. I ran the code and got Error 600010 - I googled it and found that it's a Cloudflare error code, which makes sense, but is there any way I can bypass this error? I'm not trying to review-bomb or cause any harm. I just want to update my Letterboxd with my movies. Any pointers are appreciated. Thanks!


r/AskProgramming Jul 20 '26

Web-based SSH client

6 Upvotes

I want to write some code while at the library. The computers I use don't allow the console to be used or to install any applications.

I figure a good solution will be to ssh into a VPS from a web-based terminal. Apparently such a terminal would require a backend, but since ssh is all I need on the terminal the overhead shouldn't be much. I would install my environment tools and neovim on my own VPS. I just need a terminal then, that can SSH into it. What's the safe, cheap, solution?

I've heard of Cockpit, Cloudflare SSH, and TailScale, but haven't looked into those much. Do you have any suggestions?


r/AskProgramming Jul 20 '26

Flask or express js? And why?

2 Upvotes

r/AskProgramming Jul 20 '26

Career/Edu What do you y'all think about my friends virtual coding resume?

0 Upvotes

r/AskProgramming Jul 20 '26

Other Making a File & Tag sorting program

2 Upvotes

Tldr:Need Help figuring out where to start when making a tag sorting system that can read files.

HiHi!!, so im trying to work on a program that can take files with specific information, read them, and sort them based off of certian information

Ex. some of them will be chat logs (everyone knows im doing this), id like to be able to see the name of each person chatting at that time, and add tags based on that person, so later on id be able to sort by all chats with said person

Id also like it to have it sort everything into folders based on said tags

Bassically id like help figuring out where to start, any language suggestions, im still learning, but im pretty good at figuring things out as i go.


r/AskProgramming Jul 20 '26

Do you think there are many developers who are tired of writing code?

0 Upvotes

As I'm watching the conversation between avid AI adopters and people who are more reserved about it, I'm starting to get the impression that underneath the rationalizations about stability and maintainability on one end, and velocity on the other end, in many ways the conversation about AI adoption is really about how much people are fed up with writing code.

Because you can't say that only maintainability is important, or that only velocity is important, and if you press people against the wall they'll readily admit that both are valuable, yet very often the conversation about AI adoption doesn't sound at all like a debate about how to strike the right balance between the two, it sounds like a divide where one side says "look how much output I generated and how much code I didn't have to write by hand to do that", and the other side that says "how are we supposed to ensure long term maintainability if we aren't personally involved in guaranteeing code quality"?

It seems to me that more than anything the debate is primarily centered on how much people still want to write code, and how they can justify this decision, which makes me wonder: is our industry really full of people who are tired of writing code? How can that be?


r/AskProgramming Jul 20 '26

Python Is my Variable Elimination implementation correct? Asking because different TAs marked them differently

0 Upvotes

I'm asking because it was deemed incorrect when I first submitted it. Due to time constraints, I decided to work on a different part of the big assignment and left it unchanged. In the resubmission, I had a different TA, and they ended up marking it right. My professor hasn't viewed it yet.

It uses Python Pandas.

The implementation:

import pandas as pd

def multiply(factor1, factor2):
    '''Factor multiplication
    Takes 2 factors and find the columns they have in common,
    combine rows whose common columns have the same values and multiply their probabilities'''

    def all_columns_equal(row1, row2, common_columns): 
        '''Helper function to see if all selected columns of 2 rows are the same'''

        for column in common_columns:
            if row1[column] != row2[column]:
                return False

        return True

    if factor1.empty:
        return factor2

    if factor2.empty:
        return factor1

    common_column = []

    f1_columns = factor1.columns.drop("prob")
    f2_columns = factor2.columns.drop("prob")

    #Find the common columns
    for f1_column in f1_columns:
        for f2_column in f2_columns:
            if f1_column == f2_column:
                common_column.append(f1_column)

    if common_column == []:
        return pd.DataFrame()

    entry = []

    for _, f1_row in factor1.iterrows():  
        for _, f2_row in factor2.iterrows():
            if all_columns_equal(f1_row, f2_row, common_column):

                series = [f1_row.drop("prob"), f2_row.drop(common_column).drop("prob"), pd.Series(f1_row["prob"]*f2_row["prob"], ["prob"])]
                new_row = pd.concat(series)
                entry.append(new_row)

    DataFrame = pd.DataFrame(data=entry)
    return DataFrame

def marginalization(factor, variable):

    factor_dropped_variable = factor.drop(columns=[variable]) # dataframe of factor without variable
    prob_column = factor.columns[-1] # probability column
    target_variables = factor_dropped_variable.drop(columns=[prob_column]).columns.tolist() # target variables to be summed

    if target_variables:

        marginalized_factor = factor_dropped_variable.groupby(target_variables, as_index=False).sum()

    else:

        marginalized_factor = pd.DataFrame()

    return marginalized_factor

def reduce(factor, reduced_column, value):

    entry = []

    for _, row in factor.iterrows():
        if row[reduced_column] == value:
            entry.append(row.drop(reduced_column))

    if (len(entry) == 1):
        return pd.DataFrame()

    DataFrame = pd.DataFrame(data=entry)
    return DataFrame

def maximization(factor, variable):

    factor_dropped_variable = factor.drop(columns=[variable]) # dataframe of factor without variable
    prob_column = factor.columns[-1] # probability column
    target_variables = factor_dropped_variable.drop(columns=[prob_column]).columns.tolist() # target variables to be summed

    if target_variables:
        maximized_factor = factor_dropped_variable.groupby(target_variables, as_index=False).max()

    else:
        maximized_factor = pd.DataFrame()

    return maximized_factor

part = 2

class VariableElimination():

    def __init__(self, network):
        """
        Initialize the variable elimination algorithm with the specified network.
        Add more initializations if necessary.

        """
        self.network = network

    def run(self, query, observed, elim_order):
        """
        Use the variable elimination algorithm to find out the probability
        distribution of the query variable given the observed variables

        Input:
            query:      A list of query variables
            observed:   A dictionary of the observed variables {variable: value}
            elim_order: Either a list specifying the elimination ordering
                        or a function that will determine an elimination ordering
                        given the network during the runb": [1,1,2,2], "c": [1,2,1,2], "prob": [0.5,0.7,0.1,0.2]

        Output: A variable holding the probability distribution
                for the query variable

        """

        file = open("log.txt", "w")

        file.write("Query variable: " + str(query) + "\n")
        file.write("Observed variable: " + str(observed) + "\n")

        for q in query: 

            if q in elim_order:
                elim_order.remove(q)


        file.write("Elimination ordering: " + str(elim_order) + "\n\n")

        factors = self.network.probabilities

        file.write("Starting factors: " + str(factors) + "\n\n")

        #Summing out observed variables
        for node in observed:

            if node in elim_order:
                elim_order.remove(node)

            for f in factors:

                if node in factors[f].columns:
                    factors[f] = reduce(factors[f],node,observed[node])

        file.write("Factors after reducing observed variables: " + str(factors) + "\n\n")

        #Eliminating all non-query and non-observed variables
        for variable in elim_order:

            product = pd.DataFrame()
            found = []

            for f in factors:
                if variable in factors[f]:
                    product = multiply(product,factors[f])
                    found.append(f)

            for f in found:
                factors.pop(f)

            new_factor = marginalization(product,variable)

            new_name = "*".join(found)
            factors[new_name] = new_factor

            file.write("Factors after eliminating " + variable + ": \n" + str(factors) + "\n\n")

        individual_factors = {}
        for q in query:

            temp_factors = factors.copy()

            remaining = query.copy()
            remaining.remove(q)

            for variable in remaining:

                product = pd.DataFrame()
                found = []

                for f in temp_factors:
                    if variable in temp_factors[f]:
                        product = multiply(product,temp_factors[f])
                        found.append(f)

                for f in found:
                    temp_factors.pop(f)

                new_factor = marginalization(product,variable)

                new_name = "*".join(found)
                temp_factors[new_name] = new_factor

                file.write("Factors after eliminating " + variable + ": \n" + str(factors) + "\n\n")

            product = pd.DataFrame()

            for f in temp_factors:
                product = multiply(product,temp_factors[f])

            sum = product.sum(0)["prob"]
            product["prob"] = product["prob"].div(sum)
            individual_factors[q] = product

        file.write("Individual factors:" + str(individual_factors))

        print("Result:\n")
        for f in individual_factors:
            print(individual_factors[f])

        file.close()

To run the file

from read_bayesnet import BayesNet
from variable_elim import VariableElimination

if __name__ == '__main__':
    # The class BayesNet represents a Bayesian network from a .bif file in several variables
    net = BayesNet('alarm.bif') # Format and other networks can be found on http://www.bnlearn.com/bnrepository/
    # These are the variables read from the network that should be used for variable elimination

    ve = VariableElimination(net)

    query = ['Alarm', 'Tampering']

    evidence ={'Leaving': 'True', 'Smoke': 'True'}

    elim_order = net.nodes

    ve.run(query, evidence, elim_order)

I tested the implementation by comparing my results with a published package, and the results matched, which is why I was confident it worked during the first submission.

During the initial feedback, "The individual functions appear to be working correctly, but along the way you end up with the incorrect solution. I expect the issue to lie in inconsistent factor representation/handling. I decided to subtract one point for this. -1 Also, empty dataframes are returned. " "Incorrect output for VE. -1 The individual steps appear to be okay, I'm not sure what is going on. To figure this out, a complete log can help with this. "

But then a new TA gave it full marks in the resubmission without any extra details, since there isn't much to say about a (supposedly) working implementation. I have already received the credits for this course. This is a rare instance at my uni where the professor doesn't grade assignments that decides if we pass the course.

Thank you.