Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

MALE SHOEGAZE posted:

I don't see why you cant teach a low level and high level language simultaneously.

Because understanding programming concepts is difficult enough without throwing two entirely different mental models at them.

Adbot
ADBOT LOVES YOU

FamDav
Mar 29, 2008

Suspicious Dish posted:

Because understanding programming concepts is difficult enough without throwing two entirely different mental models at them.

i've seen intro programming courses taught in c++, java, python, and netlogo

c++: way too much focus on the intricacies of c++. professor treated it as c with classes and made the students do c-string handling
java: too verbose, and the everything is a class made some people go even more verbose. not too bad, though.
python: people had a lot of issues with variable declarations and scope. seemed a little too loosey goosey for the students
netlogo: the syntax and documentation really got to me. a lot of students were copying and pasting huge swathes of code.

we should teach intro programming in scratch btw

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

If you think C is simple then your mental model of modern processors is probably too naive.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
It has to be in order to remain sane. The minute you realize how badly your processor cheats to beat slow memory fetches is the day you quit smoking.

QuarkJets
Sep 8, 2008

FamDav posted:

python: people had a lot of issues with variable declarations and scope

Variable declaration and scope are way simpler in Python than in any of those other languages, so this is just :psyduck:

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

ratbert90 posted:

C is simple, and contains pretty much the fundamentals of almost every single programming language out there.
I have seen a lot of poo poo code because of a fundamental misunderstanding of how memory is handled.
I have seen CS graduates that didn't know what a pointer was.
I have seen CS graduates that didn't know what a function was on a memory level.

None of those is a reason to start with C in an intro to programming class. Those are implementation details.

JawnV6
Jul 4, 2004

So hot ...

Subjunctive posted:

If you think C is simple then your mental model of modern processors is probably too naive.

Suspicious Dish posted:

It has to be in order to remain sane. The minute you realize how badly your processor cheats to beat slow memory fetches is the day you quit smoking.
Use smaller processors, hth

Sebbe
Feb 29, 2004

I've watched through this year's CS50 (Introduction to Programming) course from Harvard.

I personally wouldn't have chosen C as a starting language, but it seemed to me like they made it work just fine.

qntm
Jun 17, 2009
C is not simple.

Soricidus
Oct 21, 2010
freedom-hating statist shill

QuarkJets posted:

Variable declaration and scope are way simpler in Python than in any of those other languages, so this is just :psyduck:

Probably the problem is the whole "global" mess where you can read from something but trying to write to it without saying please will break everything.

Jewel
May 2, 2009

Don't teach them globals until they know how to properly use them (which is almost never) problem solved.

Nippashish
Nov 2, 2005

Let me see you dance!

Jewel posted:

Don't teach them globals until they know how to properly use them (which is almost never) problem solved.

Python requires extra boilerplate to not make globals so now you need to explain globals anyway because they want to know why you're having them make a main function instead of just writing code at file scope.

seiken
Feb 7, 2005

hah ha ha

QuarkJets posted:

Variable declaration and scope are way simpler more loving broken in Python than in any of those other languages, so this is just :psyduck:

Impotence
Nov 8, 2010
Lipstick Apathy

seiken posted:

Variable declaration and scope are way more loving broken in Python than in any of those other languages, so this is just

just make everything a global

Space Kablooey
May 6, 2009


I was formally taught Pascal, C and Java in that order, and I think I came out OK. :shobon:

Space Kablooey
May 6, 2009


Thermopyle posted:

This is weird and not the average experience. However, it's not really possible to always know the contents of all objects all the time.

Maybe because most of my classes were sqlalchemy mixins/models, and pycharm really didn't know how to handle that.

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

HardDisk posted:

I was formally taught Pascal, C and Java in that order, and I think I came out OK. :shobon:

Yes, despite the teaching methods, new programmers are made every year, just like despite rejecting all possible best practices, patterns, frameworks and methods software still gets done.

"I've never used version control in my life and my software works fine" does not mean "everybody should be like me and not use version control"

I made my first programs in C64 basic, then probably AMOS and ARexx, then C and I don't think everybody else should follow the same path, even though I have a pretty high opinion of myself as a programmer.

Necc0
Jun 30, 2005

by exmarx
Broken Cake
Open with a few weeks on binary then start everyone on MIPS and go up from there

Forgall
Oct 16, 2012

by Azathoth

MALE SHOEGAZE posted:

Ruby Mine has tons of nice features that I will never learn anything about because using it is incredibly painful. I'm sure it's great once you know what everything does it absolutely chokes on my companies 10,000+ line ruby files so I can't really use it.
Why do you have 10,000+ line code files though?

