Question Why do I keep reading that learning/understanding C language first will make you a better programmer?

vowew

Member
Joined
Dec 15, 2023
Messages
7
Programming Experience
Beginner
Hi,
I want to understand why I keep reading this idea or concept constantly.
I want to know the logic of that idea.
If anyone used C, C++, and C# to clear that for me, that would be awesome.
Another issue is that I keep reading that learning a language without object-oriented programming like C and then moving to an object-oriented programming language like C# will let you understand object-oriented programming better.
Again, I am not comparing or starting a language war, but I want to understand the logic behind that idea.
Thanks a lot for your valuable time helping me.
 
Solution
Another issue is that I keep reading that learning a language without object-oriented programming like C and then moving to an object-oriented programming language like C# will let you understand object-oriented programming better.

I actually disagree with this statement. In my opinion, it will actually hinder your progress in learning object oriented programming, because you will want to back to doing things the procedural way, rather than the object oriented way if under time pressure or just "want to get things done to focus on more interesting stuff". This is very much like wanting to do things the procedural or object oriented way when learning to use a functional language instead of the doing things the functional way, or...
It depends on whether a person prefers C. If they prefer it then they are likely to say it is better to learn it first. If they do not prefer it then they are less likely to say it is better to learn it first. I cannot think of a reason why learning C first would make a difference. I think you will get better answers if you can be specific about what the people say are the advantages.

I began learning programming half a century ago. A little Fortran then COBOL. I have since learned C, C++ and C#. Therefore I do not know what it is like to learn an OOP language first. When a language is capable of OOP we are not required to use OOP in the programs we develop using the language.
 
My opinion:

If the argument behind learning C first because it's better to learn a procedural language first due to people compare writing a program to like writing the instructions of a recipe, then the counter argument is why not a procedural language that is much safer and more forgiving like Logo, BASIC, COBOL, or Pascal?

If the argument behind learning C first is because it's "closer to the metal" and therefore a lot less magic is happening forcing you to learn not only how to program, but also to also understand how the operating system's, networking, filesystems, processes, threads, etc. works, then the counter argument is why not learn assembly language first which would also force you to learn the same things as well?

If the argument behind learning C first is because sooner or later you will need to interface with other libraries and more often than not, that library will have a C language binding, then the counter argument is why not wait until that time that you need to interoperate with another library? Do you really need to learn C, or just learn how to read C function signatures?



I think you will get better answers if you can be specific about what the people say are the advantages.
+100!
 
Thanks a lot for your replies.
It is just that I am a newbie, and after starting my journey to learn C#, I found a lot of articles regarding this issue, raising the question for me.
I think being a newbie put me in a situation of doubt.
I began learning programming half a century ago. A little Fortran then COBOL. I have since learned C, C++ and C#. Therefore I do not know what it is like to learn an OOP language first. When a language is capable of OOP we are not required to use OOP in the programs we develop using the language.
If I may ask, if you restarted your journey once again, what would you do?
Your reply forwarded me in a new direction indeed.
So, if you are restarting now with your previous cumulative experience, what would you do? What would you learn first, second...etc.
And what would be your advice to be a better programmer in the long run?

Note: Sorry if I changed the topic, but I think guys like you and the members around the forum with such experience can save us a lot of time and effort towards what to do, which is a lifesaver.
 
Another issue is that I keep reading that learning a language without object-oriented programming like C and then moving to an object-oriented programming language like C# will let you understand object-oriented programming better.

I actually disagree with this statement. In my opinion, it will actually hinder your progress in learning object oriented programming, because you will want to back to doing things the procedural way, rather than the object oriented way if under time pressure or just "want to get things done to focus on more interesting stuff". This is very much like wanting to do things the procedural or object oriented way when learning to use a functional language instead of the doing things the functional way, or doing things the WinForms way even when using WPF or MAUI.

What learning C before learning C++ will do is let you focus on climbing the object oriented learning curve instead of climbing the syntax learning curve, and the object oriented learning curve at the same time. Others will counter, thought, that despite all the messages passing that happens in object oriented programming, eventually the message will be passed to chunk of code that needs to be written in procedural form.

