why learn C?

P

pandit

hai all,

i want to become a good programmer. one of my friends ( named
"arnuld", he posts here infrequently), taught me Lisp. so i am not a
programming beginner.

i have heard these 2 points. i want to know how :

1. C gives you a strong base of Procedural style of programming which
forms the basis of learning other paradigms e.g OOP

2. with C one will learn about pointers and algorithms.

3. /arnuld/ told me this in an email:

" i think algorithms and data-structures are more important than
learning a new programming language . Hence i prefer learning about
algorithms and data structures 1st, before i attempt a new programming
language or OOD. i think that is a better way. i said so after
searching the archives of "comp.programming", "comp.lang.c++",
"comp.lang.c" & "comp.lang.lisp" , at these places i found that
learning about programming, algorithms, data structures, abstraction,
software design and problem solving, and version control is much more
important and time consuming than simply learning a language, almost
all folks agree on that learning a programing language is a simple
task as compared to what they have described here"


/arnuld/ is not an experienced programmer, so i feel difficulty in
believing his words. i want to know the views of people here,a s much
of the post belong to C.


- pandit
 
M

Marc Boyer

Le 22-02-2007 said:
i want to become a good programmer. one of my friends ( named
"arnuld", he posts here infrequently), taught me Lisp. so i am not a
programming beginner.

i have heard these 2 points. i want to know how :

1. C gives you a strong base of Procedural style of programming which
forms the basis of learning other paradigms e.g OOP

I am not sure that C gives better 'strong base' than Ada.
2. with C one will learn about pointers and algorithms.

pointers: yes
algorithms: why ?
3. /arnuld/ told me this in an email:

" i think algorithms and data-structures are more important than
learning a new programming language. Hence i prefer learning about
algorithms and data structures 1st, before i attempt a new programming
language or OOD. i think that is a better way. i said so after
searching the archives of "comp.programming", "comp.lang.c++",
"comp.lang.c" & "comp.lang.lisp" , at these places i found that
learning about programming, algorithms, data structures, abstraction,
software design and problem solving, and version control is much more
important and time consuming than simply learning a language, almost
all folks agree on that learning a programing language is a simple
task as compared to what they have described here"


/arnuld/ is not an experienced programmer, so i feel difficulty in
believing his words. i want to know the views of people here,a s much
of the post belong to C.

On algorithms: it depends what mean 'learning about algorithms'. In
every day programming, quick-sort is the most complicated algo I wrote,
ans, in all my programming life, the most complicated one was
implementing red-black tree. It is far away for beeing algorithm expert.
But some 'minimum' is needed (linked list, map, tree, sorting...).

The same, there is not a lot of every day *theoretical* structures:
array, lists, hash-map, tree...

Moreover, I do not know how to learn 'abstraction, software design and
problem solving' without any langage. Moreover, I am under the
impression that the 'good' software design is not langage-independant.

At leats, learning C is usefull because the is C, a kind of universal
programming langage known by all, a little bit like 'English' in
natural langages.


Marc Boyer
 
S

santosh

pandit said:
hai all,

i want to become a good programmer. one of my friends ( named
"arnuld", he posts here infrequently), taught me Lisp. so i am not a
programming beginner.

i have heard these 2 points. i want to know how :

1. C gives you a strong base of Procedural style of programming which
forms the basis of learning other paradigms e.g OOP

2. with C one will learn about pointers and algorithms.

3. /arnuld/ told me this in an email:

" i think algorithms and data-structures are more important than
learning a new programming language . Hence i prefer learning about
algorithms and data structures 1st, before i attempt a new programming
language or OOD. i think that is a better way. i said so after
searching the archives of "comp.programming", "comp.lang.c++",
"comp.lang.c" & "comp.lang.lisp" , at these places i found that
learning about programming, algorithms, data structures, abstraction,
software design and problem solving, and version control is much more
important and time consuming than simply learning a language, almost
all folks agree on that learning a programing language is a simple
task as compared to what they have described here"


