5 ms·
There's nothing magic about learning C versus any other language. - Read an authoritative source (K&R is good; there are better ones) - Read a bunch of good c
by kabdib 12y ago
There's nothing magic about learning C versus any other language.
- Read an authoritative source (K&R is good; there are better ones)
- Read a bunch of good code (I mostly read tools and kernel sources)
- Write crappy code and get better
Generally I want to write 10K lines of code in a new language before I probably don't suck at it. Varies on the language and paradigm, going to C++ from C took like five years (figuring out OOP, and painful lessons on what to avoid in C++), and apparently I'm never going to understand Haskell.
- emotionalcode 12y ago> and apparently I'm never going to understand Haskell I found this introduction to the concepts of functional programming (functional composition) to be useful: https://www.youtube.com/watch?v=ZhuHCtR3xq8 https://www.youtube.com/watch?v=ZhuHCtR3xq8 Otherwise, it's just a different way of thinking about problems. Instead of building things structurally as an object of objects, and then creating functions that relate, transform, or describe the relationships between the object structures (like taking a pixel object, altering it's x coordinate, and returning the new pixel object with only the x coordinate altered), one has functions that can be composed with other functions to produce more complex object structures. A single base unit with a sequence of functional compositions can describe a very fancy, complex unit, with many fancy, complex characteristics. >> Monads have also been explained with a physical metaphor as assembly lines, where a conveyor belt transports data between functional units that transform it one step at a time.[2] They can also be seen as a functional design pattern to build generic types.[3] http://en.wikipedia.org/wiki/Monad_%28functional_programming%29 http://en.wikipedia.org/wiki/Monad_%28functional_programming... Otherwise, it's syntax and semantics, which I generally find annoying, but there's always google and books. http://www.haskellcraft.com/craft3e/Home.html http://www.haskellcraft.com/craft3e/Home.html
- steakejjs 12y agoI really think C is much easier to get good at than other languages. There is no mystery with what's going on in the computer when you learn C, the builtin functions, how big something is, how things work, etc. When you learn higher level languages there is significant mystery in everything. It means you can write a lot of code having no idea what's going on under the hood, which is good. That's the point of a higher level language, but it is certainly something you SHOULD know in order to call yourself an expert. These mysteries are sometimes what causes Good programmers to get hung up on odd edge cases .
- jacquesm 12y ago> It means you can write a lot of code having no idea what's going on under the hood, which is good. I'm not so sure that's good. The more stuff there is under the hood that you have no idea about the more places bugs can hide in.
- kabdib 12y agoDepends on the quality of the runtime. For instance, C# and Python are really good and well-documented. Your Java environment can vary quite a bit, but you probably have control over it. Howlers like PowerBuilder and InstallShield are just hopeless amateurville and leave me giggling with awe at how fantastically bad they are; they are worth looking at if you want to get a sense of how lucky you are.
- dpratt71 12y agoI'm a self-taught programmer. I started with Pascal (what seems like an age ago), then C, then VB5/6, then C# and JS and a bunch of other programming languages. At this point I felt like I could pick up about any mainstream programming language very quickly. And then I tried to tackle Haskell. That was about five years ago, and I think I'm still at beginner/intermediate level with it. But I realized something. These days I have a career and family. Back when I was learning Pascal, I had a lot more time and mental focus on my hands. All the programming languages I've learned since (besides Haskell) were not much different than Pascal, not fundamentally so. Haskell is fundamentally different. I definitely feel like my past programming experience helped me learn Haskell faster than if I had no experience, but that past experience was also a handicap. I had to discard a lot of assumptions and get to a more basic mindset of what the art of programmming entails. And like a lot of other folks, I found it to be a very rewarding (and useful) experience.
- V-2 12y agoModern C# does provide some FP constructs (in the form of LINQ, lambdas etc.). I know that having used them a lot made it easier for me to grasp Scala.
- ultimape 12y agoI found the reverse to be true - Learning FP paradigm stuff in Scala helped me pick up C#. Finding out about Linq made me research functional-relational mapping for Scala. FRM makes so much sense to me.
- agumonkey 12y agoBefore learning Haskell, try learning lisp through SICP. Haskell is wonderful but it's mostly (not really but bear with me) syntactic sugar over lazy application, which is explained in SICP (as opposed to eager evaluation used almost everywhere else). Syntactic sugar makes the whole thing appear like dark magic but it's not. It's a few minimalistic rules applied over and over (at both language and meta levels).
- kabdib 12y agoI've been programming (dabbling, to be honest) in LISP since about 1980, I've never shipped any products in it. I wrote a couple of toy interpreters in college (after reading Allan's Anatomy of LISP) and some small projects, but nothing massive. I read SICP when it first came out and did most of the exercises. Yet Scheme was a terrible language to ship software in (commercial implementations were basically toys). I assume that Common LISP was a lot better, but the real packages were expensive. I guess the real problem is that I didn't have cow-orkers who understood my obsession with LISP, nor did I work on any projects that I could really use it for. Could have switched companies, I suppose, but I liked working on operating systems . . .
- agumonkey 12y agoAight, to each his own, a lot of Haskell mystery vanished when I saw it explained in terms of simpler languages (pattern matching, lazy evaluation, curryfication etc etc) but apparently that's not what's bothering you.
- kabdib 12y agoHmmm, your answer was still helpful. Please don't get me wrong. I guess I'm just used to functional style where data === code to a great degree. I'll take another look at Haskell when I finish my current (yuck) Java based project :-)
- V-2 12y agoI think FP languages' reputation of being hard to learn is partly owed to intimidating terminology that makes certain concepts appear more difficult than they actually are.
- jacquesm 12y ago10K lines is very fast to make it to proficiency. It takes me a lot longer to 'not suck' at a new language, I'm not at all sure what a reasonable value here is but I don't usually consider myself slow. Probably I'll have to adjust that self image now ;).
- runlevel1 12y ago> - Read an authoritative source (K&R is good; there are better ones) Which would you recommend?
- qohen 12y agoRead an authoritative source (K&R is good; there are better ones) K&R is a classic, but is it a good way to learn proper C programming technique? This makes one wonder -- from Zed Shaw's online version of "C The Hard Way" [0]: I myself believed that until I started writing this book. You see, K&RC is actually riddled with bugs and bad style. Its age is no excuse. These were bugs when they wrote the first printing, and the 42nd printing. I hadn't actually realized just how bad most of the code was in this book and recommended it to many people. After reading through it for just an hour I decided that it needs to be taken down from its pedestal and relegated to history rather than vaunted as state of the art. He goes into more detail in his critique, e.g. Where K&RC runs into problems is when the functions or code snippets are taken out of the book and used in other programs. Once you take many of these code snippets and try use them in some other program they fall apart. They then have blatant buffer overflows, bugs, and problems that a beginner will trip over. There's more -- and he goes through some K&R code too. [0] http://c.learncodethehardway.org/book/krcritique.html http://c.learncodethehardway.org/book/krcritique.html