Jump to content



Photo

Role of "C" programming language for a beginner?

role of c why c important for beginner why c why i should learn c before? why c prefered initially? where we are using c? advantages if i prefered c

  • Please log in to reply
57 replies to this topic

#16 Ambroos

Ambroos

    Neowinian Senior

  • Tech Issues Solved: 7
  • Joined: 16-January 06
  • Location: Belgium
  • OS: Windows 7 + 8.1
  • Phone: Sony Xperia Z2

Posted 13 May 2014 - 21:51

It all depends on what you want to learn.

 

How they do it at our computer science department is starting with basics of object-oriented programming in Java. Why Java? Because it's a very clean and strict object-oriented language that can serve as a good base for other languages.

 

At the same time another course teaches algorithmic thinking (recursion, loops, sorting, ...) using Javascript/Java (depending on the teacher). I think this is a good way to start. 

 

We also had an introduction to x86 assembler (which I really liked).

 

In my opinion there is not that much reason to know about all those deep low-level concepts right away as they might get in the way of good design at first. Getting the right OO principles in from the start makes you think about maintainable, clear, concise code much sooner and stops you from getting used to weird workarounds.




#17 mastercoms

mastercoms

    Expert Microsoft Fanboy & C# Coder

  • Tech Issues Solved: 3
  • Joined: 21-May 13
  • Location: Marietta, Georgia
  • OS: W10 + Fedora 21
  • Phone: Lumia 928 WP8.1U1 Black

Posted 13 May 2014 - 21:56

I really think before you use a programming language, you should use a visual programming language. I know, it sounds really stupid, but it can help with learning with logic. You'll face the same programming challenges as you do with any other language except you don't have to memorize syntax. Logic. logic. logic. That's what's important. Then I would recommend a glance over Javascript, to get used to typing programming, syntax, compiler errors, etc. Then I would, as said before, build from low level, like C, to the top.



#18 simplezz

simplezz

    Neowinian Senior

  • Tech Issues Solved: 8
  • Joined: 01-February 12

Posted 13 May 2014 - 22:38

We can all give you our opinions, but that's just what they are. The only real way you're going to understand the importance of learning C is by writing programs in it.

 

As someone who primarily codes in C, its importance as a first language cannot be overstated. Yes, that's right, I said first language. Some might argue that higher level languages are easier for a beginner, and I can tell you right now that's wrong. Higher level languages like Python and Java are perfectly good languages, but are also very complicated and have lots of concepts to grasp. Conversely, C is simple, perhaps one of the simplest. It has very few keywords and concepts. It's a procedural programming language (sometimes called imperative), which means it's based around functions or subroutines depending on your preferred terminology. This allows the programmer to ignore the nebulous concepts like objects and classes, if he so wishes, that other higher level languages are often based on.

 

Another benefit, which is often overlooked, is that of edification. Learning C can give you an insight into how best to manage program resources, something that is often hidden from the programmer in other languages.

 

As others have said, once you've mastered C, learning pretty much any other language is child's play. It gives you a firm grasp of how real programs work, without the obfuscations of higher level languages. Be warned though, once you get a taste for C, you probably won't want to give it up for anything else ;) I know I don't. 

 

If you're really serious about understanding computers and how software works, grab a GNU/Linux distro (Xubuntu, Mint, Arch, Debian, etc), familiarise yourself with the terminal and essential programs such as screen, and start learning GCC/GDB, VI/Vim, and the Make/GNU Autotools. It's all free and available through a distro's package manager. No bloated IDE's required. Just a powerful and simple terminal is all you need to learn and write standard C.



#19 simplezz

simplezz

    Neowinian Senior

  • Tech Issues Solved: 8
  • Joined: 01-February 12

Posted 13 May 2014 - 23:33

However, should a first language closely map to hardware-level abstractions, I think is a mistake.

The less obfuscation the better in my opinion. Anyway, it doesn't really map to hardware any differently than C derived languages. Pointer arithmetic is perhaps the exception.

It is too far removed from the problem domain space

Without understanding basic programming concepts, how can one hope to solve problems or make best use of the resources available? Ignoring essential notions such as data structures won't help anyone in the long run. Start at the beginning, and start simple. That's how I've always approaching learning in general.

It's like telling someone to learn the subjunctive mood before they even have a grasp of the basic grammar of a written language.

and makes reasoning about algorithmic considerations difficult because the language is so different from mathematics and contains virtually no useful abstractions for algorithmic purposes. This is why the SICP uses Scheme for instance.

If someone's goal and focus is solely mathematics or related field then I'd agree. But the OP is clearly interested in programming languages and the role of C.

And don't forget, there are many C libraries available that one can plug into. The C standard library itself is just another library. Glib for instance provides support for object oriented style programming, as well as commonly implemented data structures.

Given that there are simple languages that do not present these difficulties and are better suited for reasoning about algorithmic considerations

I'm not sure why higher level languages like C# would be any better for "algorithms considerations", unless you're talking about having built-in stock data structures and functions, all of which as I mentioned above are available in libraries.