Hed
Mar 31, 2004

Fun Shoe
How else do developers get paid?

Soricidus
Oct 21, 2010
freedom-hating statist shill

Someone I would be fired for naming posted:

We don't need source control anymore now that we've switched to Python.

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe

GrumpyDoctor posted:

Common Lisp can do this :ssh:

As for a contribution:
Java code:
		// parameters for intermediate calculations
		private double roofQConduct;		// Units: W/m2
		private double roofNetRadiation;	// Units: W/m2
		private double roofQET;				// Units: W/m2
Why does every scientist in my department do this? Why? Who the hell teaches Java without teaching local variables?

The worst thing about this code is that it uses a double for something in a particular unit and that the user has to be reminded with a little comment what unit they are supposed to use. Good until at some point in the future someone has a brain fart and forgets about units, and assigns a value which is actually in calories per half-hour per acre. It should use instead an object representing the value, from a class that is aware of units and unit conversions.

FlapYoJacks
Feb 12, 2009

From simplicity comes complexity :v:

FamDav
Mar 29, 2008
im glad everyone already justified why python scopes get weird and why you have to impose arbitrary rules to not let first time programmers shoot their foot off.

Soricidus
Oct 21, 2010
freedom-hating statist shill

Hammerite posted:

The worst thing about this code is that it uses a double for something in a particular unit and that the user has to be reminded with a little comment what unit they are supposed to use. Good until at some point in the future someone has a brain fart and forgets about units, and assigns a value which is actually in calories per half-hour per acre. It should use instead an object representing the value, from a class that is aware of units and unit conversions.

That would be a great idea if Java had operator overloading.

b0lt
Apr 29, 2005

Soricidus posted:

That would be a great idea if Java had operator overloading.

And value types.

raminasi
Jan 25, 2005

a last drink with no ice

Hammerite posted:

The worst thing about this code is that it uses a double for something in a particular unit and that the user has to be reminded with a little comment what unit they are supposed to use. Good until at some point in the future someone has a brain fart and forgets about units, and assigns a value which is actually in calories per half-hour per acre. It should use instead an object representing the value, from a class that is aware of units and unit conversions.

I am porting it to .NET and I chose F# over C# because of the language's first-class support for units of measure :eng101: I already found both a bug and a place where the original annotations were inconsistent.

QuarkJets
Sep 8, 2008

seiken posted:

QuarkJets posted:

Variable declaration and scope are way simpler more loving broken in Python than in any of those other languages, so this is just

Maybe you can explain the problems a little more, because I have absolutely no idea what you mean. I've been using Python for a decade and never ran into any weird variable declaration or scope issues, but I also don't try to treat all variables as global

canis minor
May 4, 2011

My first "real" language was Object Ada and while I cursed it at the time, am the opinion it was worthwhile to learn - the pedantry of the compiler, I think, gave me the insight to think what will happen if the user won't act nicely and input the "correct" data (this approach - to treat every user either as an idiot, or that will act maliciously was overall strongly suggested everywhere either way). Still, I don't know if I'd recommend this language as a starting point for everyone - it certainly wasn't fun - instead of focusing on solving problems, I was forced to wrestle with compiler, if that makes sense. I definitely liked C/C++ much better and to this day I find it useful, even though I don't program in C anymore - applying concepts like OO in JS for example. Still, I guess, teaching about O times of algorithms, data structures and why data types matter would be something I'd recommend.

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

Forgall posted:

Why do you have 10,000+ line code files though?

Because they were here when I got here, and they'll still be here when I leave. The fun part is many of our most common classes include these 10,000 line modules.

EAT THE EGGS RICOLA
May 29, 2008


oh hey i see we work for the same company

seiken
Feb 7, 2005

hah ha ha

QuarkJets posted:

Maybe you can explain the problems a little more, because I have absolutely no idea what you mean. I've been using Python for a decade and never ran into any weird variable declaration or scope issues, but I also don't try to treat all variables as global

Python code:
> x = 1
> print [x for x in xrange(0, 4)]
[0, 1, 2, 3]
> print x
3
> def f(): print x
> f()
3
> def f(): print x; x = 1
> f()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 2, in f
UnboundLocalError: local variable 'x' referenced before assignment
turns out having no proper scopes other than function and no variable declaration means everything is hack to make anything behave sensibly, who would have thought

Wheany
Mar 17, 2006

Spinyahahahahahahahahahahahaha!

Doctor Rope

EAT THE EGGS RICOLA posted:

oh hey i see we work for the same company

Why would anyone think that?

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