/arnuld/ is not an experienced programmer, so i feel difficulty in
believing his words. i want to know the views of people here,a s much
of the post belong to C.

Have you asked permission from "arnuld" to publicise his private
correspondences?

Since this seems to be a general question on learning programming or
rather software engineering, you'd get a much better response in
comp.programming than here. All I can say is that the third point
above by your "arnuld" is, when interpreted *very* liberally, right.
 
A

arnuld

1. C gives you a strong base of Procedural style of programming which
I am not sure that C gives better 'strong base' than Ada.


OK, 1st have to Google for Ada as i never came across some Ada-code. i
never even read about its design-goals and/or any articles related to
it.

BTW, your "summary of Ada" can be useful for me, if you can.

pointers: yes
algorithms: why ?

why not ?

1. i tried some Common Lisp where i never had to worry about
algorithms.

2. in C++, you get read-made algorithms from Standard Library, so
around 95% of the times, you only need to do "#include<algorithm>".

whereas in C, you have design the algorithms, from scratch.

but may be i am biased, as i did not take the case of other languages
like OCaml, Haskell, Mercury or Eiffel here.


" i think algorithms and data-structures are more important than
learning a new programming language.
[SNIP]
/arnuld/ is not an experienced programmer, so i feel difficulty in
believing his words. i want to know the views of people here,a s much
of the post belong to C.
On algorithms: it depends what mean 'learning about algorithms'.

i meant, "applying the specific algorithm, in the language your are
working with".

[SNIP]
Moreover, I do not know how to learn 'abstraction, software design and
problem solving' without any langage.

you can't. what i meant is:

abstraction, software-design & problem-solving are independent of any
programming language *and* you learn all of these by applying them in
a programming language, just like algorithms."


i think that was obvious.
Moreover, I am under the
impression that the 'good' software design is not langage-independant.

good software design is language-independent,as i said already, *and*
some programming languages are a not a good-fit for a particular
design but a perfect-fit for some other designs.
At leats, learning C is usefull because the is C, a kind of universal
programming langage known by all, a little bit like 'English' in
natural langages.

Is this the only benefit you think of C (except pointers) ?

i guess, there are more.


BTW, thanks for the critique.

-- arnuld
http://arnuld.blogspot.com
 
A

arnuld

Have you asked permission from "arnuld" to publicise his private
correspondences?

why he needs a permission from a person like me. check my BLOG on why
i said so.

BTW, the thoughts i wrote down are the *only* the interpretation, as
per my viewpoint, of the knowledge i have accumulated from the USENET.

Since this seems to be a general question on learning programming or
rather software engineering, you'd get a much better response in
comp.programming than here.

i guess, "pandit" must have taken your advice seriously.
All I can say is that the third point
above by your "arnuld" is, when interpreted *very* liberally, right.

Oh.. thanks Snatosh

-- arnuld
http://arnuld.blogspot.com
 
M

Marc Boyer

Le 22-02-2007 said:
OK, 1st have to Google for Ada as i never came across some Ada-code. i
never even read about its design-goals and/or any articles related to
it.

comp.lang.ada
BTW, your "summary of Ada" can be useful for me, if you can.

In a very few words, Ada is a modern Pascal. And Ada 83
is, to me, a very good langage to learn procedural programming.
why not ?

This is the one that states somthing that have to give argument,
not the opposite.
1. i tried some Common Lisp where i never had to worry about
algorithms.

How ? How did you do a balanced binary tree in Common Lisp
without algorithm ?
2. in C++, you get read-made algorithms from Standard Library, so
around 95% of the times, you only need to do "#include<algorithm>".

whereas in C, you have design the algorithms, from scratch.

No, they are several ready-made library for C. One difference
with C++ is that you have to chose one, this is not in the
standard. But you also can do everything by yourself in C++.
but may be i am biased, as i did not take the case of other languages
like OCaml, Haskell, Mercury or Eiffel here.

And so many others...
i meant, "applying the specific algorithm, in the language your are
working with".

There is a gap between writing and using. What did you mean by
'applying' ?
you can't. what i meant is:

abstraction, software-design & problem-solving are independent of any
programming language *and* you learn all of these by applying them in
a programming language, just like algorithms."

i think that was obvious.

No. The same problem is not solved the same way in SQL, Matlab, C or Prolog.
OK, the is a 'common base': clear interface, independant implementation,
and general enough but not too much.
But is there a way to learn it independantly from the langage?
I do not think so. I may be wrong.
good software design is language-independent,as i said already, *and*
some programming languages are a not a good-fit for a particular
design but a perfect-fit for some other designs.

yes and no. It is a long debate...
Is this the only benefit you think of C (except pointers) ?

Benefit of 'learning' C or benefit of 'using' C ?

Marc Boyer
 
S

santosh

arnuld said:
why not ?

1. i tried some Common Lisp where i never had to worry about
algorithms.

2. in C++, you get read-made algorithms from Standard Library, so
around 95% of the times, you only need to do "#include<algorithm>".

whereas in C, you have design the algorithms, from scratch.

Not necessarily. There're various utility libraries like GLib that do
most of what you might want. Even if you're forced to reimplement
algorithms in C, it doesn't necessarily follow that C's the best
language or that you've fully understood the algorithm itself.

Fact is that algorithms are independant from specific languages.
There's nothing stopping you from writing your own lists or trees even
in languages that provide them out-of-the-box.

<snip>

It might be better to take this discussion to comp.programming, as
it's having increasingly little to do with C.
 
S

santosh

arnuld said:
why he needs a permission from a person like me. check my BLOG on why
i said so.

Well, usually one doesn't publish private emails on a public media
without the consent of the author of the concerned material. Never
mind.

<snip>
 
P

pandit

from now on, this post will be discussed at "comp.programming", as it
has gone highly OT

thanks

- pandit
 
A

August Karlstrom

Marc Boyer skrev:
In a very few words, Ada is a modern Pascal. And Ada 83
is, to me, a very good langage to learn procedural programming.

To large. Oberon is the king in this respect.


August
 
F

Flash Gordon

arnuld wrote, On 22/02/07 16:29:

Please do not snip the attribution lines, the bits that say who posted
what. They are useful to the rest of us to follow the conversation.

why not ?

Because whatever programming language you are using you are using
algorithms, so why C in particular?
1. i tried some Common Lisp where i never had to worry about
algorithms.

In that case you were not developing your software properly. Stages of
software development:

1) What is the problem?
This is requirements analysis
2) What method do I use to solve the problem?
This is algorithm development
3) How should I put things together to implement this method?
This is design
4) Write the code

Note that I have missed out a lot of things deliberately, since software
development plans, test plans, testing and so on would complicate my point.
2. in C++, you get read-made algorithms from Standard Library, so
around 95% of the times, you only need to do "#include<algorithm>".

Where is the ready made algorithm to do histogram equalisation of a
greyscale image? How about the ready made algorithm to calculate the
gain and offset I need to apply to the incoming image so that 5% of
pixels are white, 5% black, and the rest somewhere in between? If you
can find those, then I can find other algorithms I have needed which are
*not* part of which ever language you choose to select.
whereas in C, you have design the algorithms, from scratch.

but may be i am biased, as i did not take the case of other languages
like OCaml, Haskell, Mercury or Eiffel here.

If anything you are biased by only doing programs where the language
provides you with a ready made solution. Write any program of any
significant complexity (say 100 lines, to pick a figure out of thin air)
and you will have done at least some algorithm development whether you
realised it at the time or not.
" i think algorithms and data-structures are more important than
learning a new programming language.
[SNIP]
/arnuld/ is not an experienced programmer, so i feel difficulty in
believing his words. i want to know the views of people here,a s much
of the post belong to C.
On algorithms: it depends what mean 'learning about algorithms'.

i meant, "applying the specific algorithm, in the language your are
working with".