Besides, how will a beginner learn anything if the language does everything for them. Or what happens when they decide that the built-in functions don't satisfy program requirements. Then they're really stuck. Learning the fundamentals, including creating basic data structures and algorithms is what computer science is all about. Spoon feeding does them a disservice and discourages critical thinking.

#20 astropheed

astropheed

    astropheed

  • Tech Issues Solved: 2
  • Joined: 08-December 11
  • Location: Sydney, AU

Posted 13 May 2014 - 23:53

I learned top down (Python first). If I had learned bottom up (C first) I'd have washed out. I did eventually learn C, I didn't realise at the time of 'learning' it that I pretty well already knew it. It's such a simple language. I believe It only appears simple after you've learned other languages though.

 

I should point out I'm not a typical programmer with a mathy brain. I approach code in a more visual and artistic way if that makes sense. But, learning C has shifted my mindset on modern paradigms to the point where I've learned that beautiful, sophisticated code isn't always the best and bare-knuckle, git-er-done functions are sometimes all you need, actually quite often in fact.

 

I can see some peoples reasons for thinking that learning a low-level language first will separate the men from the boys, but I think that's just typical 'Real programmers use X' talk and I see little merit in it. as for the 'Learning low-level gives you a broader understanding of high-level philosophy', I agree completely, but I think that's still achievable after learning a high-level language which is a nicer entry point. Programming doesn't need to scare anyone to prove you can do it long-term as it's really quite simple to program.

 

 

tl;dr: Learn C, eventually, not first.



#21 winrez

winrez

    Chronic Master Debater

  • Tech Issues Solved: 1
  • Joined: 07-March 07
  • Location: Manitowoc, WI
  • OS: Windows 7 Enterprise 64-Bit, Windows 8 64-Bit, Windows RT 8.1 (Surface)
  • Phone: Samsung Focus WP7.8/ Nokia Lumina 520

Posted 14 May 2014 - 00:12

Personally if you have no experience  I would start with a just a couple days to a week of learning BASIC then start learning C

 

Link to Microsoft Small BASIC http://www.microsoft...s.aspx?id=22961



#22 mastercoms

mastercoms

    Expert Microsoft Fanboy & C# Coder

  • Tech Issues Solved: 3
  • Joined: 21-May 13
  • Location: Marietta, Georgia
  • OS: W10 + Fedora 21
  • Phone: Lumia 928 WP8.1U1 Black

Posted 14 May 2014 - 00:17

Personally if you have no experience  I would start with a just a couple days to a week of learning BASIC then start learning C

 

Link to Microsoft Small BASIC http://www.microsoft...s.aspx?id=22961

I would recommend QB64, you're going the BASIC route.



#23 simplezz

simplezz

    Neowinian Senior

  • Tech Issues Solved: 8
  • Joined: 01-February 12

Posted 14 May 2014 - 00:18

I learned top down (Python first). If I had learned bottom up (C first) I'd have washed out. I did eventually learn C, I didn't realise at the time of 'learning' it that I pretty well already knew it. It's such a simple language. I believe It only appears simple after you've learned other languages though.

That seems contradictory to me. You said yourself that by the time you learnt Python you already knew most of C. Well that's the whole point. C is tiny compared with Python. Therefore it stands to reason that you would have picked up C even quicker.

I think some people have a misconception that C is somehow difficult. It's not at all. Problems are difficult to solve, not C itself. And the concepts you learn in relation to resource management will teach you valuable information about how computers work. Anyone who's serious about learning programming and computer science should have a grasp of the fundamentals of how software works.

I should point out I'm not a typical programmer with a mathy brain. I approach code in a more visual and artistic way if that makes sense. But, learning C has shifted my mindset on modern paradigms to the point where I've learned that beautiful, sophisticated code isn't always the best and bare-knuckle, git-er-done functions are sometimes all you need, actually quite often in fact.

That's exactly it. While programming in highly abstracted languages is fine and dandy, writing your own data structures and algorithms from scratch is both very satisfying and edifying at the same time. It expands one's horizons. I couldn't ever imagine only writing in high level languages. I'd lose a critical skill.

#24 Max Norris

Max Norris

    Neowinian Senior

  • Tech Issues Solved: 22
  • Joined: 20-February 11
  • OS: Windows 2012R2, 7, BSD Unix
  • Phone: HTC One (Work) Lumia 1020 (Home)

Posted 14 May 2014 - 00:21

That's exactly it. While programming in highly abstracted languages is fine and dandy, writing your own data structures and algorithms from scratch is both very satisfying and edifying at the same time. It expands one's horizons. I couldn't ever imagine only writing in high level languages. I'd lose a critical skill.