seiken posted:

Python code:
> x = 1
> print [x for x in xrange(0, 4)]
[0, 1, 2, 3]
> print x
3
> def f(): print x
> f()
3
> def f(): print x; x = 1
> f()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 2, in f
UnboundLocalError: local variable 'x' referenced before assignment
turns out having no proper scopes other than function and no variable declaration means everything is hack to make anything behave sensibly, who would have thought

Maybe Python has stockholmed me, but that seems perfectly reasonable to me.

Joda
Apr 24, 2010

When I'm off, I just like to really let go and have fun, y'know?

Fun Shoe

eithedog posted:

Still, I guess, teaching about O times of algorithms, data structures and why data types matter would be something I'd recommend.

Isn't this more within the scope of an Algorithms and Data Structures course and less within the scope of an introductory programming course? I think if it's the first course and you have no prior programming experience, being tasked with implementing and analysing the running time of algorithms and understand how, say, a hashmap or a queue works might be a bit much to swallow. The entire purpose of an introductory programming course is to get acquainted with how you write code, syntax, tools at your disposal from the standard libraries, good customs and maybe a bit of hardware understanding depending on the language.

Joda fucked around with this message at 00:44 on Dec 7, 2014

Dominoes
Sep 20, 2007

seiken posted:

Python code:
> x = 1
> print [x for x in xrange(0, 4)]
[0, 1, 2, 3]
> print x
3
> def f(): print x
> f()
3
> def f(): print x; x = 1
> f()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 2, in f
UnboundLocalError: local variable 'x' referenced before assignment
turns out having no proper scopes other than function and no variable declaration means everything is hack to make anything behave sensibly, who would have thought
It would be nice to have comprehension/genexp/lambda scope in Python. The variables they use feel like boilerplate, so no need to have them interfere with things outside the compr.

The global behavior you demonstrated at the end is counter-intuitive and confusing, although convention is not to use them except for a few uses like constants and settings. I remember stumbling into a similar case when learning and being thoroughly confused.

Speaking of which:

What's the proper way to handle this?

Dominoes fucked around with this message at 01:07 on Dec 7, 2014

canis minor
May 4, 2011

Joda posted:

Isn't this more within the scope of an Algorithms and Data Structures course and less within the scope of an introductory programming course? I think if it's the first course and you have no prior programming experience, being tasked with implementing and analysing the running time of algorithms and understand how, say, a hashmap or a queue works might be a bit much to swallow. The entire purpose of an introductory programming course is to get acquainted with how you write code, syntax, tools at your disposal from the standard libraries, good customs and maybe a bit of hardware understanding depending on the language.

You're right - as, if you don't know how to write code at all, how can you know which approach is best to tackle the given problem, how to write adaptable code and how will the code scale accordingly depending upon the circumstances. However, if you're only taught of a language, without touching these things, you're hardly to blame if you produce, well... examples from this thread. Doing things "properly", I guess, doesn't matter at that point.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Dominoes posted:


Speaking of which:

What's the proper way to handle this?

Assuming java script:

code:
var i;
for (i in lats) {
...

for (i in longs) {
...

Joda
Apr 24, 2010

When I'm off, I just like to really let go and have fun, y'know?

Fun Shoe

eithedog posted:

You're right - as, if you don't know how to write code at all, how can you know which approach is best to tackle the given problem, how to write adaptable code and how will the code scale accordingly depending upon the circumstances. However, if you're only taught of a language, without touching these things, you're hardly to blame if you produce, well... examples from this thread. Doing things "properly", I guess, doesn't matter at that point.

But if you're gonna be a developer I assume you're not just gonna take a single programming course? Don't all CS, software engineering or software development B.Sc./M.Sc. programmes have algorithms and data structures (or some equivalent thereof) as a core course? I know that understanding how a CPU is wired (at least in terms of a basic integer unit) and how it interprets instructions is only consistently core for software engineering, but I thought everyone doing some variation of an academic degree had to take algorithms/datastructures at some point?

Adbot
ADBOT LOVES YOU

pseudorandom name
May 6, 2007

Dominoes posted:

It would be nice to have comprehension/genexp/lambda scope in Python. The variables they use feel like boilerplate, so no need to have them interfere with things outside the compr.

The global behavior you demonstrated at the end is counter-intuitive and confusing, although convention is not to use them except for a few uses like constants and settings. I remember stumbling into a similar case when learning and being thoroughly confused.

Speaking of which:

What's the proper way to handle this?

Well, the proper way is:
code:
for (let lat_ of lats) {
but then you run into browser compatibility problems.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply