does anyone have exercises to learn how to program?
from Zero1534@lemmy.world to programming@programming.dev on 27 Apr 21:12
https://lemmy.world/post/46140479

hi, I’m trying to learn to program on C and C++. My goal is to get to do applications for a phone with symbian that I have to make it more useful. I already have an idea what I want to do. Mainly make a browser for smolnet protocols (nex, gopher, Spartan, finger, etc.) and more in the future make some social network customers open code. The easiest I think it would be to make a mastodon client, especially because mastodon already works on my nokia with symbian, thanks to brutaldon (although I feel that it lacks functionalities that I would like to have, like to see what is inside the instance and see at the level of fedverse). and perhaps others like “lemmy,” “social gnu,” “friendica,” and already finally and my “Magnus opus” would definitely be, a client of “invidious”.

of course all this is far beyond my current possibilities. But that’s why I want to step up. For the moment I base it on the syntax on c and c++ and I already understand the operators, and also the comparisons and the Boolean operations. I also partially understand the pointers… but I really don’t know what kind of use they have. so that the applications you create, you can test them in my system with linux, I need to program everything in c, and use c++ but only in a basic way the latter, as symbian only supports old versions of c++ posix, (it’s true that if I install qt supports more modern versions and it would be much easier to do anything. But I have been recommended not to use it) I have also been a little interested in zig and nim, as they compile C and theoretically should be languages that could work perfectly, but on the other hand, also increase the number of languages to learn may not be the best idea at the moment.

for the subject of graphics, I think the best option is to use sdl, there is a port of sdl 1.2, the problem is that in my language there are practically no sdl 1.2 tutorials, and in English I have found little. This is the best thing I could find “lazyfoo.net/SDL_tutorials/” is not that this evil (in fact I have not yet tried it) but well, I would also like to know, that so much changes the syntax against sdl 2, I just want to do simple things, buttons, menus, text boxes and already, I ask this to see if I can make the work easier and just see tutorials in my language and not eat so much my head asking anyone to translate me all by one.

i initially thought about using sdl interface library to make life easier. But I quickly realized the problem that most of these library are designed for the use of mice, something that in my nokia n95 because of course there is no… microui was the library that had convinced me most, plus that it not only depends on sdl, it can also use opengl, and a friend explained to me that maybe and even could serve with the native interface library of symbian. I’m sure he’ll save it for future projects. But for things like his little documentation and it’s not even spoken in my language, and I thought of everything, less intuitive. Because it makes me leave it at least for the moment, I also saw others like raygui, but that would be my turn to make a bridge, and while I can do this with vibeconding and so… well, the truth is I’d like to be able to understand my own code… I don’t rule it out completely… But having to adapt so many things, the truth is I think it’s more cost-effective just to use pure sdl and stop making life difficult.

There is also the option to use an old version of opengl en. But I think that’s a little bit of killing fly-to-gun, total, I just need a 2d, minimalist interface and little more… I don’t know if there are any other library that allow me to do graphic interfaces, and that being written in pure C can be carried automatically, without modifications, I understand that there may be a remote possibility that lvgl will work, but… I don’t think it’s worth it.

So, well… this is all to ask for recommendations and programming exercises on c, c++ and sdl.

#programming

threaded - newest

litchralee@sh.itjust.works on 27 Apr 21:24 next collapse

For pointers in particular, this seems like a good starting point: sites.cs.ucsb.edu/~mikec/cs16/…/pointers.htm

As for compiling for old C/C++ versions, fortunately most compilers can be set to restrict what standard they will compile for. So you could turn the compiler all the way back to something like C99 and it should work, although you’ll have to avoid using modern syntax.

That said, with regards to compiling for an old platform, be advised that complete and functional toolchains will be harder to come across. They may not even work anymore, if they haven’t been upkept. That’s another complexity that you may have to deal with, and it will no doubt be aggravating, than working with a modern platform but limiting yourself to only older C/C++ standards and graphics libraries.

Basically, the starting effort is quite high for developing for older targets. Be certain that this is the direction you want to start with.

Zero1534@lemmy.world on 28 Apr 09:15 collapse

For pointers in particular, this seems like a good starting point: sites.cs.ucsb.edu/~mikec/cs16/…/pointers.htm

As for compiling for old C/C++ versions, fortunately most compilers can be set to restrict what standard they will compile for. So you could turn the compiler all the way back to something like C99 and it should work, although you’ll have to avoid using modern syntax.

That said, with regards to compiling for an old platform, be advised that complete and functional toolchains will be harder to come across. They may not even work anymore, if they haven’t been upkept. That’s another complexity that you may have to deal with, and it will no doubt be aggravating, than working with a modern platform but limiting yourself to only older C/C++ standards and graphics libraries.

Basically, the starting effort is quite high for developing for older targets. Be certain that this is the direction you want to start with.

I’ll take a look later.

As for the compiler… well, someone has already passed me tools to program in symbian, and they seem to work well, there are more people in symbian than it seems at first. Not too many people, though.

troed@fedia.io on 27 Apr 21:28 next collapse

ex-Symbian employee/developer here:

Symbian/Epoc C++ is vastly different from modern C++. Enjoy yourself, as long as you are ok with learning a "dead" eco system where a lot of the things you learn aren't useful on other more modern platforms.

Zero1534@lemmy.world on 28 Apr 09:08 collapse

hey, yeah, I’m sorry about that. I’m a fan of obsolete devices, how do you think I get to Symbian in the first place?

