r/learnprogramming • u/Dimethyltrade • 2d ago
Language selecting Need help picking a language, please!
Hello,
I am totally lost in this world of programming. I have succesfully coded a working webhook for discord and plan on getting some more stuff sent into it but only with the help of Claude.
I believe it was written in python. I day trade stocks and am tired of software and websites breaking, and/or not really being customizable to my liking so i figured i'd create my own!
I need to know a couple of things.
Time is critical and every second counts. I was looking at Python (of course) but also Rust, C#, C++, and Go. I plan on building more than just webhooks, so information that needs to be passed through in miliseconds and distributed to discord and written into database (SQlite). When I get around to it I would like to build a stand alone app to enable the information to be compiled in a place where I won't have to worry about discord blocking my messages(From to many being sent at one time). It'll be useful for research purposes but also building a self learning automated bot in the long run.
I have had great success so far, so I am just trying to improve my workflow, decrease the number of apps I use, and overall time spent looking through multiple websites to gather information.
-First, is one language faster than another for getting information processed and distributed?
-Seconds, Is there one language that would integrate better with SQlite?
-Last, When building the database for SQlite, Is their any recommended guidlines or tips that could help improve this project?
I am open to any and all suggestions, comments, concerns, you name it. I love to learn and you won't hurt my feelings.
Thank you so much!
1
u/Sad_Pudding2357 2d ago
if speed's truly the make-or-break thing and you're talking real time trading data, go or rust will run circles around python for raw processing, python's fine for gluing parts together but the moment you need microsecond precision it starts sweating
for sqlite integration they're all basically fine since it's just a c library under the hood, but go and python have the most painless driver setups in my experience
and for the database itself, keep your writes batched where possible, single inserts in a tight loop will murder your throughput no matter which language you pick
1
u/dmazzoni 2d ago
Yes, some languages are faster than others. Read up on interpreted vs compiled languages to get an idea of why. There's a lot of nuance to it - it's certainly not as simple as "compiled = fast, interpreted = slow", but it's an okay first approximation.
Most important, though, is to understand where the bottlenecks are. The differences between languages only apply to pure computation on your cpu.
Sending a message to discord will take hundreds of milliseconds. If that's part of the total time you're trying to optimize, switching languages won't help. You can't magically speed up the Internet.
Even a slow-ish language like Python can do hundreds of math operations in one millisecond. If you're only doing a few hundred operations, there's no point in switching to a "faster" language.
As an exercise: rather than thinking of it in terms of "everything should be as fast as possible", can you break it down into several independent steps? Perhaps some pieces should be fast (writing to the DB) while others should be "within a few second" like posting to Discord.
1
1
u/Schrodi-O-Ao 2d ago edited 2d ago
My advice is to keep using Python.
It is readable, has a large community and ecosystem behind it, and for what you describe, it will not obstruct you. Switch only if performance proves to be the actual bottleneck.
but only with the help of Claude.
One addendum: make sure you understand the code it generates. Using it for help is fine, but ask it to explain concepts, and to walk through non-obvious lines and how the pieces connect.
It might also help to take a pen and paper, sketch out how you want the application to work, and write the logic in plain English before jumping into the code. It'll make it easier to break the project into smaller, manageable pieces and understand what you're actually trying to build. Otherwise, you'll get overwhelmed by how much you don't know and how many assumptions you're constantly making on the spot (or Claude is making for you). Try to identify those assumptions upfront so that you remain confused about only one thing: what you're trying to actually learn.
Knowing what you want in concrete terms makes it easier to search for what you need exactly.
First, is one language faster than another for getting information processed and distributed?
It depends on the task. A CPU-bound task favors compiled languages like the ones you mentioned.
A bot's workload is mostly I/O, though, time spent waiting on the network or the disk. Waiting costs the same in any language, so what matters is how the operations are structured. That gap is one of technique, not one of tooling.
You will have to learn it regardless of language, though some languages might make it easier I think, but the foundations are worth building either way.
Second, is there one language that would integrate better with SQLite?
Python is probably the easiest route, though I cannot rule out that something is easier. The sqlite3 module ships in the standard library, so nothing needs installing or configuring before you start writing code.
Last, when building the database for SQLite, are there any recommended guidelines or tips that could help improve this project?
Start with transactions, indexes, parameterized queries, and how SQLite handles concurrent writes.
If you happen to dislike yourself and/or are willing to push through material that isn't suited for beginners, go ahead and read the documentation (I strongly advise against it, but it's an option, so exercise that free will however you see fit).
The thing to worry about is Discord's rate limit. That will become a problem long before language bottlenecks do.
1
u/B0mbon 2d ago
Short version: for this kind of project the language matters less than where the time actually goes. Anything you'd run on your own machine (Python, Go, C#, Rust) can process and write a small record to SQLite in a tiny fraction of a second. The slow part is almost always the network: calling an API and posting to Discord takes far longer than the code around it, so a faster language won't change much there.
So I'd pick based on what you can write and debug comfortably. Python is a fine choice to get it working, and Go is a good next step if you later want a long running service that handles lots of things at once. Rust and C++ are worth it for heavy computation, but they're a steep learning curve and probably overkill here.
For the Discord limits, put a queue in the middle: your code pushes messages onto it, and one worker sends them out at a safe pace, merging several updates into one message when possible. For SQLite: use indexes on the columns you search by, store timestamps in one consistent format, and write in batches inside a transaction instead of one insert at a time. Measure before optimizing, a simple timer around each step will show you where the delay really is.
1
u/JGhostThing 2d ago
I would continue to learn python. However, while you are learning, I suggest not generating code with AI. At all. AI can stop the learning process.
Python is not the fastest language, it is interpreted. However, many of the libraries are built with c or c++, which makes using them faster than traditional python. I wouldn't worry about speed until you run into problems. One of the great lights of CS once said, "Premature optimization is the root of all evil." This doesn't mean that optimization is evil, just that you need to know where and what to optimize, typically through profiling.
1
u/betarage 2d ago
I think go or c sharp have a good combination of performance and ease of use. with python you will notice the slowness with c++ and rust it takes a while to learn how to use its full potential
1
u/FreeLogicGate 6h ago
I am glad you purport to have a thick skin, so I'll try to answer your questions, as a long time professional programmer who often tries to advise those learning how to program.
I have succesfully coded a working webhook for discord and plan on getting some more stuff sent into it but only with the help of Claude. I believe it was written in python
Right, so you have not successfully coded anything. You used Claude to spit out some code, that apparently does what you wanted it to do, and yet you don't even know what language the code was written in.
Time is critical and every second counts.
Word to the wise, but people who actually know how to program, and help others like yourself for free, don't care about your time frames or the urgency of what you think you need. If you need software developed for you by people who do know what they're doing, and you need it within a timeframe, then that's why people pay developers.
so information that needs to be passed through in miliseconds and distributed to discord and written into database (SQlite).
Based on what I can surmise about your day trading niche, and the fact that you're using discord for some sort of communication, this is a naive assertion. I'm going to just assume that what you really mean is that you want whatever information or data you are accumulating to be processed and turned into alerts as soon as possible. Any distributed internet centric application that makes use of a 3rd party platform like Discord will be constrained by network speeds, routes, etc. I will say in general, that it sounds like a typical ingestion and enterprise queueing application. In other words, your source data should be processed and queued, and from there communication with Discord or any other communication method can be seperated from persisting data. SQLite is a database engine and not a relational database, which might be something that limits future scalability.
There are a lot of different options for queuing, including cloud services like aws sqs, but Kafka and RabbitMQ are two that are often used as core components. You might also be able to build the queueing on top of Redis, and if the data stream is relatively minimal and just for your personal application, it's probably well worth considering.
First, is one language faster than another for getting information processed and distributed?
Depends on the information, depends on the processing, depends on the bottlenecks.
Seconds, Is there one language that would integrate better with SQlite?
Generally speaking, it doesn't matter, because languages are going to use the sqlite client library to talk to sqllite. You're going to be using sql statements, and those statements have to be created within the client application, ostensibly based on some ingestion of data. Someone trying to understand it better, would need to understand the data, and how it might need to be transformed. This is one of the reasons to use a queue -- to separate and make the communication and database storage process asynchronous.
Last, When building the database for SQlite, Is their any recommended guidlines or tips that could help improve this project?
In general, understanding the basic rules of relational database design, and what makes for a well designed database vs one that's poorly designed, and not easily capable of producing the results you desire.
So -- probably, the language that makes the most sense to look at, would be Go. This is because Go was specifically designed to be low syntax, "cloud native" cross platform compiled language platform, with intrinsic support for concurrency and interprocess communication. Compared to a lot of other languages, it is possible for someone who doesn't have prior programming experience to learn the language, without the standard amount of computer science background that most programmers need. It was created by some of the giants of modern computer programming, specifically for Google to use for their data processing infrastructure.
With that said, considering where you are starting from, you have a long road ahead of you, but then again everyone starts somewhere.
2
u/AbyssShriekEnjoyer 2d ago
Any is fine. Programming is about concepts more than it is about specific languages.