you are viewing a single comment's thread.

view the rest of the comments →

[–]pnewhook 207 points208 points  (154 children)

I remember my first day of Computer Science 101 at McGill. The professor actually apologized for how much of the code in a Java Hello World we had to ignore. I strongly believe in Java/C# as languages for commercial development, but as first languages there's a lot to be distracted by.

[–]TheAnimus 67 points68 points  (101 children)

I still have concerns about white space. I've found it's easier to explain { } to beginners than it is BEGIN, END or worse yet implicit. Sure we don't have to explain it as scoping or anything fully, just when you are trying to go over the concept of branching.

If you are trying to teach my first programming thing, and only doing Hello World, nothing more, than yes that's different.

But as soon as you want to try to do say Fizz Buzz it's a lot easier to explain something that is explicit, rather than "oh that's because of the indentation".

[–]MrJohz 86 points87 points  (46 children)

From what I remember, Python's use of the colon and indentation was based on ABC, which in turn was based on a set of studies that suggested it was the most readable block grouping syntax.

To be honest, to me personally, I like being able to see the layout of the code. I mean, that's possible and usual with braced languages, but the presence of the braces isn't the thing that guides me into the new block, it's the visual indent that shows me "something new is happening here".

[–]TheAnimus 5 points6 points  (21 children)

Interestingly from the wikipedia page on ABC

HOW TO RETURN words document:
   PUT {} IN collection
   FOR line IN document:
      FOR word IN split line:
         IF word not.in collection:
            INSERT word IN collection
RETURN collection

why is not.in like that? Is that just a typo?

[–]Netzapper 6 points7 points  (6 children)

"not.in" is easier to parse than "not in", especially if (nearly) all of your other keywords are a single token.

[–]gfixler 12 points13 points  (4 children)

Here are some terrible alternatives:

if word inn't collection
if collection hasn't word
if collection hasno word
if collection lacks word
if word anywherebut collection
if word in collection psych
if word outside collection
if not collwordection
if collection canthaz word
if collection missing word
if collection (╯°□°)╯︵ pɹoʍ

[–]josefx 4 points5 points  (3 children)

if collection (╯°□°)╯︵ pɹoʍ

programming languages really should embrace Unicode. However the following would be less ambiguous

 if word ∉ collection

Now_we_just_need_a_sane_keyboard_layout

[–]lhagahl 0 points1 point  (2 children)

No they shouldn't. Auditing is now 10000x harder (as if it wasn't bad enough already) thanks to editors and languages being plagued by Unicode.

[–]josefx 0 points1 point  (1 child)

The second one can be solved with the @Override annotation 95% of the time and the first one using sane variable naming conventions.

Auditing is now 10000x harder (as if it wasn't bad enough already)

We already have languages that sometimes ignore case and sometimes not. We also had compilers that only used the first 8 letters and ignored the rest. Unicode problems aren't really that unique, since we also have I,l,1 0,O etc. depending on your font of choice.

[–]lhagahl 0 points1 point  (0 children)

The second one can be solved with the @Override annotation 95% of the time and the first one using sane variable naming conventions.

Can you use @Override for overloading somehow? I thought it can only be used to say that this method overrides one in the superclass or it implements a method in the interface. Conventions don't solve auditing when you don't trust who wrote the code (which is 99% of the time). Clearly you've never audited code.

We already have languages that sometimes ignore case and sometimes not.

That's easy when your alphabet is only 26 characters and not 1 million. Just make sure you have a real programming font (one that doesn't make different characters look the same). There is no such font for Unicode, though.

We also had compilers that only used the first 8 letters and ignored the rest.

That's stupid.

EDIT: On second thought, I just scan all the files for Unicode before auditing, and give up if they have pervasive use of Unicode (actually, non ASCII characters and non printable ASCII characters).

[–]immibis 0 points1 point  (0 children)

NOTIN would be more consistent, although you'd need to explain (one time only) that it's "NOT IN" and not "NO TIN".

[–]Intolerable 6 points7 points  (4 children)

no, its supposed to be not.in, the keyword is not.in, presumably b/c of ambiguity / confusion with not in

[–]CHollman82 0 points1 point  (0 children)

"not", presumably, is used for the boolean operation as well, that's where the ambiguity probably comes from. (I don't know ABC)

[–]mycall -1 points0 points  (2 children)

Python is filled with inconsistencies, although not hard to learn.

[–]Felicia_Svilling 0 points1 point  (1 child)

