how basic programming concepts translate in real software?

What really happens when you try? Where do you get stuck?

simply not able to write a program that do what i want till the end

Also, what is your background?

student


Hard to answer such generic questions except with a lot of hand waving.

alot of people said the same about my questions and i am trying to improve how i ask questions , thanks for feedback
 
I would advise you to stop asking questions now and just proceed.
As others have suggested, write a program in some language that prints "Hello, world!". Until you can do that you're only talking about programming and not doing.
Forget about what you said you wanted to do earlier. You don't have the knowledge or skill for that yet. Print "Hello, world!" and then come back.
And show your work!
 
I would advise you to stop asking questions now and just proceed.

i did already multiple times and today!


1788975946261.png

And show your work!

i will for sure when i have something to show!
 
simply not able to write a program that do what i want till the end
How difficult it is depends on what you want and what language you use.

If you want to do calculations, with C is easy and efficient. It is a program that run once and do the calculations you need.

If you must deal with strings, for example for a cgi script in the web, then it will be a little more difficult in C, you will have to deal with memory management. Better a language that do it automatically like LISP or tcl.

If you want to write an "application" with a GUI, something that looks like a commercial piece of software, it will be much more difficult in C, but you can use tk together with tcl.

And would you program a database in C? For that is SQL, and you can use sqlite3 to bind it to C or tcl programs that ask the db.
 
1) I apologize for talking before (2nd time) without being aware about the point the conversation was in. I'm still me.

2) OP, why don't you use an AI as a teacher. Tell it: I want to learn to do this step by step using this language (or maybe it can recommend you the language). Then tell it, step 1, go. And so on. And you'll learn with a teacher. And you can ask it questions.
 
If I were the OP, I'd be scared at this point, to be frank. Thankfully, I provided the only truth he needs to know, very well explained, and in very few words.
Sure. You did.
By what you say (and I do believe you) you are a long year experienced professional programmer.
What you said ain't wrong. In contrary, it's right.
You summarized it all to the most abstraction level imaginable. The latter one is my point.
Most briefly ain't always the best way to explain things.
Point is:
If one knows, what programming is all about, one can understand what you said. And it's right and true. I am 100% with you. But if sombeody is completely new to the game, I doubt this person can break it down to understand it, and get something useful from it, know where to start.
Actually you answered the thread's question - brief and to the point exactly.
While others, like me, believe to see, the actual question was, 'How to start with programming.'
But I grant you that I'm mistaken.
 
Sure. You did.
By what you say (and I do believe you) you are a long year experienced professional programmer.
What you said ain't wrong. In contrary, it's right.
You summarized it all to the most abstraction level imaginable. The latter one is my point.
Most briefly ain't always the best was to explain things.
Point is:
If one knows, what programming is all about, one can understand what you said. And it's right and true. I am 100% with you. But if sombeody is completely new to the game, I doubt this person can break it down to understand it, and get something useful from it, know where to start.
Actually you answered the thread's question - brief and to the point exactly.
While others, like me, believe to see, the actual question was, 'How to start with programming.'
But I grant you that I'm mistaken.

I already apologized, Maturin, for talking without reading. My second post was stupid.
 
2) OP, why don't you use an AI as a teacher. Tell it: I want to learn to do this step by step using this language (or maybe it can recommend you the language). Then tell it, step 1, go. And so on. And you'll learn with a teacher. And you can ask it questions.
i use it but as low as i can
maybe because AI will steal few important things including but not limited to ability to search for example , because you ask ai and get answer without search effort
 
I would advise you to stop asking questions now and just proceed.
As others have suggested, write a program in some language that prints "Hello, world!". Until you can do that you're only talking about programming and not doing.
Forget about what you said you wanted to do earlier. You don't have the knowledge or skill for that yet. Print "Hello, world!" and then come back.
And show your work!
THIS
 
because you ask ai and get answer without search effort
No need to search, look:

 
simply not able to write a program that do what i want till the end
The way to get "there" is by "divide and conquer" - keep dividing the problem you're solving in smaller and smaller pieces until you know how to program each small piece. But that too is a skill and reading small programs can help you see how others structured the program - what are the pieces and how they are put together, what library functions are used etc. For example, read the man page for some programs in /bin or /usr/bin and then read its code and try to understand how it was structured.

Concurrently I would recommend using an interpretive language like python or scheme or common lisp and experiment building things up bit by bit and test the results at every stage. Don't worry about performance when you're learning. For example, try write a program like "wc" or "cut" or "ls" etc as you read the code of such programs in /bin,/usr/bin etc.

You can pick toy programs in your major field of study to experiment.

a lot of people said the same about my questions and i am trying to improve how i ask questions , thanks for feedback
Yes, asking the questions that elicit better answers is a skill worth improving.
 
Start simpler, it just means that whatever you wanted to do is a bit too far out of reach for now. Maybe a simple game? A number guessing game, let the program pick a random number and you have to guess that number. Computer can only give you a hint your guess is lower or higher than what it picked.


thanks for suggestion , this is what i did and i can say it is my first program i do (if we exclude hello world) in my life without tutorials!

if anyone has suggestion for simple programs i can do for learning purpose , feel free to suggest them
 

Attachments

if anyone has suggestion for simple programs i can do for learning purpose , feel free to suggest them
Yeah, it seems your core point is to find excersizes.
As others suggested, find some yourself, which, I agree by own experience, quickly leads to tasks which are way too advanced for the level one is at, while one later figures out had better focused at learning some fundamentals better, first.

As it seems you decided for starting with C. In this case again I can recommend the KR (There are PDF versions on the internet. But I can neither tell if those are legal, nor if they are identical with the printed copy, which you can get used for a few bucks.)
To every chapter the book offers exercises exactly to the level it is. You begin with writing a simple degree celsius to fahrenheit converter, then line- and wordcounters, learn btw this way how to do first simple things on files, and continue becoming more and more advanced until you write a whole calculator program.

