To people out here who work as programmers & computer scientists :

I don't have a degree in CS and I have taught myself to code using Java & Python. These are languages which have garbage collections & no explicit references to memory locations(i.e pointers). I chose these languages as I found it much easier to learn & implement algorithms. And because of this, when I attend software developer interviews, I am unable to answer questions about memory leaks, pointers, etc. Even companies which don't use C or C++ seem to enjoy asking these questions.

Have I have handicapped myself by not learning C or C++ ?

I see that for Udacity's CS101, Python is going to be used as the language. Shouldn't a basic programming course be taught using C so that people understand what is going on inside the machine? (and perhaps be able to answer interview questions in the future.)

asked 14 Feb '12, 20:14

rbk's gravatar image

rbk
1.2k1321

edited 14 Feb '12, 20:16


Which language should be taught in a first CS class is a non-trivial question. For what it's worth the first languages I learned (in order) were Basic. Fortran, Scheme, C, CLU, Pascal, C++. I think Python is a decent choice. I was going to elaborate, but think this link does it better than I would: http://mcsp.wartburg.edu/zelle/python/python-first.html

I don't know if you have handicapped yourself by not learning C/C++, but I would recommend at least learning C. I think it has a major role in the evolution of programming languages and IMHO the K&R book is a model of concise exposition. It also almost defines the "worse is better" school (http://www.jwz.org/doc/worse-is-better.html ) and I think it is valuable to have a sense of both this and "the right thing" school as part of learning to make tradeoffs in software design.

You might be interested in some of the discussions from when MIT switched from 6.001 in Scheme to 6.01 in Python (Google will find more if you like).
http://www.wisdomandwonder.com/link/2110/why-mit-switched-from-scheme-to-python
http://news.ycombinator.com/item?id=602307

link

answered 14 Feb '12, 20:42

rseiter's gravatar image

rseiter ♦
6.7k628

edited 14 Feb '12, 21:12

robrambusch's gravatar image

robrambusch ♦
24.2k454261