I’m aware of how different c + + of c + + symbian is, which I try in most cases only to resort to “apps.”

Do you have any advice from that time? I mean, how do you not do this structure that usually leads to crasheos, or use this graphic library, that I know.

troed@fedia.io on 28 Apr 09:13 collapse

Best I can do is just point to source code written by an old colleague and friend of mine from back in the day: https://sourceforge.net/p/qbubblemp/code/HEAD/tree/

I wrote system apps and UI frameworks and it's 25 years ago so I don't want to pretend to remember too much :D

Zero1534@lemmy.world on 28 Apr 14:21 collapse

Best I can do is just point to source code written by an old colleague and friend of mine from back in the day: sourceforge.net/p/qbubblemp/code/HEAD/tree/

I wrote system apps and UI frameworks and it’s 25 years ago so I don’t want to pretend to remember too much :D

okay, thank you so much, i’ll take a look at it and see if i can do anything with it, if the answer is yes, i’ll show you what i get.

insomniac_lemon@lemmy.cafe on 27 Apr 21:38 next collapse

I’m of the mind that it’s probably better to start out with engines/frameworks to get your footing before you move on to lower-level stuff. Then again, I’m not very far either (and sort of stalled for a few reasons).

Godot might be a good avenue with GDextension (GDnative for 3.X), particularly with C/C++. Nim bindings exist (and this is my language of choice) but if you like C/C++ it will certainly have a lot less friction and with those you probably can get far with just the official docs. For C++, you could probably edit the engine itself especially for older versions.

Raylib is another option (and you will likely do a lot more boilerplate stuff) for pretty much any language. And again, with C/C++ it will likely be even more straightforward.

EDIT: Sorry, I see that you know about Raylib already. To say it more directly, I am saying it is likely better to find quick projects that you want to make on the device you’re already coding on (likely a computer) rather than trying to immediately support a specific device or dream projects. Though other low-cost devices (single-board-computers, microcontrollers) if you can get them (at/below MSRP) might be an easier way to fill that niche as well.

itsathursday@lemmy.world on 27 Apr 22:05 next collapse

Take a look at www.codedex.io/cpp it’s a great gamified way you can run through fundamentals that ramp up to more complex scenarios and bridge the gap to where you want to be

Zero1534@lemmy.world on 28 Apr 09:17 collapse

Take a look at www.codedex.io/cpp it’s a great gamified way you can run through fundamentals that ramp up to more complex scenarios and bridge the gap to where you want to be

thank you very much, i’ll take a look at it later.

bridgeenjoyer@sh.itjust.works on 27 Apr 22:45 next collapse

What a great project idea !

Zero1534@lemmy.world on 28 Apr 09:18 collapse

What, you want to join the development? It’s the same. I hope to get my nex browser soon jajaja.

entwine@programming.dev on 28 Apr 00:09 next collapse

You should start with C before going into C++. This is because C is the simplest possible language that exposes you to pointers and memory management. That’s the most important foundational skill you need in low level languages like this.

You could learn memory management using C++, but there are a lot of distractions, and the modern features designed to make memory management easier may make it harder/confusing for someone starting at the beginning.

My advice: follow a modern tutorial for C and SDL (on your PC, not that N95), and use it to make a simple game or UI with SDL’s drawing API. Actually aim to finish something (even if it sucks) and you’ll learn a lot.

Zero1534@lemmy.world on 28 Apr 09:12 collapse

You should start with C before going into C++. This is because C is the simplest possible language that exposes you to pointers and memory management. That’s the most important foundational skill you need in low level languages like this.

You could learn memory management using C++, but there are a lot of distractions, and the modern features designed to make memory management easier may make it harder/confusing for someone starting at the beginning.

My advice: follow a modern tutorial for C and SDL (on your PC, not that N95), and use it to make a simple game or UI with SDL’s drawing API. Actually aim to finish something (even if it sucks) and you’ll learn a lot.

thank you very much for the advice. The book I use to learn teaches C and C + + at the same time. See what I can do with the pointers.

So, modern sdl doesn’t change much of sdl 1.2? Because if that’s the case I’m trying to use some sdl 2 tutorial, by proximity, I think there’s more of this in my language.

entwine@programming.dev on 28 Apr 13:00 collapse

modern sdl doesn’t change much of sdl 1.2?

I’'ve only ever used sdl 2 and 3, but I’ve encountered 1.2 code in the wild. APIs are going to be different, but big picture stuff is mostly similar. If you learn how to use one version, it shouldn’t be too difficult to switch.

0x1050@lemmy.world on 28 Apr 03:21 next collapse

How far along are you with data structures and algorithms?

That’ll really define the path you need to take, especially if you’re learning a low-level programming language along the way

If I know where you stand, I can give you some pointers

despaircode@lemmy.ml on 28 Apr 05:26 collapse

Harvard’s CS50 (Introduction to computer science) is available for free on edx.org. It starts with Scratch and goes on to C the second week. Excellent lectures by David Malan and lots of weekly exercises you can do and submit for review that will give you a solid foundation to build on.

Zero1534@lemmy.world on 28 Apr 14:20 collapse

Harvard’s CS50 (Introduction to computer science) is available for free on edx.org. It starts with Scratch and goes on to C the second week. Excellent lectures by David Malan and lots of weekly exercises you can do and submit for review that will give you a solid foundation to build on.

thank you very much, i’ll take a look.