Codeacademy

Message Bookmarked
Bookmark Removed
Not all messages are displayed: show all messages (254 of them)

I think I hit the "okay, bored now" point of this by the end of the second course

Nhex, Monday, 6 February 2012 05:24 (twelve years ago) link

Reminds me as usual that while i love the power of programming, the nitty gritty - figuring out why this parentheses or that equal sign is missing somewhere - even with the debugger - is always such a drag

Nhex, Monday, 6 February 2012 05:25 (twelve years ago) link

That comment about Excel macros above is like super otm, though

Nhex, Monday, 6 February 2012 05:26 (twelve years ago) link

the 2nd course is poorly designed compared to the rest. there have def been a lot of improvements. I can see this site being a pretty big success story eventually and this early run as being 'lol we didn't know what we were doing'

iatee, Monday, 6 February 2012 12:06 (twelve years ago) link

yay, new week of stuff. (really the only thing making my Mondays tolerable at this moment.)

so, besides iatee + me, which other ilxors are still doing this?

Mordy, Monday, 6 February 2012 18:52 (twelve years ago) link

i'm two wks behind now but i really do want to get back on track!

call all destroyer, Monday, 6 February 2012 18:57 (twelve years ago) link

still on this, hope to look at this week's in an hour or two

Schleimpilz im Labyrinth (a passing spacecadet), Monday, 6 February 2012 20:28 (twelve years ago) link

if i keep this thread bookmarked it's good harassment--i've done most of conditionals in the last 45 mins.

call all destroyer, Monday, 6 February 2012 21:19 (twelve years ago) link

still on this, hope to look at this week's in an hour or two
― Schleimpilz im Labyrinth (a passing spacecadet), Monday, 6 February 2012 20:28 (1 hour ago)

still on this, hope to look at this week's... tomorrow

Schleimpilz im Labyrinth (a passing spacecadet), Monday, 6 February 2012 21:54 (twelve years ago) link

For anyone who has done Building an Address Book, I solved 1.6 by doing this with the prompts at the end:

add(prompt("First Name?"), prompt("Last Name?"), prompt("Email?"), prompt("Telephone?"));

It worked, but I notice that the hints suggest:

You can use the following syntax with the prompt function: var <response> = prompt(question);

And everyone else who did it in the Q&A did it like the hints suggest, ie: by creating 4 variables using prompts and then calling those 4 variables in the add statement. My question is: Is the way I did it legitimate (It did work), or is it just a bug in the program that let it work and that kind of coding shouldn't actually be valid?

Mordy, Friday, 10 February 2012 02:42 (twelve years ago) link

Do you know why your way works?

tinker tailor soldier sb (silby), Friday, 10 February 2012 03:00 (twelve years ago) link

Well, I know why I tried it thinking it might work. The prompt calls for an answer that becomes the parameter for the function. I just figured that instead of defining a bunch of variables as prompts and then running the function, I could just put the variables directly in the parameters.

Mordy, Friday, 10 February 2012 03:08 (twelve years ago) link

(And it did seem to work the way I intended it to.)

Mordy, Friday, 10 February 2012 03:09 (twelve years ago) link

I think my explanation there was really ineloquent but hopefully you understand what I'm trying to say.

Mordy, Friday, 10 February 2012 03:10 (twelve years ago) link

So given that it works what makes you suspicious?

tinker tailor soldier sb (silby), Friday, 10 February 2012 03:56 (twelve years ago) link

No one else doing the exercise seems to have arrived at that solution, and the designers seem to have intended a different solution.

Mordy, Friday, 10 February 2012 04:02 (twelve years ago) link

Well if that's all then no you didn't do anything wrong per se by doing it the way that you did. There are situations where it would be "bad style" to do it that way probably, and there might even be programming languages where that wouldn't work, but using the results of function calls directly as function parameters is legit!

Thought experiment: what are some ways your solution could go wrong if JavaScript functions worked differently than they do?

tinker tailor soldier sb (silby), Friday, 10 February 2012 04:06 (twelve years ago) link

this week was def a step up in difficulty

I think this site will be a major success

iatee, Sunday, 12 February 2012 23:29 (twelve years ago) link

woo. done this week.

Mordy, Tuesday, 14 February 2012 20:45 (twelve years ago) link

2.4 this week is giving me a "That's correct!" but no "Next Exercise", grr.

Sort of feeling my patience wearing a bit thin. I think I find Javascript's syntax for object-oriented stuff a bit confusing, maybe because I've dabbled a (very) little w/Java but haven't really done any serious OO work. Interested to know if this makes more sense to people who are new to programming.

Dunno if it's because of that or because of the drip-learning method and not looking at it for a week in between but I feel like every time I'm only just remembering enough to scrape together the one or two lines required for each task and couldn't actually put together any real code on my own.

On the other hand, the big secret of programming and the only reason I get paid is you can go a surprisingly long way on not knowing what you're doing but kludging it together line by line until it compiles and you think "I wasn't expecting this to work yet, but it's giving me the right answers".

Schleimpilz im Labyrinth (a passing spacecadet), Thursday, 23 February 2012 22:52 (twelve years ago) link

the entire secret to writing code is to redefine the problem into its smallest, simplest units, write those, and then start combining things logically until voila! you have a program

if you can think/design in those terms, things become less daunting

robbery by sudden snatching (DJP), Thursday, 23 February 2012 22:55 (twelve years ago) link

(Actually I've just noticed it's ticked my 2.4 anyway so I may as well just manually go to the next section. Still feeling kind of joyless this week but maybe that's just me.)

I think what first drew me to programming is that I have a very can't-see-wood-for-trees approach: I like building things up line by line and being surprised when I have a forest because, oh, I was totally expecting to have to put some weevils under that fungus, does it really look like a forest already?

but it turns out that when people want to pay you for programming, or when you just want something that does more than amuse you and you alone for an hour or two, you need to look at it from the other end too: the boss wants a forest, what 4 main sections does it need? where are the paths between them? etc. and that's the part I'm not so good at.

also, the part where every year you have to spend your free time learning how to burn your forest down and start over with this year's new, hip kind of trees, because if you neglect to do that for 3 years running you're unemployable.

(I'm not good at metaphors either, you may have noticed)

Schleimpilz im Labyrinth (a passing spacecadet), Thursday, 23 February 2012 23:05 (twelve years ago) link

totally expecting to have to put some weevils under that fungus, does it really look like a forest already?

this might not make sense, so: most of my day job is munging sets of data input by bored, inconsistent humans, and I have SO many times thought "ok, if I do x and y it'll work on 95% of my data, and then I'll need fiddly special case z", and I've done a first pass with x and y only to find that that does in fact cover everything, special case z does not exist in my million records

I realise that if I was building software for anyone else to use all the special cases need covered, because one day someone's going to press the buttons in the wrong order and lose a day's work

(but it's not just a data-wrangling thing, either - when I was a kid I started a crappy 2d platform game, and when I put the jumping code in I just went "uhh for now I'll increment y every frame for 20 frames, then I'll decrement it again, and that's going to suck, but I'll take a look at it before I start worrying about parabolas", but it turned out to have a perfectly adequate jump-feel as it was)

sorry for tl;dr, will shut up and go to bed now

Schleimpilz im Labyrinth (a passing spacecadet), Thursday, 23 February 2012 23:17 (twelve years ago) link

(Chucky Egg did well enough using the increment / decrement thing iirc. and Manic Miner's parabolic jumps looked great but were annoyingly 1 pixel slower than walking)

koogs, Friday, 24 February 2012 08:11 (twelve years ago) link

oh my god so buggy this week. typos, poorly explained lessons, and on 6:2 in recursion you have to reload your browser to get the proper code to work. WTF.

Mordy, Friday, 24 February 2012 14:56 (twelve years ago) link

I didn't have that with 6:2 but I can't get it to OK my final code on the new dice game project even though I'm fairly sure it's doing the right thing

not liking this week's dice game, the instructions are hard to follow and the pre-written code is formatted in a really horrible way with extra line breaks and different tab stops all over the place

I mean I realise that my score on this is basically a meaningless number, damn my completist need to have 100% on every course

Schleimpilz im Labyrinth (a passing spacecadet), Friday, 24 February 2012 22:48 (twelve years ago) link

i now have two projects that aren't at 100% bc it doesn't clear like one or two lessons. driving me OCD-crazy

Mordy, Friday, 24 February 2012 22:50 (twelve years ago) link

update: in my quest for completeness I copied someone else's code from the Q&A section, except I didn't realise they'd replaced all the <s with LESS_THAN to get through the Q&A html rewriter, so it didn't run and gave me a syntax error... and the green tick I wanted

ffffuuuu etc

Schleimpilz im Labyrinth (a passing spacecadet), Friday, 24 February 2012 23:00 (twelve years ago) link

ok, for that OCD green tick, it looks like you can clear all the code in the final part of the project and hit run with a blank code window and get a "That's correct!"

I suggest you put your code in the clipboard before doing so just in case I'm wrong, of course

Schleimpilz im Labyrinth (a passing spacecadet), Friday, 24 February 2012 23:06 (twelve years ago) link

I would just like to be Uncle No-Fun and point out that if you ever find yourself in the real world typing (as you do in this week's assignment)


myVariable -= 0.1;

then you might want to think of other ways to represent your data

(because computers store everything as binary, they're OK with fractions where the bottom half is a power of 2. so a half is fine, three quarters is fine, five eighths, nine sixteenths: all OK. but they can't build up a tenth out of those fractions, the best they can do is add up ever more teeny fractions with a power of two on the bottom to get something approximately the same as 1/10.

that's probably OK if you just want to store 0.1 now, because the discrepancy is very tiny and the computer will brush it under the carpet and not tell you, but once you start repeatedly adding and subtracting 0.1s the difference gets bigger and bigger until you have a "rounding error" and suddenly all your sums are wrong or a loop doesn't finish when you think it's going to, etc.

yeah, that was quite boring. but, just saying.)

instant coffee happening between us (a passing spacecadet), Monday, 5 March 2012 22:56 (twelve years ago) link

(i actually had something very similar last night - adding items to a TreeSet and it thinking .99903 and .99904 were the same thing and refusing to add the second item (or replacing the first with the second or whatever it does. wasn't drawing one of my squares is all i know). i ended up multiplying everything by 10000. fixed point for the win...)

koogs, Tuesday, 6 March 2012 09:37 (twelve years ago) link

three weeks pass...

Is anyone still doing this? I just started it today - I've been at a new job for 3 weeks now and I have to get into Javascript (and CSS/HTML5/PHP and other webby stuff I have no idea about) so I figured I should do this in my spare time to get up to speed a bit.

In the Time Trials project there's an exercise where they change:


var totalTime = 0;
for ( i = 0; i < raceTimes.length; i++ ) {
totalTime = totalTime + raceTimes(square bracket)i(square bracket);
}

to:


for ( i = 0; i < raceTimes.length; i++ ) {
var totalTime = (totalTime || 0) + raceTimes(square bracket)i(square bracket);
}

saying it's cleaner and more efficient. This seems wrong to me, cleaner is arguable but how is it more efficient? Surely it's less efficient to have to do "or with 0" every time it loops than to not do that? Am I missing something?

The Eyeball Of Hull (Colonel Poo), Saturday, 31 March 2012 17:35 (twelve years ago) link

i would always use the former. and += in the loop.

that var in the second one just looks like a scope error to me.

koogs, Saturday, 31 March 2012 18:52 (twelve years ago) link

It looks like trying to be clever just to use fewer lines of code.

The Eyeball Of Hull (Colonel Poo), Saturday, 31 March 2012 18:55 (twelve years ago) link

yeah, that second bit of code is just ridiculous. it's good that youre already able to catch stuff like that

if i were trying to be clever and save 1 line of code, i'd write it like this:


for ( var i = 0, totalTime = 0; i < raceTimes.length; i++ )
{
totalTime += raceTimes[i];
}

diamonddave85, Saturday, 31 March 2012 19:05 (twelve years ago) link

that var in the second one just looks like a scope error to me.

I thought that at first but javascript doesn't have block scope, only function-level scope

and I can see absolutely no reason why their code is efficient or anything other than horribly ugly

(re "is anyone still doing this", I did half of last week's and like 20% of this week's and am wondering if I can be bothered any more)

instant coffee happening between us (a passing spacecadet), Saturday, 31 March 2012 19:22 (twelve years ago) link

Second one might be marginally faster, but trying to wring every ounce of speed out of a piece of Javascript isn't worth it. If execution speed was the main issue, you wouldn't be using Javascript in the first place. And it makes the code harder to read, never a good thing.

beanz meanz lulz (snoball), Saturday, 31 March 2012 19:29 (twelve years ago) link

> but javascript doesn't have block scope, only function-level scope

ok, didn't know that.

but it feels a lot like they are teaching javascript specific stuff that'll fall over in other languages and i think that's a bad idea.

(fwiw i don't like the initialisation (or incrementing) of anything other than the loop index in the for() - too easy to overlook. plus the mix of , and ; bugs me)

koogs, Saturday, 31 March 2012 21:35 (twelve years ago) link

and i'd save a line of code by having the { on the same line as the for 8)

(but only in java / javascript, in c (c++ / php) i'd have it as you have. lots of personal preferences, not all of which i can explain)

koogs, Saturday, 31 March 2012 21:37 (twelve years ago) link

I am slowly converting myself from { on the next line to on the same line. Don't really know why, especially when I held out from it even when I was writing a little Expect/tcl on the side, which will actually not sodding work if you put the braces on a new line and will give a super-cryptic error message to boot.

still don't like
} else {
but it doesn't really leave you any other option, so

(I mostly write Perl when I am not writing VBA, which doesn't have block braces, or swearing at Codecademy)

instant coffee happening between us (a passing spacecadet), Saturday, 31 March 2012 22:11 (twelve years ago) link

{ on next line till i die

makes brace matching a cinch (i suppose some smartarse will suggest i shouldn't be nesting that many braces) plus the extra white space makes things more readable imo.

God arrives for the apocalypse, having been traveling at the speed of (ledge), Saturday, 31 March 2012 22:18 (twelve years ago) link

{ on the next line, because it makes braced languages look more like white-spaced languages, and therefore easier to pick out blocks/see scopes by eye.

beanz meanz lulz (snoball), Saturday, 31 March 2012 22:21 (twelve years ago) link

i spent way too much time today getting a deck object for blackjack to work. finally realized that splice always returns an array, and trying to treat the one-element array that i was getting like the object contained within it was what was giving me all the errors.

circles, Sunday, 1 April 2012 05:58 (twelve years ago) link

is there one of these for iOS? gonna make a fb-integrated pictionary rip and ship it for $200mil to zyngas

༼◍ྀ ౪ ◍ི ༽ (cozen), Tuesday, 3 April 2012 20:40 (twelve years ago) link

good idea

lag∞n, Tuesday, 3 April 2012 20:49 (twelve years ago) link

i just tore through the html exercises to refresh my memory, took me all of 15 minutes. css is apparently forthcoming, could use that refresher too.

in the meantime javascript has taken a backseat to SQL, which is the one that might get me hired given what i'm shooting for.

BIG HOOS aka the steendriver, Saturday, 7 April 2012 05:37 (twelve years ago) link

two weeks pass...

1. Further to discussion upthread, found this about why it's a good idea to get in the habit of keeping the { on the same line as preceding code in javascript: [Removed Illegal Link]/
(if anyone is going to say that this makes JS a pretty lousy language, along with tcl which I was complaining about upthread for the same reason, well, yeah)

2. I am two weeks behind on codecademy, have I missed anything or just another 4 versions of the same old recursive function tutorials?

3. I signed up for udacity's CS101 which has just restarted for a new semester with (apparently?) no deadlines this time around, because I wanted to learn Python, and holy hell does this seem time-consuming - each week's unit is 40 short videos plus 20 multiple choice questions plus homework, and even though the videos are all only 1-5 minutes long and we haven't covered anything I didn't already know yet, it took me all afternoon to watch the first half of week 1's videos

(I was waiting for an email and, OK, ILXing a little in between videos, but still)

instant coffee happening between us (a passing spacecadet), Sunday, 22 April 2012 22:14 (twelve years ago) link

what do you want to know re: python?

Philip Nunez, Sunday, 22 April 2012 22:24 (twelve years ago) link

Bah, let's try that link again: [Removed Illegal Link]/

Philip: nothing specific really, I mainly just felt like dabbling. I write Perl for a living now, as does most of the team I'm in, and Perl obviously has a reputation as kind of old-fashioned, and the other dev team here uses mostly Python, so that's the most obvious new language to look at.

Yes, there are lots of books and ebooks and online tutorials, and I've bookmarked and downloaded probably tens of them already and never read them, so I thought having videos beamed into my home weekly might motivate me to do something...

(Also I liked the idea of building a search engine. I probably could build a basic one in a super-kludgy and horrible way in Perl, but I assume the course is going to do it in a much neater way.)

instant coffee happening between us (a passing spacecadet), Monday, 23 April 2012 13:43 (twelve years ago) link

[Removed Illegal Link]/

instant coffee happening between us (a passing spacecadet), Monday, 23 April 2012 13:44 (twelve years ago) link


You must be logged in to post. Please either login here, or if you are not registered, you may register here.