Transcript from the "Questions, continued" Lesson
>> Off Camera 1: There's another question on what the best way to go about debugging these jsbin examples is. Whether there's an easy way to step through them or something.
>> Joe Nelson: Jsbin has been a little bit confusing, both in the order of the listings And evaluates them. So, if I drop a debugger in these things I can try.
[00:00:24] I can use JavaSvript debugger, I suppose.
>> Off Camera 2: You know what you should do though real quick? Is show them the log. You just drop that in the middle of compose.
>> Joe Nelson: Sure, I need to define it. Some of the built in browser objects can't be composed for some reason you try and treat them as real objects ,they say illegal in locations.
[00:00:41] So we have to make a wrapper for log equals function X. We say console dialogue X. And we say return X. That way it can be composed to be put in a composition chain. The last thing it does is return whatever was given to it so we can say in here.
[00:01:02] It's kind of cool is putting up a composition.
>> Off Camera 1: I think you might need to run it again.
>> Joe Nelson: Okay, in that case I better copy this.
>> Joe Nelson: It worked, okay so there's that guy, no.
>> Joe Nelson: Get title.
>> Joe Nelson: We put a log in there in between and head
>> Off Camera 1: And a dot on head. I sort out that head problem for the header.
>> Joe Nelson: Yeah. So now, it printed out everything sucks, and it also printed out the object, cuz it logged it on its way through.
>> Off Camera 1: One thing I use with compose a lot, is if you define that as first title and don't call it right away.
[00:02:01] You can compose that with something else, right?
>> Joe Nelson: Help isn't working. So, you're saying call this first title?
>> Off Camera 1: Yeah.
>> Joe Nelson: With the log and the head.
>> Off Camera 1: So, now we've got our first title, and so, let's say, first title, and then is there there are a [INAUDIBLE]?
[00:02:34] Its a good stream function. [LAUGH]
>> Joe Nelson: LIke uppercase?
>> Off Camera 1: Yeah, or something.
>> Joe Nelson: It's just.
>> Off Camera 1: Or how about, I wonder if head will work?
>> Joe Nelson: Probably because the head of the string is possibly like the list. [LAUGH]. It's first letter. Okay.
>> Off Camera 1: Yeah. First letter of the first title.
>> Joe Nelson: This one is called ahead again.
>> Off Camera 2: An so [INAUDIBLE] underscore.
>> Joe Nelson: Yeah, thanks.
>> Off Camera 1: So you see there though it's defined that as first letter, right? So the first title and had his first letter. That's good.
>> Joe Nelson: Oops. No, it doesn't and then up fails to work out, it evaluates.
>> Off Camera 1: This is a bad example what I'm trying to get at is you're building a grammar of functions that you're naming. So I can compose first title and maybe HTML out of that, make the headers. So I'm gonna grab the first title and then I'm gonna compose that header and make that drop page.
[00:03:57] So it's drop page, is just the composition of first title and make header or whatever make H1. And the whole point of that is, you end up with this English that you're reading as your program. So, if you did it on the left side it would be a lot clearer, you'd be able to make your grammar in a couple functions and then use your grammar when you actually run your app.
[00:04:22] It's like you're programming with DSLs, without knowing it. Do your have questions about that? I think it's awesome.
>> Joe Nelson: I think the biggest thing. You also have gram dots and looking at the arrays and stuff. But the real thing comes with taking these functions and putting them all, the five or six types of containers [INAUDIBLE].
[00:04:40] Which will become really cool and clear.
>> Off Camera 1: But, if you see if you see any my controllers in a standard app, I'll bring one up. It's just this function, that function they're all just specifically named. This is going to do this, this going to do that, it's gonna do that.
[00:04:56] And then at the bottom, you've just got the composition of maybe get from DB and put on page. And ask the user what they want. And it's like, I see it. It just reads right to left. I don't know much either but. [LAUGH] I feel like it pushes you into this really high level style where you just writing what should happen.
[00:05:20] And it keeps you on the same level of abstraction pretty easily. Cuz, you want your sentence to be like do this, then that. Okay, those are the three things that make my page. And then above it and we'll see in the demo. We'll see that pretty clearly.
>> Joe Nelson: Someone once told me that at Pivotal Labs they use test driven development not just because they're worried about the correctness.
[00:05:39] But because it amplifies the pain you feel by doing certain things wrong. If you're doing unit test. So doing the style may amplify a way that would be less beneficial. Amplify the pain of doing it that way.
>> Off Camera 1: That's a good design technique for API design technique. You can do TDD.
>> Joe Nelson: Yeah, right.