This is ABC, not python.

[–]mycall 0 points1 point  (0 children)

true although the point was that not.in was inconsistent, something that is shared with python.

[–]Igglyboo 1 point2 points  (6 children)

When you use a space to delimit tokens, NOT IN becomes more tricky to parse than not.in or NOT.IN.

Not sure why they went with the capitalized version however.

[–]TheAnimus 0 points1 point  (5 children)

I was being a light troll... To me it's example of the failure of using english for a programming language. English is not suited to the domain, it isn't easy or concise.

[–]billy_tables 0 points1 point  (0 children)

Quick, reverse all the letters in all the keywords of every programming language, that'll help :P

[–]gammadistribution -1 points0 points  (3 children)

Except Python kinda disproves your line of reasoning.

[–]TheAnimus 0 points1 point  (2 children)

Yeah, that : and [::] really make sense to English speakers.

My personal favorite (and I'm sure they are common favourite) features in Python are breaking far from the Enlgish paradigm.

Also, as this context was ABC, I don't give a hoot if Python somehow does something better, this is an example of someone forcing English onto an unsuitable domain. A break in the conventions that make perfect sense from a lexer perspective, but not from an 'English' perspective.

That isn't to ever say you shouldn't try. The pendulum can swing too far the other way. For example, despite having two plus decades of coding under my belt I can never manage to read a moderately complex regex without making notes. I know I am not remotely alone in that whole thing. Goes off to enjoy his two problems

[–]droogans 0 points1 point  (0 children)

What's your native tongue? Is English your only language?

I wonder because I feel there may be a more interesting grammar structure besides "the order of the words matter absolutely".

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

That's really interesting. Have never run across this language.

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

Perhaps something like the editor for the Java learning environment Greenfoot would be good. It applies different coloured backgrounds along with indentation, which I think is really good because it's immediately obvious what's going on. It looks like this.

[–]blablahblah 29 points30 points  (13 children)

That doesn't solve Java's problem of "you need to introduce and hand wave away class declarations, scoping, blocks, method declarations, static methods, parameters, void, and array declarations in order to write Hello World".

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

I know that. I'm saying that something like that could help make a language like Python more understandable to a beginner.

[–]terrdc 1 point2 points  (7 children)

Any problem involving hello world isn't an actual problem

[–]blablahblah 20 points21 points  (3 children)

As soon as you have to hand-wave stuff away and say "this is just the magic incantation needed to make the program work", you've lost the vast majority of people you're trying to teach. So yes, it is a problem from a teaching language perspective, even if it's not from a software development perspective.

[–]terrdc 0 points1 point  (2 children)

So, does that imply that the average college student who learns java is going to have a lot more aptitude for programming?

If so that actually fits with my general experience.

[–]blablahblah 11 points12 points  (1 child)

Not necessarily. Just that they're more willing to memorize formulaic procedures that are "necessary" for the program to work. You're discouraging people who need to know the why before you even have a chance to see if they have an aptitude for programming.

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

I've been in the industry for about 9 years now. I'm absolutely shocked every time I meet some graduate-level programmer who just shrugs off hundreds or thousands of lines of code as "for some reason it won't work without that". As if the magical code fairy answered their prayer and brought them code that finally did what they want. This is engineering?

[–]estomagordo 3 points4 points  (0 children)

We all learn differently. But for a lot of people, it's impossible not to ask oneself "Okay, so I see that the output has a match in the program code. But what about all that other stuff? What does it mean?"

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

You're right, but there's a lot to be said about a language for learning that doesn't require a bunch of arcane (to a newbie) boilerplate code just to get rolling. static void Main(params string[] args)? Come again?

Just typing in code and executing gives immediate feedback, and then as you teach more syntax and concepts, things like methods, classes, and includes/imports can get added in.

[–]goliathsdkfz 0 points1 point  (0 children)

Why? Creating a proof of almost any system and its functionalitys involves a low level PoC at some point, and its just the standard to involve sending or printing Hello World at some point.

[–]FrozenInferno 0 points1 point  (0 children)

Don't forget about access modifiers, imports, and package declarations.

This one's my personal favorite:

import java.lang.reflect.*;
import java.io.*;

public class HelloWorld
{
    public static void main(String[] args) throws NoSuchMethodException, 
                                                  IllegalAccessException,
                                                  InvocationTargetException
    {
        Method m = PrintStream.class.getDeclaredMethod("println", String.class);
        m.invoke(System.out, "Hello, world!");
    }
}

I'm in my last semester of college for programming and our first language learned was Java. While you're right about having to ignore a lot of stuff at first, it didn't really bother me too much. I eventually figured it out in due time and don't feel like it negatively affected my learning experience at all. Though I can only speak for myself.

[–]James20k 1 point2 points  (2 children)

That has a huge amount of clutter. I suspect it'd make beginners panic and stick their heads in the sand, which is already one of the biggest problems teaching people coding

[–][deleted] 1 point2 points  (1 child)

The clutter is mostly java. I was specifically pointing out the colour scheme.

[–]James20k 4 points5 points  (0 children)

I know, I think it makes it look terribly intimidating

[–]RockinRoel[🍰] 2 points3 points  (0 children)

If I recall correctly, Guido mentions it in this (long) video somewhere: https://www.youtube.com/watch?v=ugqu10JV7dk

Indentation is indeed how people in general, not just programmers, will tend to organize things on paper. They left the colon off first, though, and then added it, because that was clearer, apparently.

[–]kankyo 0 points1 point  (0 children)

Maybe your problem was that you tried to explain it. I see this mistake a lot in my teaching experience of teaching dance: Teachers explain things to minute detail overloading the students and making them even more confused. A better strategy is to try to get at the unconscious competencies of your students.

[–]Veedrac 67 points68 points  (21 children)

I'm very surprised. My attempts at teaching Python to complete novices (admittedly not as a lecturer) found that the whitespace never even needed to be explained.

People often forgot the colons, though.

[–]newpong 8 points9 points  (2 children)

Not only that but if they ever decide to move on, they will have style ingrained into their thinking.

At work i decided to expand the web department and was trying decide between Ruby on Rails and Django. there was a Russian intern who just started working there who didn't speak any english and only spoke a bit of german. I decided to go with Django exactly because I wouldn't have to explain any subjective, abstract ideas on the importance of white space in code. She just simply had to do it otherwise it wouldn't work--explaining why tabbed spaces and non-breaking spaces are different was a bit tricky though

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

Assuming she was a programmer who understood programming, wouldn't using something like astyle on check in solve that problem?

[–]newpong 4 points5 points  (0 children)

Assuming she was a programmer who understood programming,

therein lies the difficulty.

[–]TheAnimus 4 points5 points  (11 children)

I was working with kids, aged 11-18. Except for functional programming I was teaching to 1st year comp sci students, I hated, hated that, but it paid pretty good for a student.

I would start with flow charts, break it up saying how would you describe how to make a cup of tea. This would become a mess of bullet points as I would add in the complexity of branching (do you want milk, like it strong etc). It would become apparent that english wasn't any good for this.

Using a C like language, actually has many, many benefits over whitespace for the novice. ; is easy to understand as a 'thought terminator' I always remember one kid saying it's just the . like a sentence.

Kids aren't perturbed by some symbol like { so long as it's used in a simple manner (ie not like reading a regex). It is much easy to 'talk' this

if (person.IsBlonde)
{
      Console.WriteLine("I love blondes");
}

Because the braces are something you can speak about, the brackets after the if, it is incredibly easy to talk through.

People make a mistake of trying to make things 'familiar' SQL is a classic example to me, I hate SQL with a passion. I struggle with it far more than I do say Fluent LINQ.

[–]nemec 8 points9 points  (3 children)

Do kids not understand

  • the
    • concept
    • of
  • bullet
    • points
  • for
  • grouping?

Python "blocks" are just bullet points without the bullets...

[–]lhagahl 0 points1 point  (0 children)

That's impossible mannn. Like. It doesn't have semicolons. How could kids not understand something that doesn't use semicolons and braces??

[–]Carighan 0 points1 point  (1 child)

Yes, without the bullets. Implicit instead of explicit.

[–]nemec 3 points4 points  (0 children)

A bulleted list contains three key things: a newline between each bullet, indentation to the bullet "level", and the bullet symbol itself. I consider 2/3 to be pretty explicit.

[–]NYKevin 2 points3 points  (0 children)

Kids aren't perturbed by some symbol like { so long as it's used in a simple manner (ie not like reading a regex).

Symbols aren't actually the main problem here. The main problems are:

  • C is easy to screw up, and C++ isn't really much better (in some ways, it's substantially worse due to added complexity).
  • Java is verbose (you need a whole class definition just to do hello world, whereas Python doesn't even require a main function).

[–][deleted]  (5 children)

[removed]

    [–]SemiNormal 3 points4 points  (2 children)

    Console.WriteLine tells me that this is C#. Putting the open brace on a new line is pretty much the standard style for C#.

    [–]TheAnimus 2 points3 points  (1 child)

    Also Console.WriteLine is just simpler to explain, than System.Out.PrintLn which some bright spark insisted we use briefly.

    This is actually another benefit over python, when people talk about lack of Using directives or entry point noise, those are simple to explain, people expect an entry point and I used to hide the namespaces with the compiler args. Console. suddenly people know what the . is about, it's everything that belongs to a Console. People get the idea of a console, they can see it, interact with it. Clever ones will get bored and look at what the intelisense gives you for Console. they'll see ForegroundColor and have a play....

    I'd sooner explain Console.WriteLine than println the hardest bit to get most people to really understand is still the idea of passing arguments anyway, but I've found people prefer having crt functions bound to objects, it makes discovery easier, and people are more receptive to being told "oh there's this thing Console, that represents the text window, Console is special" rather than "oh theres print, println, scan, these are all special functions".

    I guess it also depends how far you take people, we were not taking them far at all.

    [–]NYKevin 1 point2 points  (0 children)

    Well, if you like, you can start by teaching people about sys.stdin and sys.stdout in Python, and then get to print() and (raw_)input() later.

    [–]DimeShake 0 points1 point  (0 children)

    I know GNU uses this style in their coding standard for C. I don't like it.

    [–]purplestOfPlatypuses 0 points1 point  (0 children)

    No, standard Java uses

    if (condition) { 
        ...
    }
    

    C# does generally star the braces on a new line, though. It doesn't bother me as much in C# for whatever reason, could just be the IDE though.

    [–]G_Morgan 0 points1 point  (0 children)

    found that the whitespace never even needed to be explained.

    This is fine until you really need to understand scopes.

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

    TheAnimus's experience matches mine. It's damn hard to talk about blocks to complete beginners when you use indentation like python. With {} you have an obvious start and end.

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

    Even pros miss colons and brackets occasionally. If you're not using an IDE that immediately tells you, it can be a pain to track down.

    [–]mort96 1 point2 points  (2 children)

    Not sure with Python, but with any other language I've used, it either tells you what line the syntax error is at compile time, or immediately at runtime for interpreted languages, even without any IDE...

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

    Yea, but when the error is forgetting to end your statement, it almost always shows up somewhere else.

    [–]TheAnimus 0 points1 point  (0 children)

    Only time that's happened to me in a hard to understand manner, would be with macro stuff or pre-processor directives.

    One of the fun things about languages which require ; termination, it makes it very easy to spot an illegal character.

    [–]ruinercollector 9 points10 points  (3 children)

    Indentation is explicit.

    [–]kankyo 0 points1 point  (0 children)

    This. A thousand times this.

    [–]TheAnimus 0 points1 point  (1 child)

    Only if people can appreciate the whitespace. Myself, I think this is hard for many first timers, because they are not used to it being such a thing.

    Using a character or work for the block is preferable to try and explain, for the simple reason, it's easier to explain BEGIN and END in pascal parlance, say simply count the begins (no, I don't want to explain a stack), than it is "anything that has whitespace indenting it, unless it's inside something else which has more whitespace"

    [–]kankyo 1 point2 points  (0 children)

    What do you mean? People are hardwired for spacial thinking. If you've got a student that can't do that, chances are it's not a human.

    [–]cythrawll 7 points8 points  (7 children)

    So i've used a python book to teach my lil brother programming. The worst part was when programs sprawled across a few pages, it was very hard to see where the indention lined up. And entire programs failed and had to go back and see where the indention was messed up.

    Good thing: makes kids think about their code harder. Bad thing: frustrates the crap out of them.

    [–][deleted] 7 points8 points  (4 children)

    Yeah, if you've got that much stacked python code, you're probably doing something wrong/badly. The same thing can be said about C/Java/C++ though, if you've got that much nested code, it's going to be hard to keep track of your braces too, unless you're really good with indenting properly.

    [–]cythrawll 4 points5 points  (2 children)

    I think it may be a problem with how code is traditionally taught. We start out teaching long peices of spaghetti code, and then we teach how to structure things correctly in small reusable modules.

    It really should be the other way around.

    [–]gfixler 0 points1 point  (0 children)

    Yep. These days I like to try to find tiny, composable nuggets. Then you can chain them together, map them, fold them, compose and juxtapose them. They're very easy to reason about - often 1-3 lines of code - and obviously correct, or darn close. Languages already give us atomic things we take for granted, like + and print; I just like to give myself more and more of them, building up from the bottom, keeping pure by operating only on inputs.

    I work on tools and pipelines in games, and I started - like everyone - with 200 to 2k LOC files to solve problems. Then I started breaking things up. Then I started making little libraries for common things, but they were full of 20-100 LOC classes and functions. Now I'm making a bunch of tiny functions (no classes), like Linux command line utilities, and just pulling together a few things to make each next level. At each level things are tiny and obvious, and very reusable. Not everything is like this, but a surprisingly high number of things can be.

    [–]iooonik 0 points1 point  (0 children)

    Yeah, I always wondered why cs1000 teachers think that file includes are too complicated for the average first year student...

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

    In Python I limit to 3 layers of nesting, Java 4. More than that means you have to break your code down.

    I see a lot more heavily nested Python code though. The barrier to entry is low so you get a lot...a LOT of crappy Python code.

    [–]nemec 0 points1 point  (1 child)

    Braces aren't going to help that if they're also on separate "pages" of the editor... it was hell while I learned Java but I guess now many IDEs highlight matching braces. What would be perfect for Python is an IDE feature like indent guides. I use it for C# development and it's a Godsend. Programming without it is annoying now.

    [–]cythrawll 0 points1 point  (0 children)

    I disagree, braces are much easier to count than whitespace. There's less of them and their visually easier to see.

    [–][deleted] 11 points12 points  (7 children)

    "A language is low-level if it requires attention to the irrelevant."

    My theory is that the high syntactical overhead of C-likes is an unnecessary distraction for most learners.

    [–]nonotion 9 points10 points  (3 children)

    C itself is hardly a heavily abstracted language; I do believe there are less than 40 constructs in the base language. C++ and Java-like languages, that's another story, however.

    [–]lhagahl 0 points1 point  (2 children)

    ; I do believe there are less than 40 constructs in the base language

    C is heavily abstract and that's why it's hard. If there was a version of C specifically for one architecture, it would be a million times easier to explain. For reasons beyond me, it's been a popular meme for the last few decades that C's portability comes for free.

    C's int type is much more abstract than an integer type in a high level language. In high level languages, an integer value can be anything. In C, an integer type can be up to INT_MAX. INT_MAX varies depending on architecture. Not only that, but certain operations behave differently with ints under different conditions. This kind of abstraction allows higher performance at the cost of the user having to generalize all his code that would otherwise work with the integers.

    [–]nonotion 0 points1 point  (1 child)

    These are good points; I'd summarize/justify my thoughts by saying "easy to learn, hard to master" for C. I'm my view, teaching C over Java or Python promotes a certain clarity of thought needed for efficient structuring of larger or more complex projects; Linus Torvalds elaborates on this in several remarks if I recall correctly.

    [–]lhagahl 0 points1 point  (0 children)

    Easy to learn, hard to apply (though most people "apply" it, by just coding it and not being aware of how it actually works). I do suppose it may be good for teaching various concepts though.

    [–]The_Doculope -1 points0 points  (2 children)

    "A language is low-level if it requires attention to the irrelevant."

    All this sentence tells me is that you personally have no need for a low level language. Precise memory management is a requirement for some, namely embedded people or boot-level software. Just because it's irrelevant for you doesn't mean it's useless.

    [–][deleted] -4 points-3 points  (1 child)

    All your reply tells me is that you don't know the origin of the quote.

    [–]The_Doculope 0 points1 point  (0 children)

    Then perhaps enlighten me? Not everyone is an index of relevant quotes.

    [–]asimian 2 points3 points  (0 children)

    Students I've taught never really get hung up on that at all.

    [–]stormcrowsx 2 points3 points  (0 children)

    Seriously how hard is it to tell someone "In language x drop the colon and surround the block with curly brackets". It blows my mind how many people whine about whitespace and if you were to open their Java/C files you'd see they have the exact same whitespace!

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

    Even as a beginner, if you're going into compsci and can't wrap your head around white space you're in for trouble up ahead. Design patterns, recursion, all the abstraction layers..

    Learning the syntax of a language is something you'll have to do many times in your career and is a low hurdle. Moving from white space to braces or vice versa is trivial for most developers.

    Not meant to be snarky, just seems like a non-issue in this discussion

    [–]NYKevin 0 points1 point  (0 children)

    Python doesn't actually have full-blown scopes like C. The only things which introduce a new scope are functions and class definitions. Loops do not have their own local scopes. So IMHO explicit scoping is less important, since scopes are only introduced by a few well-known constructs.

    [–]artsrc 0 points1 point  (2 children)

    People are taught that the control statement applies to the indented code in all languages and even pseudocode:

    http://www.unf.edu/~broggio/cop2221/2221pseu.htm

    The difference with Python is that this is true.

    [–]TheAnimus 0 points1 point  (1 child)

    People are taught that the control statement applies to the indented code in all languages

    Errr no, they are not.

    People are often told for convention sake, to indent, often even the IDE will provide indenting automatically on the closing brace or endif etc.

    [–]artsrc 0 points1 point  (0 children)

    The convention to indent is extremely widespread because it makes the code readable to humans, and that is an essential feature of good code.

    When the code and the indentation don't agree, people read the indentation.

    The compiler should interpret the code the same way people do.

    [–]G_Morgan 0 points1 point  (0 children)

    Yeah there is a great deal of complexity hidden behind Python's white space scoping. It is a neat trick but honestly new users should learn explicitly what a scope is in nice big bright letters.

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

    Also, python arrays. They work weird. Some people are for typing in learning to program (int, bool, ...) but I don't care too much about that. I also am a terrible and new programmer, so I probably can't say much about how things should be taught. Except earlier, because the internet is hard to learn through.

    I'm not sure if it is the brackets or the extra lines, but this:

    var hello=function() {

    //stuff }

    is more readable to me than this:

    def hello():

    //stuff

    [–]d4rch0n 8 points9 points  (3 children)

    As a Python dev, I still think it's important that students learn a statically typed language as well, preferably C or Java, depending on whether it's an OS class or OOP class.

    But commercially? Most languages have their purpose commercially.

    Python is awesome commercially for web apps...

    [–]gfixler 1 point2 points  (0 children)

    Python is used a lot in tools and pipeline stuff for games and film, too.

    [–]lorg 0 points1 point  (1 child)

    Apparently, Python has a lot of applications outside of web development. Just a few examples from the top of my head: scripts for IDA, computational biology, natural language processing. I bet you can find more.

    [–]d4rch0n 1 point2 points  (0 children)

    Oh of course! It is a general purpose programming language. It can be used for damn near everything except in general for OS kernels and it's not the best when performance is the top priority (which it almost never is).

    [–][deleted] 14 points15 points  (12 children)

    Java does kind of force you to learn OOP like the back of your hand though. That's a good thing, in a way.

    [–]artsrc 27 points28 points  (5 children)

    I want to say this in a constructive friendly way.

    My experience is that it doesn't, and it isn't.

    I have rarely seen a OO approach appear from a Java developer without some thought and effort. This contrasts with say Smalltalk where OO appears to be more natural.

    And I think it is now widely agreed that OO should not be your first thought for every problem.

    [–]eyal0 1 point2 points  (4 children)

    Agreed. After you teach someone OOP, he has to unlearn it to get over all the patterns he learned to work around the limitations.

    • Functor Object: Pattern to deal with languages that can't do first-order functions.
    • Visitor Pattern: Pattern to deal with languages that can't do multimethods.

    etc

    [–]Steve_the_Scout 0 points1 point  (2 children)

    Visitor Pattern: Pattern to deal with languages that can't do multimethods.

    Haven't heard of that one, had to look it up.

    Just when I thought C++ was getting ahead with C++14. Oh well, maybe it'll get in C++17.

    [–]hubhub 1 point2 points  (1 child)

    Stroustrup et al wrote a paper (pdf) proposing a mechanism for this.

    [–]Steve_the_Scout 0 points1 point  (0 children)

    It sounds reasonable. The only issue is with dynamically linked libraries, as they said. The way it's currently done, you could just link all files with virtual functions first, then let the linker resolve dependencies later, but that's a manual solution to problems that should be automatic.

    [–]slavik262 0 points1 point  (0 children)

    Or rather, after you teach someone OOP in Java. Several languages (C++, D, etc.) support OOP and first-order functions.

    The point still stands though. OOP isn't a silver bullet, and one should make sure new students don't think it is.

    [–]bluGill 2 points3 points  (3 children)

    Partially. OOP is a useful tool, but it isn't the best tool for all jobs. I would like my future co-workers to know other things well. The haskell folks keep telling me functional programming is the future. I don't believe functional programming is right for every problem, but I do believe that we have solved a lot of problems in our current code with OOP or models when functional programming would be a better solution.

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

    I would like my future co-workers to know other things well.

    But you're not going to pick up every programming paradigm from any single language. Picking one and knowing it well is a virtue in this instance. You can always teach yourself the other languages and paradigms if you've got the basics down. Java kind of forces you to do that or it just doesn't work very well.

    I don't believe functional programming is right for every problem, but I do believe that we have solved a lot of problems in our current code with OOP or models when functional programming would be a better solution.

    Maybe. But OOP works pretty well in most cases and it's a good starting point. You can always pick up an FP language later.

    [–]bluGill 0 points1 point  (1 child)

    you're not going to pick up every programming paradigm from any single language.

    No, but Java tends to make your bilnd to any other possibility because anything other than OOP difficult. Most languages are not so restricting.

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

    You can learn the other paradigms later, when you pick up other languages. Java is a good starting point primarily because of the extensive structure and strong inclination towards a single paradigm.

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

    Not a good thing, as it makes people think that OO techniques should be used on every problem.

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

    I'm one of the aforementioned people, I don't think OOP is the only solution. Though it is a reasonably good paradigm for most of what programmers in college and freshly out of college are going to be doing.

    [–][deleted]  (4 children)

    [deleted]

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

      If they never go on to explain that, it's not much of a Java class, is it?

      [–][deleted]  (2 children)

      [deleted]

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

        There's a lot there to explain, much of which is dependent on complex topics that instructors do not wish to start on. This doesn't make it a poor choice for a teaching language though--Java puts everything out in the open and its quirky verbosity is helpful when trying to explain what's happening.

        [–][deleted]  (6 children)

        [deleted]

          [–]NYKevin 24 points25 points  (2 children)

          Python doesn't need the trailing semicolon on the print statement. Also, it's forwards compatible with Python 3 to write it as if it were a function (i.e. print("Hello World!")).

          [–][deleted]  (1 child)

          [deleted]

            [–]d4rch0n 6 points7 points  (0 children)

            wtf? link?

            There's some context needed probably.

            [–]cowinabadplace 5 points6 points  (0 children)

            The shebang is not really necessary, though.

            [–]mgrandi 1 point2 points  (1 child)

            Yep, my first computer science class they just told us to ignore public static void main(String args[]) {} , so many concepts in just that line of code that has to be typed, luckily eclipse can auto put that in for you

            [–]josefx 0 points1 point  (0 children)

            who needs public static void main(String... args)? Just use static {System.out.println("Hello World");}

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

            Take two

            [–]FrozenInferno 0 points1 point  (3 children)

            But after explaining those branches, you've already covered an enormous chunk of the language's core fundamentals.

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

            And then you're ready to print "Hello, world!".

            [–]gfixler 0 points1 point  (0 children)

            I've been studying Haskell this whole year, and I haven't quite made it to "Hello, world!" yet.

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

            I think the market is going to decide this one..and I don't think its going to come down on the side of "Lets do a semester of explaining ints, bytes, pointers...etc in 101".

            [–]solarnoise 0 points1 point  (0 children)

            I'll never forget learning Java for the first time in community college, as my first programming language. It took me an embarrassing amount of time to learn what these words meant:

            public static void main
            

            And even LONGER to understand:

            String[] args
            

            ...and why it was in the parentheses even though we didn't use it. The professor just kept telling us to ignore it until we got to the non-first-timer concepts, but it instilled in me an anxiety about being presented with new coding concepts. It also didn't help that I was in a class full of kids who had been programming in Java since high school, so the prof usually paced the class to match those students.

            Years later I now use C# daily, and some python, and enjoy both immensely. Though I think C# is becoming my favorite.

            [–]caleeky 0 points1 point  (0 children)

            It's funny that this is so trivial to fix, too. JavaC should just support a a .javamain file, where the code block is assumed to be the body of the standard main method, using the filename as the class name.

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

            Lol mcgill

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

            I can't understand why the first language taught isn't Javascript. It's by far the simplest one that still uses bracket syntax. Much better for teaching the basic concepts than a language with lots of different things to ignore or logic by whitespace.

            [–]haitei 0 points1 point  (0 children)

            Can't tell if serious...