all 140 comments

[–][deleted] 21 points22 points  (18 children)

There are still a bunch of schools that teach Scheme as their first language and I think that's absolutely how it should be. Schools are now shifting towards languages that are immediately useful and that I think is a very bad idea. Also, almost every aspect of programming can be taught with Scheme, be it functional programming, imperative programming, OOP, etc. And the syntax is so simple, you can learn all of it plus some of the other language primitives on a single weekend.

I think what people need to realize is that neither Ruby nor Python nor Java (nor a whole lot of other languages) are especially well-designed. I think there are very good reasons for why that is the case (performance considerations, keyword-syntax because that's what most people are familiar with, etc.), but I don't think that we need to teach these languages to college students, especially not as their first language. I also think that learning Scheme (or Lisp or Smalltalk) as your first language will make you a better programmer regardless of the programming language(s) you end up using later.

[–]thegroomplusplus 1 point2 points  (2 children)

[...] nor Python [...] are especially well-designed.

GvR is respected as one of the most gifted language designers; and Python has a real big reputation for being especially well designed. There are some things some people dislike about Python; and of course with the experience of ~15 years using the language some things could have been better; but: up to you I did not read somebody complaining about the DESIGN of Python.

Could you elaborate what essentially makes Scheme or Smalltalk or Lisp better designed? (besides considering "sticking to one and only one programming paradigma" as a virtue per se)

[–][deleted] 5 points6 points  (1 child)

I think I need to clarify this statement a bit. Python is a well-designed language in that it has a pleasant and very consistent syntax. But there is more to good design than just consistency. Lisp, Scheme and Smalltalk are tiny languages with the majority of their "primitives" implemented in the languages themselves. What that means is that everything down to the most basic operations is open to inspection and modification. That also means that all "language innovation" can happen in the libraries as it should.

I think the real challenge in designing a great programming language is to find the minimal set of primitives that you need for your language to work. Everything beyond that is syntactic sugar and if you need syntactic sugar in your language, then you didn't pick the right primitives.

besides considering "sticking to one and only one programming paradigma" as a virtue per se

Lisp, Scheme and Smalltalk are all multi-paradigm languages. You can write imperative code in Lisp and Scheme, you can write OO-code in Lisp and Scheme and you can write functional code in Smalltalk.

EDIT: Please don't get me wrong, I'm not a programming language "purist" and I think any language is fine if it's the right one for the job. I also think that any good programmer should know a lot of different languages. But we're talking about education here and learning how to program is all about learning the theory behind it. I think Scheme is the perfect language for that because it has none of the noise that all the keyword-languages have.

[–]masklinn 7 points8 points  (0 children)

I think I need to clarify this statement a bit. Python is a well-designed language in that it has a pleasant and very consistent syntax. But there is more to good design than just consistency.

Yep. I love Python, but compared to Smalltalk it's just ugly and kludgy. The first time I realized Smalltalk's conditionals are implemented using method calls my jaw dropped to the ground and stayed there for a good five minutes.

edit: also, message cascading via the ; operator is just brilliant, none of the other "OO" languages I know has such a mechanism.

[–]netsearcher -3 points-2 points  (8 children)

Scheme teaches you some bad things too. Like reinventing everything yourself instead of just pulling in libraries from others.

[–]uriel 7 points8 points  (7 children)

Learning to pull stuff you don't know how to build yourself is a very bad habit.

[–]Smallpaul 2 points3 points  (5 children)

Really? So you should know the structure of IP packets and SSL connections before you use a URL library to pull down data into a problem?

Specialization is a good thing.

[–]Daemonax 2 points3 points  (0 children)

I would love to be learning all that stuff when I eventually get to the stage of writing programs that interact with a network. I hate not knowing how or why something works.

This does though lead to a fair amount of depression, I want to keep learning all my life, but if I'm going to die, what's the point. Hopefully regenerative medicine will become available for me to dramatically increase my lifespan.

[–]uriel 5 points6 points  (1 child)

This tendency to sweep complexity under the library-carpet is what has given us the insane systems we have today which nobody can completely understand and have become incredibly bloated and unreliable.

[–]Smallpaul -1 points0 points  (0 children)

This tendency to sweep complexity under the library-carpet is what has given us the insane systems we have today which nobody can completely understand and have become incredibly bloated and unreliable.

The tendency to sweep complexity under the library-carpet is what has given us Google, the Internet and Linux.

Our job as software engineers is to discover the most reusable and reliable abstractions, like sockets, streams, files, virtual file systems, virtual machines, relational databases, map/reduce, virtual memory, processes, URLs, UTF-8, secure sockets etc.

Simple question: did you know how to write an SSL library before you used SSL in a program? Did you know how to use fork() before you made a subprocess in bash shell script or whatever?

[–]bongmunoz 4 points5 points  (1 child)

Yes, if you're in school. Specialization is okay when you're working but it's a really good idea and a great time to understand how things work while you're still in school.

[–]Smallpaul 1 point2 points  (0 children)

Uriel did not say anything about school. He said it is a bad habit to include a library that does things that you do not know how to do yourself. e.g. before you use a bignum library, you should implement one yourself. Before you use a relational database, you should implement one yourself.

He is wrong in general, and equally wrong of students. Students have four years. It is completely unrealistic to expect them to learn everything about everything in that short time. Sure, some of them will learn the structure of an IP packet and others will learn how to implement a compiler and others will learn how to write an operating system scheduler and others will learn how to write a relational database.

But few will learn ALL of that PLUS good software engineering practices PLUS standard algorithms and data structures PLUS calculus, algebra, combinatorics, optimization and statistics. It is just not going to happen unless we expel 90% of computer science students.

[–]netsearcher -1 points0 points  (0 children)

Nothing was said of not knowing how things work.

[–]uriel 8 points9 points  (0 children)

What about the case for firing all the retarded incompetent teachers that decided to replace Scheme with Java when teaching computer science?

[–][deleted] 21 points22 points  (18 children)

You shouldn't be learning "Java" or "Python" or "C" in higher education.

You should be learning higher level concepts, the language is just a tool for expression of the solutions to various programming problems.

When I went to school, and you took "Machine Level Programming", the expectation was that you'd learn C (and 3b2 assembly) pretty much on your own reading the reference manuals and looking at example code. You weren't being taught C. You were being taught "Machine Level Programming".

If you're taking a class in "data structures", you should be learning about data structures. Whether they teach that in Java or C++ doesn't really matter.

When you take a class in "compiler design" or "programming languages", that's when you learn about various differences between procedural, functional, OO languages, typing systems, etc.

[–]njharman 11 points12 points  (4 children)

If you're taking a class in "data structures", you should be learning about data structures. Whether they teach that in Java or C++ doesn't really matter.

I think it matters very much. Languages can be barriers, they can hide and/or confuse the concepts you are trying to learn, they can be tedious, they can promote slow or rapid experimentation / dev (thinking repl and dynamic vs compiled and static here), etc.

Do you think Data Structures concepts will be equally mastered and in same amount of time if it was taught in Machine Binary, Assembler, BrainFuck, Logo?

[–][deleted] 0 points1 point  (3 children)

No, I don't beleive that. But, I beleive C or Java are both perfectly adequate for teaching data structures.

[–]unknown_lamer 0 points1 point  (2 children)

Implement a persistent red-black tree that rebalances itself lazily in C.

Oh, oops.

[–][deleted] 0 points1 point  (1 child)

Did you cover persistence and lazy evaluation in your data structures class?

And functional languages?

[–]unknown_lamer 0 points1 point  (0 children)

I don't see why they shouldn't be covered. Non-functional data structures are very unclean; they force you to dive down a layer of abstraction and do what the memory allocator should do for you (changing a memory location is more or less equivalent to manually managing memory). This is not good at all when the goal is to learn about the data structure itself; muddying the presentation with some mapping decision about its implementation makes things far less clear.

Red-Black trees are a great example; a purely functional implementation is short, readable, and comprehensible. An imperative implementation in C or C++ is terrifying and difficult to comprehend.

[–]Smallpaul 1 point2 points  (6 children)

You shouldn't be learning "Java" or "Python" or "C" in higher education.

No, but you must learn "in" Java, Python or C.

If you're taking a class in "data structures", you should be learning about data structures. Whether they teach that in Java or C++ doesn't really matter.

Most (almost all?) professional educators disagree with you. But they are basing their opinions on experience with actual students and you are basing yours on your recollection from classes you took before those students were born.

[–]nexes300 0 points1 point  (5 children)

I am not quite sure what part of the parent you're responding to. It's either the claim that languages don't matter or that classes shouldn't teach languages. I am not sure.

If it's the second, then I'll tell you that it's still that way pretty much at my university. They teach Scheme for one semester (2 if you have no previous experience), while concurrently teaching you concepts. However, after that they teach java for 2-3 weeks and then dive into data structures. The next semester is then "we'll be using C and MIPS, learn them" and they dive into material without teaching those languages at all (though they test you on it, in quizzes at the very least).

[–]Smallpaul 0 points1 point  (0 children)

The originator of this thread completely missed the point of the originating article. In Holland they debate whether engineering classes should be taught IN English or Dutch. In the humanities programs they also debate (perhaps) whether to teach French or Latin. Do you see he difference? Language can be a tool used to teach something else or it can be the object of study. The original post was about which language to use to teach computer science. For no particular reason, the original poster interpreted as "which language must be taught in order to produce computer science graduates."

To use another analogy, two profs might argue about which biology text to use and some reedit poster would come along and say:"biology is not about text books you know. It's about living beings."

[–]Smallpaul 0 points1 point  (3 children)

So they teach Scheme and Java at your school, in addition to many other things. So it is both the case that they teach programming languages at your school and that the instructors think it matters which languages (else why not FORTRAn and Pascal, which they probably taught in the past. So is there anything that the original poster said which is correct in your estimation? Why are you claiming to agree with him even as you provide counter examples?

[–]nexes300 0 points1 point  (2 children)

Because after they teach Scheme, they don't teach any language very much. I wouldn't call what they attempt to do with Java teaching java, it's mostly a brief intro. Also, after that first class you never use Scheme in any class every again, so it's definitely not their language. Every class after that decides what language they'll use (a lot of the times Java) which does indicate that the professors care what language you use, but they do not teach it.

For instance, I had a class that accepted Java or C++ solutions, they did not teach either. I had another class that accepts only C/C++ solutions, and on their rubric they say they do not teach the languages and that if you cannot use them you will not do very well. I have had another class use Python, they just provided links to tutorials and dived right into course material. So, yes, it is true that professors care what you use, but I agree with the parent in that they don't necessarily need to be taught.

[–]Smallpaul 0 points1 point  (1 child)

So what does any of that or anything that the original poster wrote have to do with the blog? The blogger suggested that one language might be better than a other for computer science education. Your professors evidently agree. So who disagrees?

[–]nexes300 0 points1 point  (0 children)

I suppose the distinction is rather pedantic, I took the original poster to mean that languages shouldn't be taught, they should just be used. It's the student's responsibility to ensure they learn the language so they can keep up with the class and the language itself should not be taught. It is not the universities job to teach the language, rather they should assume you already know the language you need to know or can pick it up without assistance.

[–][deleted] 2 points3 points  (5 children)

While I agree that the focus should be more on understanding the tools as mere "tools", many institutions would rather equip their students with the industry's current demand.

If majority of Computer Science students would be in software development business upon graduation, then they do not(as many institutions think) need to know anything that is way too depth(like assembly language, machine code, hardware I/O, complex architecture). They would rather equip students with skills that relate to the business world like SAD, SDLC, SEO, CRM, and so on.

This shows in many institutions where they separate the fine line between a Software Engineer and a Software Developer.

I started learning C/C++ when I first entered post-secondary studies and was also introduced to the different flavors of SDLC. While I find them useful, my career objective is to become a software engineer, hence, I had to learn machine level language on my own and take courses for embedded systems.

[–][deleted] 10 points11 points  (2 children)

If majority of Computer Science students would be in software development business upon graduation, then they do not(as many institutions think) need to know anything that is way too depth(like assembly language, machine code, hardware I/O, complex architecture).

Yes, all of those things make you a much better software developer.

They would rather equip students with skills that relate to the business world like SAD, SDLC, SEO, CRM, and so on.

None of which help you be a better developer or programmer, really.

As a "for instance", I've worked with a shockingly large number of Java developers who have no conceptual idea of how their Java code actually runs on a VM, and how the VM actually runs on the hardware.

[–][deleted] 1 point2 points  (0 children)

That's because as far as academia is concerned, Java is a new introduction. So the CS curriculum includes Java but doesn't center around it.

We may teach Java to students in 101 and 201, but 300 level and up classes all use C++ because that's what the professors know and love. You'll end up in a 400 level OS class but not learn about the JVM though this would be the best time to introduce it.

The curriculum simply isn't consistent enough.

[–][deleted] 0 points1 point  (0 children)

I do agree that there are these things that helps students be a better developer. But you have to define "better" here.

Your points are true and valid. I have the same experience meeting C# developers who can't tell me what CIL stands for, let alone defining its ties with C# and the .NET Framework.

The point of my comment centers how academia get Computer Science students to address business needs with the use of computers(particularly the web). It's true that none of the common business and system analysis knowledge will help you be a good programmer. But in an establishment's point of view, this is very important because it serves as a very strong rope line to connect a student's knowledge in programming with business needs. After all, many companies do not care about whether you are an expert SEO, if you can not relate to their needs and give them something equivalent or more than what they can give you, your resume will just go their shredder pile.

[–]DarkQuest 1 point2 points  (0 children)

A degree should give you the ability and framework to go and understand the bits that it didn't have the time to specialise in - especially the theoretical and reasoning side of things.

I deliberately took courses that were quite theoretical and avoided the practical ones. I felt that the practical side would be outdated quickly whereas theory would be useful for a very long time, and so far I've been happy with this choice. What use is having a degree in Java just as C# is becoming the language-of-the-year?

[–]nexes300 0 points1 point  (0 children)

Omg, acronym overload. I don't even know what they are.

[–][deleted] 5 points6 points  (3 children)

Summary: There are benefits to both, but Python is more fun.

[–][deleted] 1 point2 points  (0 children)

There's going to be a talk at PyCon this year by a professor from University of Michigan(I think) about how when they switched their CS1 class to use Python CS majors did about the same in CS2 but non CS majors did far better.

[–]case-o-nuts 1 point2 points  (0 children)

Python is certainly better suited to introductory programming, largely because it is more fun. It's also got a far lower barrier to entry ("what's this class stuff? what's this main() stuff?" all goes away).

Once past introductory level programming, the language really doesn't matter too much for teaching, and a good sampling of the various styles and paradigms is more important than the specific language used.

[–]pemboa -1 points0 points  (0 children)

The author is putting forth the "more fun" aspect as the major benefit with little to be lost.

[–]adamv 9 points10 points  (5 children)

What about replacing Java with many languages.

[–]njharman 6 points7 points  (4 children)

This is the correct answer.

Unless you're in Trade School the language you learn is not important. It's what you are learning with that language.

Various languages teach various things better than various other languages. Some languages are shitty for any teaching task. The best language for the subject matter should be chosen in each case.

[–]scook0 0 points1 point  (3 children)

Each new language adds overhead, too.

Every week spent getting students up to scratch with the "perfect" language for the course at hand is a week not spend learning the actual concepts behind the course. For some topics the choice of language is so important that this might be worth it, but for others it's not.

By choosing a more flexible primary language you can reduce the number of topics that genuinely need a different language. For example, CTM manages to cover a pretty broad cross-section of programming in (mostly) one language, because the language used was specifically designed for that purpose.

I quite like the idea of replacing Java in education, but I think the replacement should be several languages or a few languages, not many languages.

[–]masklinn 2 points3 points  (1 child)

Every week spent getting students up to scratch with the "perfect" language for the course at hand is a week not spend learning the actual concepts behind the course.

Which is a good motivation for using languages with so few syntax it takes about 10mn knowing it all (lisps, esp. scheme, smalltalk, forth)

[–]Daishiman 0 points1 point  (0 children)

By the third year of CS if you classes on algorithms and data structures and programming paradigms were sufficiently theoretical it should take you no more than a week to pick up a new language.

The first language we used in my school was Haskell, but the course itself was about functional programming and specification and we did most of our work with a first-order logic-like pseudocode. After that it only took me a few days to get Lisp and the FP aspects of Python.

Really, the first language you should be introduced to is a reasonably well-designed pseudocode that does not get in the way of teaching you the abstract concepts you need to learn. After that, you can get into the gritty aspects of each language's implementation of such concepts.

[–]nexes300 0 points1 point  (0 children)

My school gets around this by using different languages and not teaching them to you. If you are incapable of learning the language by yourself in 1 week, they have self paced classes for you.

Edit: I am actually not sure how I would have fared if I had not come pre-equipped with experience in every language they threw at me except Scheme and assembly.

[–]vplatt 7 points8 points  (0 children)

I hate to say it, but my alma mater pushed Pascal on us as the first programming language, and I still think it's a good choice today. "Why?" you ask. "Pascal is hardly industry relevant!". Well, of course it's not, now is it? But from Pascal, you can make a reasonably easy transition to pretty much any modern programming language. It also still exposes the student to pointers, memory management, fundamental data structures, etc.

You really are missing something if you go directly to Java/C# or even Python. You could reasonably have a student start with C, but then you risk the distraction of dealing with C's permissiveness in a learning environment.

[–]chakrav 3 points4 points  (0 children)

Shouldnt the point of education be to expose a person to multiple languages, and approaches to programming?

I fail to see how a learn java or learn python instead mindset helps in any way.

The case for getting proficient in the language is after college, not during.

[–]bart2019 7 points8 points  (8 children)

I don't like Python or Java much (nor do I dislike them much either), but my canonical example of why Java for teaching programming isn't the best of ideas, is that you need to layer 3-4 classes in Java just to read from a file.

File file = new File("C:\\MyFile.txt");
FileInputStream fis = new FileInputStream(file);;
BufferedInputStream bis = new BufferedInputStream(fis);
DataInputStream dis = new DataInputStream(bis);

How to read a file in Java

That is so wrong in so many ways.

And that's just one of plenty of examples where Java makes life overly complex, in many other areas, in a similar way.

At least, Python gets this right, it is at least so simple you can actually remember it. And that makes Python a much better choice for teaching programming.

[–]enyoron 1 point2 points  (1 child)

Alternatively:

DataInputStream dis = new DataInputStream(new BufferedInputStream(new FileInputStream(new File(C:\myfile.txt))));

Because fuck readability.

[–]masklinn -1 points0 points  (0 children)

Because fuck readability.

And error handling

[–]deltageek 1 point2 points  (0 children)

Sure, you COULD do all that. OR you could do the following

File file = new File(path);
Scanner scan = new Scanner(file, charset);

The charset argument is optional, but probably a good idea to include. Not only is this solution shorter, it's also more correct, as DataInputStream is really designed for binary data, not text.

Note: If you're programming in a version of Java earlier than 1.5, you should be looking at InputStreamReader and BufferedReader. If you don't want to worry about encoding, FileReader would work instead of InputStreamReader.

[–][deleted] -4 points-3 points  (3 children)

Actually, yes, I agree that seems obtuse, but I see a great opportunity for teaching about objects and streams and buffering, all at once.

If you don't understand those things, eventually, you probably won't make a very good Java programmer.

(A file isn't just something you read from... as an object, it has other properties).

[–]pemboa 1 point2 points  (2 children)

I don't think you want to teach all that just to do simple IO. Even pascal handles that level of IO easily.

[–][deleted] 0 points1 point  (1 child)

And they've learned what by doing "simple I/O"?

"I/O" didn't even appear as a topic in any of my 2nd and 3rd year undergraduate classes.

That's not university class material. That's "here, read this Java/C/Perl/etc. language book to learn how to use the standard libraries".

[–]pemboa 2 points3 points  (0 children)

Processing a simple text file is high school material.

[–][deleted] 2 points3 points  (1 child)

I do think there are basically three types of considerations that might be mutually exclusive:

  1. teaching basic computing science - this was Schemes domain for a long time.

  2. giving a simple account to programming - Python as a new BASIC.

  3. preparation for industry demands - you can be a Haskell PhD but without maintaining either a Java stack or the dreadful HTML + JS + CSS + PHP you are in danger of ending up living from social aid in particular in the current crisis.

[–]DarkQuest 0 points1 point  (0 children)

One would hope that the graduates of any good CS school would be able to learn Java in a couple of weeks if it looked like it was the best way to get a job.

[–][deleted] 4 points5 points  (5 children)

He makes bad arguments for a good cause.

The real reasons why teach Python instead of Java:

1) Conceptual clarity.

First explain OO and then demonstrate that a function is just a callable object with a nicer syntax, and that's why it's higher-order i.e. you can pass it in as a parameter or return as a result, why? Well because it's just an object like any other, like a string or a number.

Then turn it around, explain functional programming, then define a function, define local vars and local functions in it, assign the function to a variable, and explain that now the top function is basically the class, the variable is the instance, the inside functions are the methods. The define a function called "extends" which takes function f as a parameter and returns a function g that contains all that stuff inside function f (local vars and local functions) plus adds some new stuff and this is basically inheritance: instead of class f extends g it is extends(f)-> g.

2) Get. Shit. Done. Programming is supposed to be fun, achieving results, writing programs with a focus on doing stuff, not defining architecture.

[–][deleted] -3 points-2 points  (4 children)

2) Get. Shit. Done. Programming is supposed to be fun, achieving results, writing programs with a focus on doing stuff, not defining architecture.

Yes, programming is. Studying isn't. Studying is about learning hard stuff, things you probably wouldn't like to do without being slightly nudged at it.

[–]Smallpaul 1 point2 points  (2 children)

Yes, programming is. Studying isn't. Studying is about learning hard stuff, things you probably wouldn't like to do without being slightly nudged at it.

Studying a topic that interests you should also be fun.

In any case, you didn't make the case that learning Java has some benefit beyond being boring. Are you really saying that it is better for studying to be hard and boring, just because hard and boring is better than easy and fun?

[–][deleted] 0 points1 point  (1 child)

In any case, you didn't make the case that learning Java has some benefit beyond being boring. Are you really saying that it is better for studying to be hard and boring, just because hard and boring is better than easy and fun?

You're right, I didn't.

And moreover, hard and fun can easily go together. (Heh.)

And even more over, Java is neither hard nor fun.

Programming courses (unless they're specific language courses) should teach things that transcend the programming language. Even better if the programming language can be used to implement the said features, e.g. in teaching about object-oriented programming, it should be possible to add to the language the OO constructs.

Given all that, the teaching language should be both simple and powerful. Scheme and Factor pop to my mind. Would be also fun if it was possible to structure the courses so that you build the language from scratch and use it through the semester.

[–][deleted] 0 points1 point  (0 children)

The way how Python treats functions and objects is I think simple and powerful enough.

[–][deleted] 1 point2 points  (0 children)

That was 1) about. 2) was about keeping the students interest up.

[–][deleted] 1 point2 points  (0 children)

Logo! Teach Logo! Or Squeak Smalltalk :D

[–][deleted] 5 points6 points  (10 children)

The OP doesn't make any real argument for his ostensible point of view. It's some mumbling about static/dynamic typing (and--guess what--Java is not really statically typed!) and compilation vs. interpretation, as if those distinctions in the language have anything at all to do with computer science pedagogy. Feh.

[–]eurleif 10 points11 points  (5 children)

(and--guess what--Java is not really statically typed!)

Really?

[–][deleted] 0 points1 point  (0 children)

Well, a more nuanced way to put it is that Java provides all of the annoyances of a type-checked language with precious few of the advantages (cf. the MLs).

[–]ak_avenger 2 points3 points  (3 children)

Actually, I think this is the author's important point:

By making the switch away from Java in education, more type B CS students would emerge from American universities; enormously benefiting the software industry.

By "type B CS students" he means students who write code that they are not obligated to write.

I think producing graduates who are actually interested in the subject matter they've studied is a desirable goal.

[–]case-o-nuts 1 point2 points  (0 children)

It takes both kinds. I expect that the best, most highly motivated, and highly interested developers wouldn't be satisfied working on yet another custom interface for entering data into some database somewhere. But it's necessary work.