True, but depends on your goals. Self-enlightenment is always a good thing of course (and one of the few times I'll agree with you).. working under a time-crunch to get a job done so you can pay the bills is something else entirely. It's not the perfect language for every job.

Personally - for a balance of usefulness, extensibility, productivity (so quick to get anything done in it) and just plain easy to wrap your head around, I'd probably pick Python myself and go from there. Stupidly easy to read and you don't have mountains of boilerplate and other hassles you need to deal with like some other languages.

#25 Xilo

Xilo

    Neowinian Senior

  • Joined: 28-May 04
  • Location: Austin, TX

Posted 14 May 2014 - 00:21

I did OS programming in C for 4 years. God I grew to royally hate C.



#26 astropheed

astropheed

    astropheed

  • Tech Issues Solved: 2
  • Joined: 08-December 11
  • Location: Sydney, AU

Posted 14 May 2014 - 00:36

Personally if you have no experience  I would start with a just a couple days to a week of learning BASIC then start learning C

 

Link to Microsoft Small BASIC http://www.microsoft...s.aspx?id=22961

 

I don't really know basic outside of doing a few macros in excel, but I've heard tale that learning Basic at all makes you a worse programmer. I'm not sure how true that is.



#27 Andre S.

Andre S.

    Asik

  • Tech Issues Solved: 14
  • Joined: 26-October 05

Posted 14 May 2014 - 00:38

The less obfuscation the better in my opinion. Anyway, it doesn't really map to hardware any differently than C derived languages. Pointer arithmetic is perhaps the exception.

Without understanding basic programming concepts, how can one hope to solve problems or make best use of the resources available? Ignoring essential notions such as data structures won't help anyone in the long run. Start at the beginning, and start simple. That's how I've always approaching learning in general.

It's like telling someone to learn the subjunctive mood before they even have a grasp of the basic grammar of a written language.

If someone's goal and focus is solely mathematics or related field then I'd agree. But the OP is clearly interested in programming languages and the role of C.

And don't forget, there are many C libraries available that one can plug into. The C standard library itself is just another library. Glib for instance provides support for object oriented style programming, as well as commonly implemented data structures.

I'm not sure why higher level languages like C# would be any better for "algorithms considerations", unless you're talking about having built-in stock data structures and functions, all of which as I mentioned above are available in libraries.

Besides, how will a beginner learn anything if the language does everything for them. Or what happens when they decide that the built-in functions don't satisfy program requirements. Then they're really stuck. Learning the fundamentals, including creating basic data structures and algorithms is what computer science is all about. Spoon feeding does them a disservice and discourages critical thinking.

You keep mentioning data structures and algorithms as if it was a particular trait of the C language that it allows one to write its own implementations. The fact is that you can write your own data structures and algorithms in any language, that many universities actually use languages other than C to teach data structures and algorithms (mine used Java), and that C is not particularly fit for this task, with no list comprehensions, iterators, higher-order functions or explicit tail recursion. The set of features supported by C closely follows hardware-level abstractions but hardware-level abstractions do not happen to be very useful abstractions for expressing data structures and algorithms. I think teaching basic programming concepts through the window of C teaches more how to work around its lack of high-level abstractions than how to translate real-world problems into a computable representation.

 

The fact that most languages have richer standard libraries than C is not an obstacle to learning data structures and algorithms as any proper CS course will obviously forbid usage of existing implementations in assignments. If anything, a quality standard library gives a good example to follow when implementing your own.

 

I have implicitely advised against learning something like C# (or Java or C++); I have advised using a simple language that has a low barrier of entry and REPL support. Python is a popular choice; the MIT has used Scheme for a long time as I referred to.



#28 astropheed

astropheed

    astropheed

  • Tech Issues Solved: 2
  • Joined: 08-December 11
  • Location: Sydney, AU

Posted 14 May 2014 - 00:39

You said yourself that by the time you learnt Python you already knew most of C. 

 

I never said that at all, that's just how you interpreted it. By the time I learned C I already knew Python, Javascript (jQuery) and PHP at a high level. I also had quite a bit of experience with other programming languages such as Go, Lua and Java.

 

If I had started with C, I can almost guarantee I'd have also ended with C. But that's just me. People learn differently and this is just my advice. I didn't like C, I still don't like C and I'll never like C. It would have made me think it's all like C and frankly it just isn't. Python and Javascript are actually quite fun to program. I even like PHP, which is odd to many.



#29 simplezz

simplezz

    Neowinian Senior

  • Tech Issues Solved: 8
  • Joined: 01-February 12

Posted 14 May 2014 - 00:45

True, but depends on your goals. Self-enlightenment is always a good thing of course (and one of the few times I'll agree with you).. working under a time-crunch to get a job done so you can pay the bills is something else entirely. It's not the perfect language for every job.

I agree. I often write programs in both Java and Python, and while they're good tools, they're not a perfect fit for every task, and neither is C. Horses for courses and all that. Although I do find myself reaching for C first, but that's probably mostly down to preference.

Still, for a beginner, I'd say the role of C as programming language is an important one. Both because of its simplicity and because it teaches the fundamentals of how software works.

#30 simplezz

simplezz

    Neowinian Senior

  • Tech Issues Solved: 8
  • Joined: 01-February 12

Posted 14 May 2014 - 00:48

I don't really know basic outside of doing a few macros in excel, but I've heard tale that learning Basic at all makes you a worse programmer. I'm not sure how true that is.

Yes, that's quite probably the worst advice possible. Learning basic, especially as a first language, will teach all kinds of bad habits. It's also so different to C that it'll just end up confusing a beginner and putting them off altogether.