But learning C before learning Java, C#, Python, Ruby, or Smalltalk will not.

The cynical part of me will say that learning C will make you a better programmer in general because you will (painfully) learn to pay attention to detail because the smallest mistake can lead to undefined behavior; learn how to read error messages and warnings because the compiler is trying to tell you something is wrong but may not tell you outright what it is; and learn how to read the documentation because traditional C libraries name functions and parameters tersely.

Additionally, if you they insist that you need to learn C because it will make you a better programmer, you should also learn how to use C use without an IDE. Just command line, a text editor, the compiler, the linker, and a traditional build tool like make (none of these fancy new build tools) because you also need to learn how to use the command line, and how to batch builds using shell scripts or make. And if you are lucky you might have a debugger. :)
 
Last edited:
Solution
What learning C better learning C++ will do is let you focus on climbing the object oriented learning curve instead of climbing the syntax learning curve, and the object oriented learning curve at the same time. Others will counter, thought, that despite all the messages passing that happens in object oriented programming, eventually the message will be passed to chunk of code that needs to be written in procedural form.
This is one of the best and most straightforward things I've ever read since learning to program.
Also, I genuinely doubted whether to start the C 1st.
My friend, you rule all these issues.
Now I clearly understand that I should go for an Object-oriented language.
Last question: Is starting with C++ and then moving to C# recommended? or go to C# directly?
 
Sorry I added more stuff to post #5. My phone cached the old pages and didn't show me that there were updates and replies.
 
I recommend going straight into C# (or Java or C++) directly, but limit yourself to console programs only without any databases -- just flat files. Then next explore using a GUI once you are familiar with the language. After a few months of using a GUI venture into databases, but avoid ORMs until you understand general database interaction, and also realize the drudgery of the object-relational impedance mismatch. Then either choose to use an ORM or go down the NoSQL path. After that then explore web based apps.
 
  • I recommend going straight into C# (or Java or C++) directly,
OK.
  • but limit yourself to console programs only without any databases -- just flat files.
OK.
  • Then next explore using a GUI once you are familiar with the language.
By GUI, do you mean the IDE?
  • After a few months of using a GUI venture into databases, but avoid ORMs until you understand general database interaction,
I do not understand this part well. Do you mean to learn the database first? Like learning Microsoft Access?
What are ORMs? I googled it, and if I am correct, I think you mean Object-relational mapping (ORM), but I could not fully understand it.
  • and also realize the drudgery of the object-relational impedance mismatch.
I have no clue what it is. Do you mean to understand what is object-oriented programming?
  • Then either choose to use an ORM or go down the NoSQL path.
Please excuse my ignorance. If your time allows, give me more details now or after a while; that would be awesome.
  • After that then explore web based apps.
Do you mean to develop web-based applications with Visual Studio?

Important notice:
Would you believe me if I told you what I've learned from this thread members' replies are more worthy than many Google searches!
I am very thankful that such a forum exists. Thanks a lot.
 
If I may ask, if you restarted your journey once again, what would you do?
As has been said, console programs are a good way to start. With console programs we can learn the language with less additional coding for a GUI. GUI means Graphical User Interface. Console programs have interfaces but the interface is only text. An IDE is an Integrated Development Environment. They use a GUI but GUIs and IDEs are different.

Last question: Is starting with C++ and then moving to C# recommended? or go to C# directly?
This is a matter of personal opinion. In my opinion I benefited from learning C++ first because I learned how to dispose of objects. In C++ we create new objects (objects are allocations of classes) and we dispose (destroy) them when we are done. C# programmers usually do not need to dispose of objects, C# has a garbage collector. C# programmers inexperienced with C++ think it is foolish to have to dispose of objects.
 
I recommend C#, C++ and Java but not PHP, JavaScript and Python. Sometimes we must use JavaScript a little bit at least. The original designer of PHP was not a specialist in computer languages, he even said that he did not consider PHP to be a computer language. The language was not designed by a computer language expert and Python has idiosyncrasies too.