The solutions are not part of the book, since it's also part of learning to program, that there is not the only true solution, but many ways lead to the target.
Anyway you'll find easily lots of solutions by others on the internet, which you may take a peek at to get ideas, when you stuck.

Other books also for other languages as also online tutorials also provide such.

Anyway, if you want some ideas:
Since you already started using the random generator
write a dice program like I did on a vacation, when my wife and I wanted to play a board game, but had no dice:
screenshot_20260910_11:06:44.JPG

It also come with some silly gadget: the dice are flashing randomly numbers until the result is shown.
You may add the program some options, like how many dice to use.
You already see, one way to get programming tasks is to improve a program, add functions, features.

A famous programming exercise in programming classes is to write a hangman game.

Now I need to stop. Otherwise Alain complains I'm not writing single-line- or better one-word-statements. 😁
 
how basic programming concepts translate in real software?
Not in an easy way, for real projects.

Design Patterns documents good solutions to recurring design problems.

The Architecture of Open Source Applications documents the design used from many famous OSS projects.

These solutions depends also from the paradigm used from the programming language and/or its run-time behavior.

In any case, your question, put to the extreme, is like finding the relation between English grammar rules and writing a good novel.
 
if anyone has suggestion for simple programs i can do for learning purpose , feel free to suggest them
When I started out, I enjoyed rendering simple geometric shapes without using off-the-shelf functions; it involves a bit of math and programming. Squares, rectangles, triangles, and circles; of course it was simpler in BASIC because it provides access to a graphics window, whereas in C it is more complicated and requires calling an external library.

The next step is to write a program that does not know in advance which shape or dimensions to draw. Whether reading from the command line or a file, this involves learning how to validate user input, implement testing and error handling, and manipulate strings and files.

Other fun little programs involve encrypting text files: you read a file -> perform a simple operation like XOR ->write the result to a file. You can start small and go very far in the field of cryptography.
 
Deciding what the program will do and how without writing code.
Many, many years ago, when I was still attending school, we had to create a flowchart (or Nassi–Shneiderman diagram) before typing a single letter of code. I still do this[*], it definitely helps to get some semblance of structure, especially when tackling more complex problems.

[*] Unless it's a really short program, or a design structure I've used a million times before.
 
Many, many years ago, when I was still attending school, we had to create a flowchart (or Nassi–Shneiderman diagram) before typing a single letter of code. I still do this[*], it definitely helps to get some semblance of structure, especially when tackling more complex problems.

[*] Unless it's a really short program, or a design structure I've used a million times before.
we did these for a year in high school before learning our first programming language (which was assembly form mainframe :))
Code:
             (start)
                |
        \--------------/
         \   read a b /
          \----------/
                |
               /\
         no   /  \  yes
     -------- a > b----|
     |        \  /     |
     |         \/      |
  -----------          |
  | max = b |      ---------
  -----------      |max = a|
      |            ---------
      |---------------|
             |
             |
         / -------------\
        /    write max   \
        ------------------
                |
              (stop)
 
Other fun little programs involve encrypting text files: you read a file -> perform a simple operation like XOR ->write the result to a file. You can start small and go very far in the field of cryptography.
Ah, the good old XOR "encryption". Another favorite, and simple enough to implement, is ROT13 😁
 
Now comes the hard part. Planning and structuring for the next program. Deciding what the program will do and how without writing code.
i think SirDice provided a good hint how to do it , i know flowcharts already but i do not use them so i think i need to change this
Not bad for first program! Formatting could be improved, but that's more a style issue than a programming one.
saying this style issues will help me


i did another program (tic tac toe game) and there is alot of space to improve but it works atleast (making players able to choose what letter they want and not hard coding things like all win conditions and how to draw) and hardcoding count too so other than this any feedback is welcome


also how i can do copy or paste from vim and autocomplete (i found some help online on this but i think way they suggest is weird at best)
As it seems you decided for starting with C. In this case again I can recommend the KR (There are PDF versions on the internet. But I can neither tell if those are legal, nor if they are identical with the printed copy, which you can get used for a few bucks.)

i have access to oreilly so i can access it but quick web search show that some universities host it on their websites for free so i think it is legal to just get PDF from them (i can not say for sure)
 

Attachments

saying this style issues will help me
I'll provide an example.

Code:
if ( myvalue == something ) {
  printf("Hurray!\n");
} else {
  printf("Not the same\n");
}

Notice how the printf lines within the if .. else .. are neatly indented? Doesn't change how the program works (it will if it was Python!), it's more a visual cue for the person looking at your code. It simply makes it a bit easier to read. For a single line it won't matter much, it will be more clear when the sections in between get larger.

There's also another way to do this, and can be a very hot stylistic topic:
Code:
if ( myvalue == something )
{
  printf("Hurray!\n");
} 
else 
{
  printf("Not the same\n");
}
Same code, different style guide. I personally use the first but I've seen style guides that want the second form. For your own personal projects it's not going to matter, as long as you stay consistent.

Add another indentation for each block, for example:
Code:
do {
  if ( myvalue == something ) {
    printf("Hurray!\n");
   } else {
    printf("Not the same\n");
} while(1);

how i can do copy or paste from vim and autocomplete
In vim (not vi!) you can use SHIFT-V to block select whole lines. Then press 'y' (yank) (or 'd' for delete; copy vs. cut) to copy it in the buffer, press 'p' (paste) to paste that buffer below your current cursor position, or 'P' to paste it above the cursor.

Autocomplete is bit trickier with vim, you're going to need to set up some plugins for that.
 
Back
Top