What is most important depends on what level you are working at. If you
are implementing a design that has been produced and reviewed by others
then there is sod all algorithm development to do whatever language you
are working in. If, on the other hand, you are trying to be the
technical lead on a project then if you do not understand the algorithms
that need to be developed you are worse than useless, but not knowing
all the details of a given programming language is less important
because you will find it easy to pick up what you need (prefferably be
reading good material on the language).

good software design is language-independent,as i said already, *and*
some programming languages are a not a good-fit for a particular
design but a perfect-fit for some other designs.

Here I more or less agree with you. However, if you know you are going
to implement something in C or Pascal (possibly due to some external
project restraint, maybe having to add it to part of an existing
product) then you might choose a different design to if you are going to
be implementing it in Lisp.
Is this the only benefit you think of C (except pointers) ?

i guess, there are more.

C is a higher level than assembler (which is a higher level than machine
code) which is an advantage, but one shared by many other languages.

C allows you to get close to the metal when required which is an
advantage, but one shared by many other programming languages.

C has been standardised which is an advantage shared (in one form or
another) by many other languages.

Any advantage you can find for C will be shared by at least one other
language apart from C having been ported to probably more targets than
any other language, which leads from it often being the first language
(or first after the assembler for that specific target) ported to any
given target. Assembler does not count because each assembler language
is different.
BTW, thanks for the critique.

The two things this group is best IMHO at in order are
1) C
2) Critiques.
 
D

Default User

Marc said:
which >> > forms the basis of learning other paradigms e.g OOP

In a very few words, Ada is a modern Pascal.

That's way too few. Ada was a language created from scratch for
high-safety programming, commissioned by the US Department of Defense.
It's based on Pascal, but no more a "modern Pascal" than C++ is a
"modern C".
And Ada 83
is, to me, a very good langage to learn procedural programming.

It used to be difficult to find free Ada compilers (or even any that
didn't cost a fortune). A brief bit of searching seems to indicate that
that's not so much the case anymore.



Brian
 
M

Marc Boyer

Le 23-02-2007 said:
That's way too few.

If you have time to give a long definition of Ada, just do it.
Ada was a language created from scratch for
high-safety programming, commissioned by the US Department of Defense.
It's based on Pascal, but no more a "modern Pascal" than C++ is a
"modern C".

I agree.
It used to be difficult to find free Ada compilers (or even any that
didn't cost a fortune). A brief bit of searching seems to indicate that
that's not so much the case anymore.

What about GNAT ?

Marc Boyer
 
A

arnuld

Please do not snip the attribution lines, the bits that say who posted
what. They are useful to the rest of us to follow the conversation.
ok

Because whatever programming language you are using you are using
algorithms, so why C in particular?


i guess, because it will help me in understanding all other languages
as C is the *hardest* language i have ever confronted. Assembly was
not that hard, Assembly is just *tedious*.
In that case you were not developing your software properly. Stages of
software development:

1) What is the problem?
This is requirements analysis
2) What method do I use to solve the problem?
This is algorithm development
3) How should I put things together to implement this method?
This is design
4) Write the code


seems, like i am reading either OOD or Software Engineering concepts.
i think programming is different from Software Engineering.

Note that I have missed out a lot of things deliberately, since software
development plans, test plans, testing and so on would complicate my point.

i knew that but "missing out things" made your explanation clear :)

Where is the ready made algorithm to do histogram equalisation of a
greyscale image? How about the ready made algorithm to calculate the
gain and offset I need to apply to the incoming image so that 5% of
pixels are white, 5% black, and the rest somewhere in between? If you
can find those, then I can find other algorithms I have needed which are
*not* part of which ever language you choose to select.

so you are saying that i need to learn about algorithms in C++ too.
good idea i think

If anything you are biased by only doing programs where the language
provides you with a ready made solution. Write any program of any
significant complexity (say 100 lines, to pick a figure out of thin air)
and you will have done at least some algorithm development whether you
realised it at the time or not.

i never realised that. i always thought:

algorithms == maths != programming

What is most important depends on what level you are working at. If you
are implementing a design that has been produced and reviewed by others
then there is sod all algorithm development to do whatever language you
are working in. If, on the other hand, you are trying to be the
technical lead on a project then if you do not understand the algorithms
that need to be developed you are worse than useless,

i am not on a "team-lead". i am just trying to learn OOD, C++ and STL
(for getting a job) and before that i want to become a good
programmer (like "pandit", the OP)

but not knowing
all the details of a given programming language is less important
because you will find it easy to pick up what you need (prefferably be
reading good material on the language).

this is how one learns C++, i have found.

C is a higher level than assembler (which is a higher level than machine
code) which is an advantage, but one shared by many other languages.

C allows you to get close to the metal when required which is an
advantage, but one shared by many other programming languages.

C has been standardised which is an advantage shared (in one form or
another) by many other languages.

Any advantage you can find for C will be shared by at least one other
language apart from C having been ported to probably more targets than
any other language, which leads from it often being the first language
(or first after the assembler for that specific target) ported to any
given target. Assembler does not count because each assembler language
is different.

this the 3rd post, from where i conclude that rather than working
randomly at different languages (like i usually do), one needs to
choose a language he likes and spend time practicing in it.

i also conclude, that you, "Flash Gordon", indirectly said that once
one becomes proficient in that language by practicing syntax,
algorithms and paradigms in his *favourite* language, then learning
other language becomes easier.

if i am RIGHT, then you have solved the biggest problem i am facing.

The two things this group is best IMHO at in order are
1) C
2) Critiques.
:)

Flash Gordon

i am arnuld, nice to meet you ;-)

-- arnuld
http://arnuld.blogspot.com
 
S

santosh

arnuld said:
i guess, because it will help me in understanding all other languages

It won't, atleast not as much as might think it would.
as C is the *hardest* language i have ever confronted. Assembly was
not that hard, Assembly is just *tedious*.

Trust me, C++ is a lot harder.
seems, like i am reading either OOD or Software Engineering concepts.
i think programming is different from Software Engineering.

Not really. Programming is the actual coding part. Software
Engineering is about trying to perfect the body of code, so that
behaves as well as possible within itself and with external systems
and meets the requirements defined before hand. It, (principles of
software engineering), is not necessary for trivial programs, but
it'll be really useful as projects get bigger and expectations taller.
C++, you get read-made algorithms from Standard Library, so [ ... ]

Where is the ready made algorithm to do histogram equalisation of a
greyscale image? How about the ready made algorithm to calculate the
gain and offset I need to apply to the incoming image so that 5% of
pixels are white, 5% black, and the rest somewhere in between? If you
can find those, then I can find other algorithms I have needed which are
*not* part of which ever language you choose to select.

so you are saying that i need to learn about algorithms in C++ too.
good idea i think

No. He's saying that no language contains premade implementations of
all the algorithms you might need. The C++ library, (and many other
"Standard" libraries), contain many fundamental algorithms, but in
practical projects you'll still have to write numerous case specific
ones.

Once you learn an algorithm and try implementing it once, you should
be able to reimplement in another language, without having to relearn
the algorithm itself, since it's just pure logic. The devil is in the
details however.

i am not on a "team-lead". i am just trying to learn OOD, C++ and STL
(for getting a job) and before that i want to become a good
programmer (like "pandit", the OP)

Practise makes perfect. A lot of reading also helps. A clear mind is
the best help of all.

this the 3rd post, from where i conclude that rather than working
randomly at different languages (like i usually do), one needs to
choose a language he likes and spend time practicing in it.

Yes. Devote a reasonable amount of time to a language before picking
up another one. Learning several languages in parallel is possible,
but difficult.

if i am RIGHT, then you have solved the biggest problem i am facing.

Is *that* your biggest problem? I envy you. :)
 
D

Daniel Rudy

At about the time of 2/22/2007 3:34 AM, pandit stated the following:
hai all,

i want to become a good programmer. one of my friends ( named
"arnuld", he posts here infrequently), taught me Lisp. so i am not a
programming beginner.

i have heard these 2 points. i want to know how :