Thanks for your explanation and the links. The Python as the first language article was enlightening. I've tried to learn C, but I found myself spending most of my time with GDB without actually getting something to work and it literally scared me off. So looks like I just need to undergo the rigor & learn C. (And I hope Udacity/Coursera offer a Systems Programming course in the future).
(14 Feb '12, 22:33) rbk rbk's gravatar image
You're welcome. I'm not surprised by your C experience. Like @NitNatNok said below that's a good reason not to use C/C++ in an intro class. I learned C from K&R while working as an intern. That was a long time ago so I don't have good current tips other than getting a copy of K&R (http://en.wikipedia.org/wiki/The_C_Programming_Language) and starting small. Perhaps someone else here can offer some better ideas for learning C.
(14 Feb '12, 22:45) rseiter ♦ rseiter's gravatar image
1
If you are trying to learn C and you already know a higher-level language or two, I think it would be helpful to first learn something about computer architecture (how processors work and so on). That way it's easier to understand what pointers are, for example. C isn't sometimes called as a portable assembler for nothing...
(15 Feb '12, 05:02) possu possu's gravatar image
2
Similar for me: I learned Basic, Pascal, C, Assembler, C++, Prolog, Java, PHP, JavaScript, Scheme, Python and maybe some other in approximately this order. The only ones that really seemed important were C, Lisp/Scheme and one of the 'simple object oriented' language, like Java or Python. C helps you understand about the hardware, and especially all the mistakes you can make if you are close to it. Lisp/Scheme helps you understand programming languages in general (because you can pretty much demonstrate all possible programming paradigms in this language, as demonstrated in "How to Design Programs" or the old SICP lectures). You can also learn about pointers in Lisp, if you want, but it won't give you the awkward 'Buffer Overflow'-experience provided by C. The third language can be any implementation language you need for practical purposes (with plenty of libraries available), which is required by your job or you simply feel comfortable coding in. If you have a certain foundation it's easy to adapt to Python or Java or something.
(15 Feb '12, 06:49) rhasarub rhasarub's gravatar image

Have I have handicapped myself by not learning C or C++ ?

Absolutely not!

First of all, nothing prevents you from learning C or C++ if you wish so.

At the same time a lot of people make a successful and satisfying carrier in software development without ever learning these languages. So don't feel that you must learn them. (But if you decide to learn it, I think you will find it a rewarding experience.)

I see that for Udacity's CS101, Python is going to be used as the language. Shouldn't a basic programming course be taught using C so that people understand what is going on inside the machine? (and perhaps be able to answer interview questions in the future.)

C or, by extension of your logic, Assembler would be a bad choice for introductory class for couple of reasons:

  1. Students will need to pay attention to lot of small and arbitrary details, that will confuse them.
  2. Errors that they will make will be much harder to diagnose and find. That's especially bad in context of massive online course, when there is no TAs available to save you.
  3. They will not learn during the class how to do anything even remotely close to be considered cool (or useful) by the modern standards.
  4. As a result they will not end up any more employable after completing such class.

With C++ it's all of the above, plus, because of its size, complexity and heritage, freshman students will end up scared shitless of it, and unfortunately most likely programming in general.

link

answered 14 Feb '12, 22:08

NitNatNok's gravatar image

NitNatNok
38616

" ..freshman students will end up scared shitless of it, and unfortunately most likely programming in general." That was one of reasons which scared me off from taking CS in undergrad(had taken EE in undergrad). Had taken CS in high school & was horrified at the time I had to spend fixing compile time errors. But later I discovered I really enjoyed coding when I started to code in Java & Python & taken an algorithms course.
(14 Feb '12, 22:42) rbk rbk's gravatar image
C or, by extension of your logic, Assembler would be a bad choice for introductory class I don't agree about Assembler. My second language (shortly after BASIC) was Assembler on a ZX Spectrum. Or rather machine code, because I had to program it by POKEing bytes into memory, but I developed the programs on paper in Assembler. I found it much more enlightening than BASIC for learning how computers work, because it shows you what they "really" do and it's easy to simulate. I had an array of matchboxes for the memory locations and registers, cut-out paper arrows for pointers, hex or binary numbers on pieces of paper for values. I found it simpler than BASIC. Of course all that doesn't apply to C. I've always been scared of C's complexity.
(15 Feb '12, 00:00) lacucharita ♦ lacucharita's gravatar image
2
You should learn assembly at some point. It is the best way to develop an understanding of what computer programs actually are and how they work.
(15 Feb '12, 03:18) jholyhead jholyhead's gravatar image
1
Assembly was my first language. I would never recommend it as a first language, except to an EE with lots of Digital Circuit design experience. I have only used it professionally once, in 1986. But I think every programmer should learn it, to better understand what is going on under the hood.
(15 Feb '12, 06:33) EdK ♦ EdK's gravatar image
Everyone has a bias in favor of the way they learned to program. Like @EdK, I learned assembler first. I agree that it's useful to experience writing a language that sits close to the machine.
(15 Feb '12, 20:30) robrambusch ♦ robrambusch's gravatar image

I learned how to program using this excellent book : http://www.htdp.org/ .

Also see http://en.wikipedia.org/wiki/How_to_Design_Programs

Though this was not exactly related to you question , but I thought I should share this excellent resource.

link

answered 15 Feb '12, 01:12

chota's gravatar image

chota
688112

I don't think there is anything wrong with not having a degree and teaching yourself to program. However, there are many benefits with learning other paradigms in programming. Every language has its strengths and weaknesses. And learning the deep down internals of HOW computers operate (i.e. assembler) is very useful and makes you a better programmer.

This topic makes me think of a paper/web page I read by Dr. Novig, "Teach Yourself Programming in Ten Years" (http://norvig.com/21-days.html). Learning to program isn't about syntax. Anyone can google the syntax. In fact, when you learn to code in many different languages, sometimes the syntax walks over each other as you switch from one to another. However, what syntax does not teach you are concepts. And some of those concepts are very important.

Yes, having the language do garbage collection for you makes life nice and easy but there are many times where auto-GC can bite you in the ass. And not knowing why it's doing GC or when can hurt you too. Also, as you've noticed, many questions get asked of GC, pointers, memory leaks, and other topics. This isn't to make you necessarily look bad but instead are probably being asked so that the person understands your breadth of knowledge.

This makes me think of a problem I had at work about 15 or so years ago when I worked for SGI. We had a customer who had an issue with some of their hardware when they upgraded to a newer system. Ultimately it turned out to be a timing issue at the hardware layer between the system and their 3rd party where it was our system's timing being off by mere miliseconds... but still being out of spec. This was only determined by looking at the output of a protocol analyzer.

I only was able to detect this because I knew what the timing specification was and my mind had a glimmer of "what... that doesn't look right." But not knowing the underlying process, I'd never been able to solve the problem. Note that this customer had this issue for a good 6 months by the time engineering (us) had been asked to take a look.

Mel

link

answered 15 Feb '12, 20:23

melodybliss's gravatar image

melodybliss
2794

I've read that article by Prof.Norvig. I now realize that knowing what's happening behind the scenes would help me write better code(computers are no more humans who compute as in the times of Turing. So I have to know how the 'machines' work in order to give them better instructions!). I've found this book "Computer Systems: A Programmer's Perspective by Randal E. Bryant" to be useful in my pursuit. Started reading it along with K&R C book. Just that doing it on my own seems like it'd take more time than learning it at school :(
(15 Feb '12, 22:54) rbk rbk's gravatar image

A good system (and application) language with static/inference typing, garbage-collection, solid co-routine/channel like concurrency, easy and practical syntax, full compilation, near-or-equivalent C performance, many libraries and a large and supportive community is Google's new (2+ years) Go language (http://golang.org). There is excellent documentation, also a number of books and online-learning resources available (the go-tour from the home page). The language has been evolving as a new language does, but has reached a maturity level with a long-term stable "Go 1" release imminent. I believe we'll see many CS courses adopting Go along with Python as the system/dynamic languages of choice. I can certainly personally recommend it as a good and modern alternative to C, C++ and Java. I have adopted Go and Python for all my ML/AI work.

link

answered 14 Feb '12, 23:49

adrcuth's gravatar image

adrcuth
563

Google cant create a language and just expect it to be popular. Language popularity is a fickle thing. I wont go anywhere near one of these new languages until it has made it into the top 30 on the TIOBE index. Go is currently #45.
(15 Feb '12, 03:21) jholyhead jholyhead's gravatar image
There are lots of great, mind expanding, language that have not made the top 30 on TIOBE. Factor, Ocaml, Pure, Seed7, J and Logtalk come to mind.
(15 Feb '12, 06:35) EdK ♦ EdK's gravatar image
but none of them are serious contenders for real world projects. If I started a work project in Seed7, I'd be fired, and rightly so.
(15 Feb '12, 09:24) jholyhead jholyhead's gravatar image
Have a look at http://blog.golang.org/2011/12/building-stathat-with-go.html. (about http://www.stathat.com. Sometimes choosing (the right) new language may give you an edge that's hard to beat with the tried and tested. Yet to see how stathat does - it'll be interesting.
(15 Feb '12, 09:59) adrcuth adrcuth's gravatar image

I think that the programming language is a secondary problem.

I've learned how to write program using Pascal, I've learned Basic, Assembler, Fortran, C/C++, Scheme, Java, Visual Basic, Javascript, Lingo (macromedia director), C# and maybe someone else which I don't remember ;)
I never found big problem when I switch from one language to another.
Yesterday I've started learning Python, the first impression is "I don't like it" :D

I've also taken a look at http://mcsp.wartburg.edu/zelle/python/python-first.html and I don't like the idea of start with an easy language, I believe that people have to learn how to write "perfect" code from the beginning, even if it's hard, because if you code an algorithm in "correct" way, the language you use is irrelevant.

I think that if you really want to learn something about programming the best way is following a book like the one suggest by @chota, the programming language doesn't matter.

link

answered 15 Feb '12, 06:00

AINeko's gravatar image

AINeko
2.7k1320

1
What don't you like about Python? Also, starting with Python isn't the same as writing imperfect code. I don't see where you've made that association. With Python you'll spend more time working on the details of your algorithm and less time struggling with the idiosyncrasies of the language.
(15 Feb '12, 06:26) jholyhead jholyhead's gravatar image
@jholyhead My comment isn't against the choice of Python, I think that the language is almost irrelevant. I disagree with the fact that Phyton is better than C (or Java or Pascal, etc...) as first language; the important think is how you program. For educational purposes I prefer a "rigid" language, because that type of language forces the students to be rigorous. Of Phyton I don't like the fact that "... is a dynamic, interpreted language. Source code does not declare the types of variables or parameters or methods" (from Google's Python Class - Introduction). Obviously, I need to write some serious code before decide if I like it or no, probably I will use it like any other language.
(15 Feb '12, 09:17) AINeko AINeko's gravatar image

If you already know how to program and are just looking at other languages to fill in concepts, I'd suggest you look at Seven Languages in Seven Weeks: A Pragmatic Guide to Learning Programming Languages by Bruce A. Tate. I was planning to go through it before I got sucked in to online classes by aiclass. In fact it might be a good basis for a class we run ourselves (AKA AIQUniverSity).

Ruby, Io, Prolog, Scala, Erlang, Clojure, Haskell. With Seven Languages in Seven Weeks, by Bruce A. Tate, you'll go beyond the syntax-and beyond the 20-minute tutorial you'll find someplace online. This book has an audacious goal: to present a meaningful exploration of seven languages within a single book. Rather than serve as a complete reference or installation guide, Seven Languages hits what's essential and unique about each language. Moreover, this approach will help teach you how to grok new languages.

For each language, you'll solve a nontrivial problem, using techniques that show off the language's most important features. As the book proceeds, you'll discover the strengths and weaknesses of the languages, while dissecting the process of learning languages quickly--for example, finding the typing and programming models, decision structures, and how you interact with them.

Among this group of seven, you'll explore the most critical programming models of our time. Learn the dynamic typing that makes Ruby, Python, and Perl so flexible and compelling. Understand the underlying prototype system that's at the heart of JavaScript. See how pattern matching in Prolog shaped the development of Scala and Erlang. Discover how pure functional programming in Haskell is different from the Lisp family of languages, including Clojure.

It's not going to make you an expert in any of them but it sounds like fun/another chance to fry your brain with overwork.

http://www.amazon.com/Seven-Languages-Weeks-Programming-Programmers/dp/193435659X

link

answered 15 Feb '12, 12:26

robrambusch's gravatar image

robrambusch ♦
24.2k454261

edited 15 Feb '12, 12:28

I'll second that!
(15 Feb '12, 12:34) EdK ♦ EdK's gravatar image
It's a good book, but you need to be a good programmer to get through it.
(15 Feb '12, 12:59) jholyhead jholyhead's gravatar image
1
This is the part where I say "Aw, shucks" and scrape my toe in the dust ;-) Seriously, I think the barrier to entry will be a little lower for people who aren't already "good" programmers if a number of us do this together. Being in a "class" with a "schedule" will help keep us motivated to do the work. I learned to program via the apprenticeship model. That is, I was taught by actual humans who made their living from writing software in a business setting. This isn't quit the same thing but believe me that it helps to have someone besides Google available when you have a question.
(15 Feb '12, 13:06) robrambusch ♦ robrambusch's gravatar image
@robrambusch it would be nice to do, if there were not too many courses on the list already. Maybe in the summer, when official Universities/course providers will have a break :)
(15 Feb '12, 13:32) Gundega Gundega's gravatar image

Learn a bunch of languages. As a professional programmer, I can tell you these are useful:

Java C C++ (not the same as C!) bash Python/Ruby JavaScript/ActionScript/Lua

Lua is particularly handy when used with C or C++.

Also you should learn assembly, Lisp, and a functional language such as Haskell, even though you may never use them, they will affect you.

Also learn JSON, XML, CSS, and other languages.

link

answered 15 Feb '12, 23:11

mlepage's gravatar image

mlepage
1.0k8

When applying for a job without a degree, the employer doesn't have a strong base to know if you have the background to be a program. And if you only know one language, you probably don't. (You've said you know two languages, I did read your post.) Not knowing the concept of a memory leak or pointer is problematic. A lot of languages have the concept of pointers/references. And you can have a memory leak in Java even where there is garbage collection. Think about static collections.

link

answered 14 Feb '12, 22:07

Jeanne%20Boyarsky's gravatar image

Jeanne Boyarsky
34118

I guess practicing to code in a language which enforces manual cleanup would make me think about memory leaks while I code. When using Java in most common situations it's taken for granted that garbage collector will do the job. Now I'm starting to think that I should start cranking up some C code & at least get the basic memory stuff cleared up in my head.
(14 Feb '12, 22:52) rbk rbk's gravatar image
and about knowing only 2 languages.. I've played around with Ruby & Haskell..tried solving project Euler problems with them. But when it comes to familiarity(most recently used- fresh in the head), I'll have to go with Java & Python.
(14 Feb '12, 22:54) rbk rbk's gravatar image

I think you should learn langages that use different paradigms. Learn both staticly typed, dynamicly typed languages, the only untyped langage I know of is Assembely, and you should learn that too. Learn functional, and logic programming. I recomend the book Concepts, Techniques, and Models of Computer Programming

link

answered 15 Feb '12, 06:45

EdK's gravatar image

EdK ♦
3.3k51134

Your answer
toggle preview

Follow this Question via Email

Once you sign in you will be able to subscribe for any updates here

Q&A Editor Basics

  • to upload an image into your question or answer hit
  • to create bulleted or numbered lists hit or
  • to add a title or header hit
  • to section your text hit
  • to make a link clickable, surround it with <a> and </a> (for example, <a>www.google.com</a>)
  • basic HTML tags are also supported (for those who know a bit of HTML)
  • To insert an EQUATION you can use LaTeX. (backslash \ has to be escaped, so in your LaTeX code you have to replace \ with \\). You can see more examples and info here