When beginning and using console programs, in my opinion, it would be worthwhile to learn about databases too. You can start without an ORM but note that for a job it is highly likely that an employer would use an ORM. An ORM does much of the tedious work necessary to use a database. It takes more time to learn an ORM but it saves time after that and therefore an employer will want you to use one. As a beginner much of the ORM part might be done by someone else. You can wait a few years to learn about databases or you can learn about them as soon as you want to. Databases can be more complicated than most people realize and knowledge of them is useful and is marketable. There are books that explain database use, some are independent of computer languages other than SQL or a language such as SQL.

When you are ready to learn about creating websites, I suggest first learning HTML and CSS only and probably JavaScript. For JavaScript, however, there is something called WebAssembly that makes it possible to use most any computer language in a website, browser-side. WebAssembly is becoming more useful and more used. Microsoft has already made it possible to use C# in a browser using WebAssembly. It is possible to get websites that have just HTML, CSS, JavaScript and images hosted for free, just pay the annual fee for the domain name registration.

If someone says it is necessary to learn a low-level language such as C or machine (assembly) language first because we must understand the low-level stuff first then ask them if they understood how their body works before they used it.
 
By GUI, do you mean the IDE?
He means starting with just creating Console apps and then graduating to GUI apps, i.e. Windows Forms and/or WPF apps.
I do not understand this part well. Do you mean to learn the database first? Like learning Microsoft Access?
What are ORMs? I googled it, and if I am correct, I think you mean Object-relational mapping (ORM), but I could not fully understand it.
When .NET started out, everyone used ADO.NET - we'll ignore those who insisted on sticking with pre-.NET technologies like ADO. That meant, for example, using types from the System.Data.SqlClient namespace for interacting with SQL Server databases. Various ORM tools were created later on, often ported from Java, and Microsoft created their own with Entity Framework. We use EF pretty much all the time in my office but I benefitted from learning ADO.NET first because I understand what's happening under the hood of EF and how to handle the exotic scenarios. Note that EF and other ORMs generally use ADO.NET under the hood.
I have no clue what it is. Do you mean to understand what is object-oriented programming?
He basically means the task of mapping from database types to application types. ORMs will often handle this for you but there are various gotchas that you need to be aware of. If you use ADO.NET, you have to either work with DataTables in your application code, which has it's own set of issues, or map the data coming from the database to your application types and back again. It's a painful but necessary step in all aplications backed by a database.
Do you mean to develop web-based applications with Visual Studio?
Yes. Create Console apps first, then Windows GUI apps, then web apps.
 
In my opinion, it is personal preference whether to learn about databases sooner or later and whether to learn about websites sooner or later and whether to learn about GUI programming sooner or later.

The advantage of Windows Forms is that they correspond more directly with native Windows. You are not as close to the Windows API as you would be if you did not use a managed library (in other words, .Net) but Windows Forms is closer than any other way to use C# for a GUI application. The disadvantage of Windows Forms is that Microsoft does not want you to use it. Microsoft supports Windows Forms except they are not likely to improve it. A beginner would benefit from learning Windows Forms but there is very much to learn and if a beginner wanted to prioritize other things then that could work. It is a matter of priorities.
 
The reason why I suggested WinForms after console is because in variably people want to create a GUI program, and (currently) WinForms provides the shallowest learning curve and there is an abundance of learning material available. It is also a soft introduction into thinking in terms of events driven programming instead of the linear/procedural way of thinking for (beginner) console programs. (Yes, console programs can also be written as event driven.)

Also, it is the best soft introduction into dealing with the Windows API. Just like the C proponents say that you must learn C because it forces you to learn how the OS works and how to call OS level APIs, the same is true for WinForms when the developer eventually wants to go beyond what is "in the box" functionality.

It is true that WinForms is a dead end technology. In fact I was celebrating its impending death, until MS changed course and saved it from the grave by incorporating it into .NET Core 3.1. *sigh*
 
Yes there are advantages to learning Windows Forms. Perhaps a beginner could learn the basics with it. When they are ready to do advanced stuff it might be better to switch to something else.

As for console programs being event-driven, vowew has no idea what we are talking about. As for a message loop in a console program, I have been unable to get most Windows messages to be processed in a message loop in console programs. Other than that, sure, it is possible to keep a console application executing and responding to other events. Beginners do not need to do that.
 

Latest posts

Back
Top Bottom