1. C gives you a strong base of Procedural style of programming which
forms the basis of learning other paradigms e.g OOP

Any language that allows subroutines is procedural based. This includes
C, Pascal, and Assembler.
2. with C one will learn about pointers and algorithms.

Pointers, yes. But, you can learn about algorithms and data structures
in any language.

3. /arnuld/ told me this in an email:

" i think algorithms and data-structures are more important than
learning a new programming language . Hence i prefer learning about
algorithms and data structures 1st, before i attempt a new programming
language or OOD. i think that is a better way. i said so after
searching the archives of "comp.programming", "comp.lang.c++",
"comp.lang.c" & "comp.lang.lisp" , at these places i found that
learning about programming, algorithms, data structures, abstraction,
software design and problem solving, and version control is much more
important and time consuming than simply learning a language, almost
all folks agree on that learning a programing language is a simple
task as compared to what they have described here"

FWIW, I learned C out of a book, along with the helpful guidance of the
people here.

Algorithms are just a set of steps or tasks that must be performed to do
something. The steps used to perform a quicksort or a binary search are
the same no matter what language you use. The implementation of those
steps are going to be language dependent. Some algorithms are more
complicated than others. Quicksort, binary trees, binary search, and
hash tables are some of the more complicated ones. The most complicated
algorithms that I have ever done dealt with encryption. Ever look at
the source code for a DES algorithm? It's bad...to the point of
pre-processor abuse.

And there are the implementations of algorithms that are not just
language specific, but also platform specific. Performing network IO on
a windows machine is different than doing it on a unix machine. Even
though you are using the same language for both, the platform dictates
the procedure you must follow to do it.

Data structures are also language dependent. Pascal has record, object,
and array, C has struct, union, and array. C++ has what C has plus
class. Some languages like VBScript doesn't even have structures. But,
the basic definition of a data structure in any language is a collection
of related data. The data structure is dependent on what the format of
the data is in, and what you want to do with that data. But there are
some general guidelines.
/arnuld/ is not an experienced programmer, so i feel difficulty in
believing his words. i want to know the views of people here,a s much
of the post belong to C.


- pandit

I have to agree with your friend. He does seem to know what he is
talking about, but I would put the emphasis on algorithms before data
structures though. The data structures that you use are going to be
defined by the algorithm and language that you use, in addition to what
data types are available for the language that you are using.

--
Daniel Rudy

Email address has been base64 encoded to reduce spam
Decode email address using b64decode or uudecode -m

Why geeks like computers: look chat date touch grep make unzip
strip view finger mount fcsk more fcsk yes spray umount sleep
 
C

Chris Dollin

Daniel said:
Any language that allows subroutines is procedural based. This includes
C, Pascal, and Assembler.

That depends on what you mean by a "subroutine", unless you
count the pure functional languages (including the lazy ones)
as "procedural", which I generally wouldn't.
 
D

Daniel Rudy

At about the time of 2/23/2007 4:19 AM, Chris Dollin stated the following:
That depends on what you mean by a "subroutine", unless you
count the pure functional languages (including the lazy ones)
as "procedural", which I generally wouldn't.

Hmmm...

I think of a procedural based language as being a language that allows
you to call a named subroutine (function, procedure, etc) like C,
Pascal, etc. Even Visual Basic Script from Microsoft is procedural
based using that description, but Basic wouldn't be (EX: gosub 1200).


--
Daniel Rudy

Email address has been base64 encoded to reduce spam
Decode email address using b64decode or uudecode -m

Why geeks like computers: look chat date touch grep make unzip
strip view finger mount fcsk more fcsk yes spray umount sleep
 
C

Charlton Wilbur

DR> I think of a procedural based language as being a language
DR> that allows you to call a named subroutine (function,
DR> procedure, etc) like C, Pascal, etc.

Then Lisp is as well, as is C++, as is Java, as is PostScript, as is
TeX. I suspect your definition of "procedural based language"
requires considerable further refinement.

Charlton
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,152
Latest member
LorettaGur
Top