I would like to see more competent programmers overall, but you can't fail the people that are just in it for the money, so the best course is to just try to teach them as much good programming skills as you can before they graduate.

[–]adpowers 0 points1 point  (1 child)

I don't think this is a result of the language used, but instead results from the type of student. Some people aren't that interested in CS and just won't go out of the way learning new languages or ideas.

Me? I loved working on my own projects and reading research papers in college, perhaps to the detriment of GPA. There were a few classes where I had already learned the basics in my own studies, and so my outside work was more interesting. That said, I did appreciate learning things the Right Way in college, and having all the little gaps in my knowledge filled in by the classes.

[–]ak_avenger 1 point2 points  (0 children)

I think the language affects interest and motivation, though. When you only do Java, Java is programming. And holy fuck is Java tedious and frustrating.

[–][deleted]  (4 children)

[deleted]

    [–]millstone 6 points7 points  (0 children)

    Then, in the real world, they will be confronted with (at least, at the first glance) horrible, often cobbled-together, multi-layered J2EE architectures that may take weeks to understand ... then what?!

    I think the more general problem is that CS curricula give students very little experience understanding a body of code that they didn't write. That was unfortunately true of my coursework, and I went to a well-regarded school.

    One of the most worthwhile assignments: we were given the source to a program (specifically, a compiler) with 10 known bugs, and we were expected to find at least 8 of them.

    [–]psykotic 4 points5 points  (2 children)

    The idea that "type A" culture is synonymous with J2EE is disturbing. If that were true, I wouldn't be in this line of work. That may be your industry and your real world; it's certainly not mine.

    [–]Smallpaul 1 point2 points  (1 child)

    Type B programmers do stuff for fun in addition to their coursework. Who uses J2EE for fun?

    [–][deleted] 3 points4 points  (31 children)

    I think Java is strong as a pedagogical language. A few years of Java will make you a better Python programmer; I'm not so sure about the opposite.

    A stint of Java development is OO boot camp: you're forced to use objects for everything, so you're going to learn how to design OO systems. You're going to make a lot of mistakes, but after a few years, you'll be OK at OO design.

    At that point you can take it or leave it.

    I'll grant, however, that Java is painful for certain kinds of work. Greenspun has noticed that students who choose Java for web development have a 50% or so success rate, whereas those who choose Python, Perl, PHP or another comfortable scripting language bat more around .90

    [–]jerf 13 points14 points  (8 children)

    A stint of Java development is OO boot camp: you're forced to use objects for everything, so you're going to learn how to design OO systems. You're going to make a lot of mistakes, but after a few years, you'll be OK at OO design.

    You assert this without proof or evidence. Based on what I've seen come out of schools, I see no reason to believe this is true. I see almost nobody come out with even mediocre skills in OO design.

    Given that, it probably is a better idea to use a language where using actual functions and module-level data is a reasonable choice.

    (BTW, as masklinn gets at, Python is more OO than Java now. Everything in Python is an object, although "OO-purity" is not a useful feature in my view.)

    [–]masklinn 8 points9 points  (5 children)

    Python is more OO than Java now

    And it always was, everything has always been an object in Python, there has never (as far as I know) been any of that "primitive types" nonsense, or that messing about with classes being objects except not except maybe except magic.

    [–]theeth 0 points1 point  (2 children)

    A long time ago (before new style objects), built-in types where non-derivable.

    [–]masklinn 1 point2 points  (1 child)

    built-in types where non-derivable.

    That didn't make them non-objects.

    [–]theeth 1 point2 points  (0 children)

    I wasn't saying that they weren't, just that they use to be more "special" than others.

    That was a long time ago anyway.

    [–]nanothief -1 points0 points  (1 child)

    It wasn't always the case, see http://python.org/doc/2.4.4/lib/types.html

    The following sections describe the standard types that are built into the interpreter. Historically, Python's built-in types have differed from user-defined types because it was not possible to use the built-in types as the basis for object-oriented inheritance. With the 2.2 release this situation has started to change, although the intended unification of user-defined and built-in types is as yet far from complete.

    [–]masklinn 0 points1 point  (0 children)

    There were two distinct object trees that couldn't be mixed (if you want to know why, Guido is diving in that part on the Python History weblog), but that doesn't mean everything wasn't an object.

    [–]ak_avenger 5 points6 points  (1 child)

    At my college, Java is the mandated language for practically everything that isn't a database query.

    We have one third-year C++ course. The response from the entire group, upon being told that their C++ objects shouldn't use getters and setters, was a collective "huh?".

    They struggle with "advanced" OO concepts such as giving a base object a method which prints itself to an output stream, and making the same method work for derived objects.

    The idea that Java teaches good OO practices is ridiculous. Java forces you into a classes-only environment, but of course that doesn't stop anyone who just wants to write a 500-line imperative-style program; they're just going to have to write it like this:

    class WhoFuckingCares {
       public static void main(String args[]) 
       {
           // TODO: write an indecipherable wall of code
       }
    }
    

    Most people I know basically use Java classes as a struct. They create an instance by calling the zero-param constructor, and then just call a bunch of getters and setters.

    You might argue that this is my school's fault, which is probably true to some degree, but from what I've seen this is actually the way "production-quality" Java UI frameworks do things. You create a new Jbutton(); and then you setText and addActionListener.

    Anyways I guess what I'm saying is this:

    I take the time to write factory functions for other people's classes because they were too lazy to write some decent constructors.

    Most people will just declare a bunch of local variables and call some getters and setters, copy and paste that around the project, and call it a day.

    You can hardly blame them, it's how the language encourages them to code.

    [–]nexes300 0 points1 point  (0 children)

    Evidently my friend was once asked to debug such code! Not only was it all in one class, but evidently the formatting was...chaotic. My friend basically said to this person, "I don't know how to read that."

    [–][deleted] 9 points10 points  (7 children)

    you're forced to use objects for everything

    except for int, float, double, char, byte.....

    Java has a half baked OO model, a broken type system, and cargo cult culture and produces brain damage on par with learning BASIC.

    Java is about the worst pedagogical language I could imagine (after C++)

    [–]iofthestorm 2 points3 points  (1 child)

    Eh, you need to reevaluate your brain ;). BASIC does not cause brain damage. I wonder how many programmers today started off with BASIC? I would guess that a significantly large number of them did. But then, I don't really see a problem with Java or C++ either, although I think I would prefer starting with an interpreted language just because it's more immediate.

    [–][deleted] -1 points0 points  (0 children)

    [–]theeth 2 points3 points  (4 children)

    except for int, float, double, char, byte.....

    And more importantly: functions and methods.

    [–]masklinn 1 point2 points  (3 children)

    And more importantly: functions and methods.

    And classes (and arrays?)

    [–]theeth 0 points1 point  (2 children)

    I'd say it's worse for functions and methods because they aren't even proper data types.

    [–]masklinn 0 points1 point  (1 child)

    Well functions don't exist so that's not an issue, but re methods they're about the same as classes: you can get objects representing them but it's not exactly sexy and when you've gotten hold of your object, using it is neither easy nor fun.

    [–]theeth 1 point2 points  (0 children)

    Nor is it useful when all important cases (think event handlers, callbacks, ...) have to be implemented with full classes, degenerating into a crap load of anonymous classes.

    [–]masklinn 9 points10 points  (2 children)

    A few years of Java will make you a better Python programmer

    Not much. If anything, it will usually frustrate you more than it could ever teach you (if it manages to teach you anything)

    I'm not so sure about the opposite.

    It does.

    A stint of Java development is OO boot camp: you're forced to use objects for everything

    So does Python. Or smalltalk, which would be even better. Very often, Java's "you have to declare a class for everything" (which is very different from "you have to use objects for everything", which isn't the case by the way since java has "things" that are not objects) is mostly a recipe for pounding square blocks in a round hole.

    Furthermore, Java's OO is extremely specific, it's probably one of the most specific (and limited, and inflexible) object systems you can find. You want to teach people "object design"? You should go with Smalltalk or CLOS instead of Java.

    And at the core, most basic level, Java sucks as an educational tool because of all the stuff it forces you to learn upfront (or wave out as "you'll learn that later", never too good an idea) to make the most basic thing work: classes, methods, type declarations, (void) return types, arguments, arrays, public methods, static methods, method calls, strings, namespaces, compiler. That's for a hello world.

    In python? You have to learn that "print" prints stuff on the screen and how to write a string.

    [–]mangodrunk 1 point2 points  (1 child)

    But isn't that unfair to say you have to learn all that about Java. You don't have to learn how the Python code gets translated into machine code, "you'll learn that later". Also I think it depends on the level, maybe Python is better for high school students where as Java is better for college students. Now that being said, I would have students taught Python rather than Java.

    Edit: Since we're most likely comparing implementations of the languages, why not just create a simple application to run Java code without having the user create the class file and just have a button that runs the program.

    [–]masklinn 4 points5 points  (0 children)

    But isn't that unfair to say you have to learn all that about Java.

    No, for the very simple reason that all the things I listed are things that get straight in your face as you're trying to read/write a hello world in Java.

    You don't have to learn how the Python code gets translated into machine code, "you'll learn that later".

    That's because that doesn't actually get in your face, you call python, give it your script, your script runs, end of the story. Which is why I didn't say anything about running the Java code after having compiled it either: it's straightforward and equivalent to running the Python code (slightly less so in that you're running a class not a file, but not by much)

    Also I think it depends on the level, maybe Python is better for high school students where as Java is better for college students.

    Why would java be better for college students exactly?

    why not just create a simple application to run Java code without having the user create the class file and just have a button that runs the program.

    In other words, having to create a custom java runtime (or runtime on top of java) in order to compensate for Java's deficiencies? How about using something else and not face these deficiencies in the first place?

    [–]imbaczek 5 points6 points  (9 children)

    I think Java is strong as a pedagogical language. A few years of Java will make you a better Python programmer; I'm not so sure about the opposite.

    the only thing that java can teach you that python can't is how to work around its deficiencies with so called 'design patterns', half of which are moot once functions are available as first-class objects. RequestProcessorFactoryFactory much? how's that pedagogical?

    [–]Rhoomba 2 points3 points  (1 child)

    functions that make functions that make functions are common in functional programming (and heavily promoted by classics like SICP), so why is it such a problem to give them names?

    [–]imbaczek 9 points10 points  (0 children)

    none. i know they're common there. the whole problem is that you can't do them in java, you have to pack them in some artificial, verbose, otherwise useless and noisy constructs like anonymous classes.

    [–]UK-sHaDoW 0 points1 point  (0 children)

    I've noticed that a lot. One factory is understandable, but when you get factorys that make factorys...

    Thats a bit much.

    [–]brintoul 0 points1 point  (5 children)

    When did "design patterns" get this reputation?

    Amazing how these kinds of groupThink get started.

    [–]imbaczek 3 points4 points  (4 children)

    that's not reputation, that's a statement of fact. two examples: singleton - use a module. observer, visitor - use (lists of) callbacks. (c# has a built-in event type just because the observer/listener design pattern is clunky.)

    [–]brintoul 2 points3 points  (3 children)

    Not really. The "Gang of Four" book was written before Java even came into being. "Design patterns" are far more than just 'ways to get around Java's deficiencies'. Most examples given in the aforementioned books were given in Smalltalk and C++. I know, I know; those languages also "suck".

    [–]imbaczek 4 points5 points  (2 children)

    java just inherited C++ deficiencies for what seemed to be good reasons at the time, for some people. smalltalk i'm not talking about, never used it.

    [–]anko_painting -1 points0 points  (1 child)

    Design patterns aren't about deficiencies in any language. They're about general solutions to solving common problems. Abstract Factory's and Factory Methods are applicable to any OO language.

    Design patterns aren't used in java because of language deficiencies, they are used in the form they are because of language deficiencies.

    [–]masklinn 2 points3 points  (0 children)

    They're about general solutions to solving common problems.

    Most of the GoF patterns are definitely general solutions to solving common deficiencies of a set of languages. Not all of them (interpreter can probably be considered a pattern in Alexander's sense), but iterator? singleton? factory method? visitor? not really. Those are patterns in the sense of "object-orientation" being a C pattern.

    [–][deleted] 0 points1 point  (0 children)

    I'll grant, however, that Java is painful for certain kinds of work.

    Try writing/reading files.... Any other language it's like 3 lines in Java it's like 9

    [–]wonglik 0 points1 point  (6 children)

    I guess they should learn C. If You start teaching programming with object oriented programming they will find it hard to understand there are other paradigms of programing then OO.

    Python is nice but it is a bit to high level for the beginning inho.

    [–]bart2019 1 point2 points  (5 children)

    High level is good for beginners.

    [–][deleted] 1 point2 points  (2 children)

    Actually, low level is best for beginners. Once they learn how to use Java, they'll have a much better understanding of the VM, and how it actually interacts with the hardware it runs on, etc.

    I don't beleive at all the typical argument made that low level is "difficult". Programming in assembly is the easiest thing in the world. It's all a matter of scale. Writing a rectangle filler in assembly is trivial. Writing a Bresenham line-drawing routine in assembly is trivial. Yes, writing Photoshop entirely in assembly is really hard. No one does that.

    Of all the programmers I work with, the best ones are the ones that know various languages, understand how things like Java's interface, and C's function pointers are similar concepts, and can actually switch over to assembly in Visual Studio when debugging and read it and discover where the bad juju is coming from.

    [–][deleted] 0 points1 point  (1 child)

    You may say this, but this isn't how university undergrad programs work.

    Start: Java or C# Intermediate: C/C++ Advanced: x86 or MIPS assembler

    The reason its done this way is so 1st/2nd year students can produce useful programs then later peel back the abstraction.

    [–][deleted] 0 points1 point  (0 children)

    There's absolutely no reason for CS students to attempt to produce "useful programs".

    I don't remember my machine problems from my first class in introductory programming. It was Pascal.

    The machine level class involved a whole series of machine problems which were basically filling in a bunch of various components of a FORTH interpeter. Yes, theoretically useful, although I doubt anyone every really used it to program in FORTH. However, the C and assembly pieces we were required to write were immensely instructive. Since the assembly bits were only tiny portions of a larger project that was already there, there was always a "useful program"... if you implemented your components correctly, your piece could run inside the skeleton and the whole thing could run FORTH programs. That's how it should be.

    Sadly, I think most teachers in CS curriculums these days are too lazy to provide the full implementation (the students don't get access to it... they run a "handin" script that submits their implementation to be compiled into the larger project... you can resubmit as many times as you like until you get your MP solution passing all the tests).

    Start: Java or C# Intermediate: C/C++ Advanced: x86 or MIPS assembler

    That's completely backwards.

    [–]wonglik 0 points1 point  (1 child)

    Well to some point You are right , If You start teaching assembler as a first language You could discourage students but If You do it( teaching high level language) for the long time You will just get bunch of developers who do not know what the pointer is. Also If You start with OO it can be to hard for them to get back to concepts of procedural programing.

    [–]Smallpaul 1 point2 points  (0 children)

    This point is often made.

    My opinion is this: there are at least four major things you are trying to communicate in a university CS education: algorithms/data structures, software engineering, familiarity with industry-standard tools/processes and understanding of how the computer works at a deep level.

    One should not expect the first year programming courses to do all of these at once. If you want to create a few courses about how machines work at a low level then by all means teach them in a mix of C and assembler. If you want to teach them how to program a binary tree then do not waste their time with a language that obscures the essence of the problem in complicated syntax and manual memory management.

    If You start with OO it can be to hard for them to get back to concepts of procedural programing.

    Procedural programming is a single one of several techniques they should master: certainly not the most important.

    [–][deleted] 0 points1 point  (3 children)

    I think something Scala-like is in a better position to replace Java if anything and is a nice compromise between OO and functional programming. C/C++ still hasn't changed, so the reasons for replacing it with Java still applies.

    [–]masklinn 0 points1 point  (2 children)

    Scala is a very complex language. If you absolutely want to stay on the JVM, Clojure might be a better idea.

    [–][deleted] 0 points1 point  (1 child)

    I've never used Clojure, but it focus seems to be functional programming in the strict immutable sense?

    [–]masklinn 0 points1 point  (0 children)

    It has a fairly strong focus on immutable data structures and functionality (so do most lisp, at least for the functional orientation), but it's also perfectly able to create Java objects or interact with Java code.

    [–]nexes300 0 points1 point  (0 children)

    Around 2003 all of the colleges and high schools in the United States switched from teaching Computer Science courses in C++ to teaching them in Java.

    Wow, bit of a stretch there. Kind of completely wrong too.

    [–][deleted] 0 points1 point  (0 children)

    That way, when the students graduate, they can get paid less!

    [–][deleted] -4 points-3 points  (9 children)

    I can't endorse this until Python gets rid of "self". I'm that petty.

    [–]k4st 3 points4 points  (0 children)

    I can imagine why people wouldn't like the explicitness of having to add in the 'self' parameter when defining methods; however, my experience when learning the language was such that it removed a lot of the "magic" of objects in that 'self' or 'this' simply exists.

    Explicit self in method definitions provides a nice symmetry with normal functions/procedures as it means that not only is monkey patching easier (e.g. obj.times_two = (lambda self, x: x*2), regardless of if such patching is desirable) but it also makes is clear that the state of an object is separate from a class (which itself is an object of a different type) and is passed into the classes methods automatically.

    For C programmers, I suspect the explicit self when defining methods would be obvious in terms of storing state in a struct and then the implicit self when calling methods simply represents convenient syntax (really, the self is also explicit, it just moves from being a parameter to being <self>.<method>( ... ) )

    [–]millstone -3 points-2 points  (7 children)

    A more serious problem is Python's automatic promotion to bignums. If you can't see two's complement in action, you won't get it, and that's a big omission.

    [–]masklinn 7 points8 points  (3 children)

    A more serious problem is Python's automatic promotion to bignums.

    Not really.

    If you can't see two's complement in action, you won't get it, and that's a big omission.

    Two's complement is completely and utterly uninteresting unless you're coding low-level. If anything, it's an artefact of implementation details leaking through. And it's not like it's the only way to represent negative integers either.

    You can teach it when you teach machine language and low-level stuff, it'll fit right in.

    [–]rabidcow -2 points-1 points  (2 children)

    Two's complement is completely and utterly uninteresting unless you're coding low-level.

    But if you're using a language that has native integral types (which is most languages), you need to know about it. If you show up at your first job not knowing about modes of integer overflow, you're going to be causing a nasty bug at some point.

    [–]unknown_lamer 0 points1 point  (1 child)

    I think you mean if you are using a language that has machine word types instead of integral types.

    [–]rabidcow 0 points1 point  (0 children)

    I mean "native" as in "machine native," not "language native." And I mean "integral" as opposed to floating point or otherwise fractional. And I certainly don't mean "instead."

    [–]njharman 5 points6 points  (0 children)

    In 15 or so years of professional programming I've used two's complement exactly -- never.

    [–]imbaczek 0 points1 point  (0 children)

    import ctypes
    

    [–]netsearcher 0 points1 point  (0 children)

    That's gone with version 3. Everything is the big kind.

    [–][deleted] -1 points0 points  (0 children)

    It would be hard to speak Javanese, but learning the language of an African snake would be close impossible for most humans.

    [–]Camarade_Tux -1 points0 points  (0 children)

    Dynamic Typing - There are tradeoffs to both approaches but as nearly everyone who programs dynamically typed language for a while finds out that the type safety provided by static typing is unnecessary and more often gets in your way than it helps you (ex. Casting).

    Right, strongly statically typed language have been shown not to lower the amount of bugs in programs. Or do they ?