
Ask HN: Best way to learn new programming language and it's conventions? - asdojasdosadsa
Hello,
I&#x27;ll give the tl;dr first:
tl;dr: Would like to learn C, best way?<p>So, I have been programming with some different, quite common languages, most of all - not a surprise - javascript. I... well, I don&#x27;t really enjoy JavaScript, but it&#x27;s what pays my salary and brings the bread to the table, so I can manage. I would like to learn some new language to improve as a programmer. I learned python quite &quot;well&quot; doing a school project using just python.
Now, after reading some articles and posts, I would like to learn C (unless there&#x27;s a better option? Haskell? Rust? Lisp?). The new language should be somewhat challenging, and I would like to learn some new &quot;of thinking&quot;.<p>Why C? Well, I do a lot of work in unix (linux&#x2F;osx) environment, and instead of doing bash scripts, I maybe could (when needed) use C instead of Bash&#x2F;Python.<p>Thanks in advance for all the replies, I appreciate it.
======
cnnsucks
Read code written by others. In the case of C there is a large base of high
quality open source code you can study. C is a simple language that is used
for large scale, complex work so a vast amount of convention and idiom has
developed. Those conventions vary from one code base to the next, but you'll
find many commonalities and have no difficulty adapting once you've had enough
exposure.

Reading working code is crucial; man page examples and language books won't
expose you to enough real world usage. Programmers use the preprocessor. They
do subtle and effort-saving things with enums and typedefs and designing a
good struct is crucial.

Some well-thought-of C code bases include postfix, nginx, APR and lighttpd.
After you've seen enough C you can just glance at a page of C code from across
the room and know whether it's likely to be crap or not.

------
motet_a
C is interesting but old and unsafe, leading to memory corruption bugs. These
bugs are often hard to find and compromise security. It is not always a good
choice in real-world.

Rust, C++ and Haskell are much more complicated than JavaScript IMHO. Lisp is
pretty old but there is a lot of modern Lisp-like languages.

Try them.

As cnnsucks said, reading code is important no matter what language you use.
You can perfecly use JavaScript, Python, Go or Ruby and learn incredible
tricks everyday, and these languages are used in the real-world.

------
Guyag
Syntax-wise, I've found learnxinyminutes.com to be a good introductory
resource. I'm also looking for a good quality resource on programmatic
conventions for different languages, including details on what unique/'cool'
features each has, all in once place. So far I've not had much luck.

