Return to Video

Lecture 26 | Programming Methodology (Stanford)

  • 0:10 - 0:13
    put
  • 0:13 - 0:16
    this presentation is delivered by the stanford center for professional
  • 0:16 - 0:23
    development
  • 0:26 - 0:27
    study questions
  • 0:27 - 0:31
    about anything we've done so far and last and what you've got and foreign
  • 0:31 - 0:32
    experts topic
  • 0:32 - 0:36
    before we dive in particular topic
  • 0:36 - 0:37
    feeling okay
  • 0:37 - 0:40
    one of things that we sort of gone the whole time in this class we use these
  • 0:40 - 0:43
    things called a cm librarians
  • 0:43 - 0:47
    and they sam libraries are set of libraries contractually created by a
  • 0:47 - 0:50
    task force people they say the association for community really talked
  • 0:50 - 0:53
    about them at the very beginning of the christ we talked about these libraries
  • 0:53 - 0:57
    who put together some nice libraries have stopped at a really useful for
  • 0:57 - 0:59
    teaching which is actually why we use them
  • 0:59 - 1:02
    and so today i want to do it left a little bit underneath the hood and talk
  • 1:02 - 1:05
    a little bit about standard java
  • 1:05 - 1:08
    which is what you would get if you didn't use the aclu libraries and
  • 1:08 - 1:11
    you just use the standard java libros now i have no reason why you can't
  • 1:11 - 1:13
    continue to use the a c white recap of the class
  • 1:13 - 1:15
    that's another set of libraries that were written by a group of people that
  • 1:15 - 1:17
    you're certainly welcome to use
  • 1:17 - 1:19
    so there's no reason why you
  • 1:19 - 1:20
    should stop using them
  • 1:20 - 1:23
    but i just want to give you a little bit there's a couple important issues relate
  • 1:23 - 1:26
    to standard java that now is a time when we can find a lift the covers and it's
  • 1:26 - 1:28
    time for you to know
  • 1:28 - 1:35
    so the first thing that's related to thinking about standards outlined
  • 1:35 - 1:38
    you know when you're running your programs in uganda clips and you do your
  • 1:38 - 1:41
    you click on the little running guide to compile your programs and then it gives
  • 1:41 - 1:44
    you a list attention we ob
  • 1:44 - 1:48
    classes you actually might want to run sometimes if you only have one project
  • 1:48 - 1:49
    images only get one twice
  • 1:49 - 1:53
    but i think i think about it a maryland like in the game show for program i
  • 1:53 - 1:55
    actually have like four or five different classes
  • 1:55 - 1:59
    how can always knew which class to run acknowledged his name sir for class was
  • 1:59 - 2:01
    the class and i actually should run
  • 2:01 - 2:08
    right i had a bunch of classes and their anyone wanna venture a guess
  • 2:09 - 2:13
    it's only class wounded orion which is barry related to
  • 2:13 - 2:16
    and underlying issue which is that it's the only class that actually was
  • 2:16 - 2:17
    extending program
  • 2:17 - 2:20
    and so wanted extended program what actually was happening underneath the
  • 2:20 - 2:26
    hood of the atm_ libros is you are getting a method
  • 2:26 - 2:30
    and maine is actually the place now your total old enough to see main
  • 2:30 - 2:35
    maine is actually the method at which java classes actually start running
  • 2:35 - 2:38
    and so i think you should think now as you get a little distributor like and i
  • 2:38 - 2:40
    never wrote method called me
  • 2:40 - 2:44
    i never saw a method called main you're telling me that's where java programs
  • 2:44 - 2:45
    actually start running
  • 2:45 - 2:46
    yeah in fact it is
  • 2:46 - 2:49
    and it's because programs
  • 2:49 - 2:52
    provided this main method for you and with his main method in the program
  • 2:52 - 2:55
    was essentially get the rest of your program running by getting a few things
  • 2:55 - 2:57
    set up a ninety cannot cure runner
  • 2:57 - 3:00
    so you didn't actually need to worry about this
  • 3:00 - 3:01
    but now you're sort of old enough
  • 3:01 - 3:05
    to actually see what that means after dissolve about
  • 3:05 - 3:09
    so if we think about what this means that the guys and though hope for the
  • 3:09 - 3:11
    main method is also kind of where this part of a reason why we never showed you
  • 3:11 - 3:13
    the main method before
  • 3:13 - 3:17
    the head of hair for the main method is actually public
  • 3:17 - 3:19
    static
  • 3:19 - 3:20
    poorly
  • 3:20 - 3:23
    team but we're not done yet me and actually have some arguments
  • 3:23 - 3:26
    it has been a rehab stream
  • 3:26 - 3:28
    called pardons
  • 3:28 - 3:32
    as arguments and then something here happens inside of me
  • 3:32 - 3:35
    and we showed that you're on the first day we would have to go through and
  • 3:35 - 3:36
    explain what all these words man
  • 3:36 - 3:40
    before we explain what main even wise before we explained you how do you
  • 3:40 - 3:41
    writer first program
  • 3:41 - 3:42
    that would have been a pain
  • 3:42 - 3:46
    but now we can just tell you right public means is a public method you know
  • 3:46 - 3:49
    that if i call the other public methods you've written
  • 3:49 - 3:51
    static means that this is actually eight
  • 3:51 - 3:54
    method that belongs to the class
  • 3:54 - 3:57
    it's it instead it's not something that you would actually call on a particular
  • 3:57 - 3:58
    object right
  • 3:58 - 4:02
    so you never have some project like yours mine object action i call acts dot
  • 4:02 - 4:02
    main
  • 4:02 - 4:05
    maine is just something that gets called
  • 4:05 - 4:09
    class method as opposed to being a method that gets called on an instant
  • 4:09 - 4:11
    and avoid means just returns nothing
  • 4:11 - 4:15
    what it's getting passed in here is an array of strings you might say it was
  • 4:15 - 4:19
    that array of strings coming from that's actually harks back to the days of your
  • 4:19 - 4:22
    when computers weren't all nice in graphical when everything
  • 4:22 - 4:25
    and when people actually well programs they wrote a program and then they were
  • 4:25 - 4:28
    typing on what's called the command line they wrote the name of the program out
  • 4:28 - 4:29
    the actually typed it
  • 4:29 - 4:32
    and then they typed a bunch of things that they want to be passed into the
  • 4:32 - 4:33
    program
  • 4:33 - 4:36
    as sort of like initial information to start that program
  • 4:36 - 4:39
    though the national thanks hope you had some program like names are for
  • 4:39 - 4:43
    you might actually start off by giving the name of the program
  • 4:43 - 4:45
    and then happening separate you might give it some other people think that you
  • 4:45 - 4:47
    might give the name of the data file
  • 4:47 - 4:49
    like leader dot correct
  • 4:49 - 4:53
    anybody given it some other things as well but were separated by spaces
  • 4:53 - 4:58
    and this list of stop is essentially what gets passed in here is arguments
  • 4:58 - 4:59
    there just rings
  • 4:59 - 5:03
    and this is how the program would actually know what came in on what we
  • 5:03 - 5:06
    refer to as the command line when the program is kicked off a mighty
  • 5:06 - 5:10
    from our job is not that although the language right exotic came around really
  • 5:10 - 5:12
    sagging popularity in nineteen ninety five
  • 5:12 - 5:16
    people aren't doing a lot of nineteen ninety five like i already have like my
  • 5:16 - 5:19
    mouth and i have my folders and i have all this other stuff
  • 5:19 - 5:21
    even if you were like six years old
  • 5:21 - 5:24
    you probably already dead right and you like i never typed this stop
  • 5:24 - 5:28
    so why do i care about at the reason why you care about is actually java derived
  • 5:28 - 5:30
    from another language called seat which
  • 5:30 - 5:32
    and as a variation called c_ plus plus
  • 5:32 - 5:36
    that was created when people writing programs in the days of your and the
  • 5:36 - 5:40
    whole notion of maine and having some arguments they get passed to me kind of
  • 5:40 - 5:43
    came along with sort of the baggage of
  • 5:43 - 5:47
    actually having a program language becomes the sort of matches the c
  • 5:47 - 5:50
    stop programming languages when they did do this
  • 5:50 - 5:53
    so a lot of the times in a row java program these days there aren't really
  • 5:53 - 5:57
    any argument regarding mister some system parameters something like that
  • 5:57 - 5:58
    we don't usually worry about them
  • 5:58 - 5:59
    okay but just so
  • 5:59 - 6:02
    when you go and look at some other java program is that you can be a scam
  • 6:02 - 6:05
    library can you see this main thing in your wondering what's it all about
  • 6:05 - 6:07
    this is you don't think i mean analogously toronto
  • 6:07 - 6:10
    it's just won't give you know the whole time you've been thinking of running for
  • 6:10 - 6:12
    your execution starts
  • 6:12 - 6:15
    maine is really were executions
  • 6:15 - 6:17
    that you think about
  • 6:17 - 6:21
    okay execution actually started in maine so how did this thing actually kick off
  • 6:21 - 6:23
    my runescape
  • 6:23 - 6:25
    now you're short old enough to see that's you
  • 6:25 - 6:28
    so what it actually did like let's say this was the main method in a program
  • 6:28 - 6:29
    like
  • 6:29 - 6:30
    named surf
  • 6:30 - 6:32
    so somewhere
  • 6:32 - 6:36
    inside of eight op program inside the ec and libraries for program we have
  • 6:36 - 6:37
    this main method
  • 6:37 - 6:41
    they figured out what the name of your class was essentially it had a one-liner
  • 6:41 - 6:41
    renewed
  • 6:41 - 6:44
    that would have been approval incidents
  • 6:44 - 6:49
    new name surfer
  • 6:49 - 6:51
    and started
  • 6:51 - 6:53
    departed
  • 6:53 - 6:55
    start to wonder why
  • 6:55 - 6:56
    and now
  • 6:56 - 6:59
    you know what this means what was actually doing what it means you would
  • 6:59 - 7:01
    main started note
  • 7:01 - 7:04
    object exist in the world like at the static method
  • 7:04 - 7:08
    so there's no object that you're you know giving them a message to your just
  • 7:08 - 7:12
    main just kind of starts off wakes up says hey i mean what am i going to do
  • 7:12 - 7:13
    why don't i create
  • 7:13 - 7:18
    some object of this particular tightening surfer which happens
  • 7:18 - 7:20
    instantiate an object which is your program
  • 7:20 - 7:24
    and then remember your program as we can talk about implements the run method and
  • 7:24 - 7:26
    actually a program underneath the hood
  • 7:26 - 7:30
    implements the run double interface that we talked about last time remember with
  • 7:30 - 7:32
    threads we talked about the run a bowl interface
  • 7:32 - 7:35
    lol programs and plant or animal interface and how you kick off something
  • 7:35 - 7:38
    that's run double use a start
  • 7:38 - 7:43
    so what it basically did was created an object of your class which was named
  • 7:43 - 7:43
    surfer
  • 7:43 - 7:47
    and told at the start and it happened to start pass along these arguments
  • 7:47 - 7:50
    but you never needed to see those arguments the matter fact you never did
  • 7:50 - 7:51
    see them because
  • 7:51 - 7:55
    when your articles instantiated it didn't expect any arguments
  • 7:55 - 7:59
    so the argument actually got pass this thing called stock we just ignored them
  • 7:59 - 7:59
    basically
  • 7:59 - 8:03
    and then started to run method to kick everything off
  • 8:03 - 8:06
    and last summer we talked about start we talked about this in the context of
  • 8:06 - 8:09
    thread so we said hello you create a new thread
  • 8:09 - 8:11
    and that are the object that you're gonna start running we put inside of
  • 8:11 - 8:13
    thread we take the thread off with start
  • 8:13 - 8:16
    in this case we're not actually creating a new thread
  • 8:16 - 8:20
    we're just saying i want to start executing basically decided that bag is
  • 8:20 - 8:22
    created it implements run of course they'll start running from the method
  • 8:22 - 8:23
    run
  • 8:23 - 8:27
    but i'm not creating a new thread so this thing is going to execute in the
  • 8:27 - 8:29
    same thread of execution
  • 8:29 - 8:31
    as the entire
  • 8:31 - 8:35
    so i don't suddenly kick off something that's running in parallel with this guy
  • 8:35 - 8:37
    it's actually just sequentially going to start name surfer
  • 8:37 - 8:42
    and that's the last thing that this guy does which is based on a valuable
  • 8:42 - 8:43
    sam questions about that
  • 8:43 - 8:46
    kind of a funky concept but that's basically what's going on you should see
  • 8:46 - 8:47
    it
  • 8:47 - 8:50
    we're creating an instance of your program and then just kicking it off
  • 8:50 - 8:53
    and that's why this whole time we have this thing called the run method that
  • 8:53 - 8:54
    had to be public
  • 8:54 - 8:58
    because is implementing the rundle interface but now you've seen any
  • 8:58 - 9:01
    and the only reason you know you kind of mca
  • 9:01 - 9:04
    added meaning your program to begin with and include all the score the only
  • 9:04 - 9:05
    reason we didn't put it in there before
  • 9:05 - 9:08
    it because will want to planing to stop
  • 9:08 - 9:12
    in week two of the class like right after kalra lower like all the dancing
  • 9:12 - 9:13
    provide on right
  • 9:13 - 9:16
    artillery by turning around the world i think java
  • 9:16 - 9:18
    public static void main string args like
  • 9:18 - 9:21
    what is going on right we hadn't done a raise
  • 9:21 - 9:23
    then done classes with
  • 9:23 - 9:27
    fingering about static we certainly and methods then demand bremer past
  • 9:27 - 9:33
    so we just wait until the end of ninety cm now you know what's going on
  • 9:33 - 9:34
    now that we have a bad idea
  • 9:34 - 9:38
    now we can think about okay if this is kind of like the standard javaworld days
  • 9:38 - 9:42
    let me think about taking this idea and using its help me take my existing
  • 9:42 - 9:45
    programs that i've written and pack them up into a form so i can share them with
  • 9:45 - 9:47
    family and friends
  • 9:47 - 9:49
    so that's what we're going to do next
  • 9:49 - 9:55
    the basic concept of doing this as something that's called a jar file
  • 9:55 - 9:59
    and you've actually seen jar files before because you've been working with
  • 9:59 - 10:02
    something this whole time in your product projects
  • 10:02 - 10:04
    called pcm dot jar
  • 10:04 - 10:06
    this was just eight jar file
  • 10:06 - 10:08
    they contained all the atm_ libraries
  • 10:08 - 10:11
    so basically college are pile is where to get its name is not because it's like
  • 10:11 - 10:14
    i did a big mason jar although you can think of it like that
  • 10:14 - 10:17
    it stands for a job loc
  • 10:17 - 10:19
    archive
  • 10:19 - 10:21
    that's where the name comes
  • 10:21 - 10:24
    and the basically behind a jar file as this thing can contain a bunch of
  • 10:24 - 10:28
    different stuff most the time when it contains is a bunch of classes in job
  • 10:28 - 10:32
    and you could think of this is the compiled version of the classes
  • 10:32 - 10:36
    you can actually put source code inside of a jar if you want but most the time
  • 10:36 - 10:37
    when you get a jock
  • 10:37 - 10:40
    it doesn't have the source code associate with it it just has the actual
  • 10:40 - 10:42
    dot class five to the compiled version of the files
  • 10:42 - 10:45
    so you could put source pausing here if you want it
  • 10:45 - 10:48
    you complete data files in here if you want to put a bunch things in here if
  • 10:48 - 10:48
    you want
  • 10:48 - 10:52
    what we're really going to focus on the case of putting classes
  • 10:52 - 10:55
    so one of these already existed for you with a cm dot jar
  • 10:55 - 10:58
    and want to figure out how to actually create some of these ourselves
  • 10:58 - 11:01
    and use them because they could actually think of them as something that's
  • 11:01 - 11:02
    wonderful
  • 11:02 - 11:05
    were executed like ships and not confuse ramblings
  • 11:05 - 11:07
    so click on the computer
  • 11:07 - 11:09
    here's name sir
  • 11:09 - 11:12
    and then a natural working version of nameserver so i'm not going to show
  • 11:12 - 11:15
    press the files in case you're going to make this
  • 11:15 - 11:19
    but all the code in here and for the first thing i didn't mean surfer program
  • 11:19 - 11:23
    if i thought about me i want to think of this and the standard javaworld now even
  • 11:23 - 11:26
    though i'm do you still using the atm_ libraries
  • 11:26 - 11:29
    when i want to build this jar i want to build the joint away the sort of makes
  • 11:29 - 11:33
    maximally portable like i can give it to someone who's over here on the species
  • 11:33 - 11:34
    i've never here on the snack
  • 11:34 - 11:37
    and they don't need to have a klutz or anything like that they can just one of
  • 11:37 - 11:38
    the whole point
  • 11:38 - 11:40
    so the first thing to do
  • 11:40 - 11:43
    if the introduced my friend the main method
  • 11:43 - 11:46
    and so basically i put in the car that you just opt out at a method public
  • 11:46 - 11:51
    static void main as this array of strings called arc that sits parameters
  • 11:51 - 11:54
    that's just the way maine is always defined to be
  • 11:54 - 11:57
    and what it's going to do is create a new name sir project
  • 11:57 - 11:58
    and kick it off
  • 11:58 - 12:02
    and that's the only thing i need to add to my program so anywhere you had some
  • 12:02 - 12:03
    class
  • 12:03 - 12:04
    extended program
  • 12:04 - 12:07
    you would add these three lines of code
  • 12:07 - 12:11
    so basically get us sort of compliant with standard job
  • 12:11 - 12:14
    once we do that now we need to create this thing called the jar file which is
  • 12:14 - 12:18
    thing the racks would be able to x
  • 12:18 - 12:21
    one thing you might be saying to yourself this maryland you told me the
  • 12:21 - 12:24
    aclu libras already sort of provide this for me so why my putting it
  • 12:24 - 12:29
    explicitly in there is a matter of fact it's not super required to be in their
  • 12:29 - 12:29
    explicitly
  • 12:29 - 12:33
    the real reason why we put in their explicitly is to try to maximize
  • 12:33 - 12:36
    portability because even though java spoke at this property were like
  • 12:36 - 12:39
    uh... we would like the java code want to make a run on pcs in run on maxim
  • 12:39 - 12:44
    ic ron you know this time tiger and not for adults other stuff
  • 12:44 - 12:48
    in reality personal differences between these operating systems
  • 12:48 - 12:51
    and so little problems creep up here in there every once in while you actually
  • 12:51 - 12:53
    saw fuck you does in class on occasion
  • 12:53 - 12:56
    so your experience them in the letter
  • 12:56 - 13:00
    by putting in this one explicitly robin kind of relying on the code it in the a
  • 13:00 - 13:04
    c l_ libros exactly doing a bunch more complicated stuff right because
  • 13:04 - 13:07
    itni in for what the name of your class wise right you never told that
  • 13:07 - 13:09
    explicitly gracie i'm library
  • 13:09 - 13:12
    yeah i need a new one of these guys actually there's job as a story called
  • 13:12 - 13:14
    reflection reckon actually go in safe
  • 13:14 - 13:18
    i'll let me take a moment to reflect i'm going to go and look at the names of
  • 13:18 - 13:19
    your classes
  • 13:19 - 13:22
    and then do something actually generate some code based on the names of your
  • 13:22 - 13:24
    classes which is what it was doing
  • 13:24 - 13:28
    that kind of stuff going down a little bit coffee so we're just gonna say aid a
  • 13:28 - 13:31
    cm don't worry about it i'm just given it to you i'm a i'm a nice guy
  • 13:31 - 13:36
    say he's put this in to make it exposes our maximizes portability main reason
  • 13:36 - 13:40
    so how do we create a thing called a dropout what we're doing here
  • 13:40 - 13:42
    steps are all in excruciating detail on your hand out they don't need to worry
  • 13:42 - 13:46
    about scribbling down notes quickly but what we're gonna do is you first click
  • 13:46 - 13:48
    as the death multiple by the whole thing
  • 13:48 - 13:53
    you select the project that you wanna create the jobs are from so nameserver
  • 13:53 - 13:56
    and then we've got a farm and you and we pick export
  • 13:56 - 13:59
    to this whole time you were to imports when you are bringing stuff in and now
  • 13:59 - 14:01
    it's finally time for you to give something back to the world in the form
  • 14:01 - 14:03
    of export
  • 14:03 - 14:05
    so what you want to be when you click export is
  • 14:05 - 14:08
    it brings up a little dialogue box sometimes the sand clothes sometimes
  • 14:08 - 14:11
    it's open if it's not a big givers closed
  • 14:11 - 14:14
    an inside job when you click on jar products which you want to bring about
  • 14:14 - 14:18
    sniper and jar like on there for a permanent star if i can act
  • 14:18 - 14:20
    cams can take you through all the steps
  • 14:20 - 14:23
    we need to specify couple things your first we need to specify with in the jar
  • 14:23 - 14:27
    file salmon open up names are for and what i want to put inside the job cause
  • 14:27 - 14:30
    i don't want to have all of name surfer and the jar file it turns out
  • 14:30 - 14:33
    if you throw everything in there including the stuff called dot project
  • 14:33 - 14:35
    not classpath
  • 14:35 - 14:37
    it actually gets a little bit confused to some of those things are not germane
  • 14:37 - 14:40
    to what we want to pack up and our jar there just kind of other
  • 14:40 - 14:43
    uh... administrative information what we really want to have his everything
  • 14:43 - 14:45
    inside the default pack
  • 14:45 - 14:48
    so i just click on before package i can double click on this to make sure that
  • 14:48 - 14:50
    all of my java files are
  • 14:50 - 14:54
    that's what i want to my job i want basically all of my job file for the
  • 14:54 - 14:57
    compiled version of all blanco ob
  • 14:57 - 14:58
    job files
  • 14:58 - 15:01
    and make sure that this is click but by the father just make sure export
  • 15:01 - 15:03
    generated class files and resources
  • 15:03 - 15:07
    so what it's going to do is compiled those java files into that corresponding
  • 15:07 - 15:07
    class files
  • 15:07 - 15:09
    and that's what it's going to put in a jar
  • 15:09 - 15:13
    there are other options like i got export the java source file taiwan it
  • 15:13 - 15:15
    right then i get some of the actual source code
  • 15:15 - 15:18
    most the time you don't want to do this if you don't want people like sort of
  • 15:18 - 15:21
    sniffing for your source code just like there take the compiled by these are my
  • 15:21 - 15:24
    brethren give you the first timers like thirty days and my birth a good point
  • 15:24 - 15:27
    but we've got a given you this works
  • 15:27 - 15:28
    so once we have this
  • 15:28 - 15:33
    waiter now specified where do we want to save this jar file so that's what this
  • 15:33 - 15:36
    you know select the export destination what they should have a status
  • 15:36 - 15:38
    what you want to say that
  • 15:38 - 15:41
    that the export destination so where we want to say that we can browse around
  • 15:41 - 15:45
    where we want to save it is based on hard created a folder that has all my
  • 15:45 - 15:46
    name surfer code in it over here
  • 15:46 - 15:50
    i'm just gonna save the jar found that same folder so this is just in the same
  • 15:50 - 15:53
    folder for my project called names or for that has all of my class files in it
  • 15:53 - 15:56
    you don't put out wherever you want just don't forget where you quit that's kind
  • 15:56 - 15:57
    of the key
  • 15:57 - 16:00
    so this is why i'm going to say that so that's kind of sad
  • 16:00 - 16:02
    up and you don't need to worry about the options down here the options down here
  • 16:02 - 16:03
    just you know
  • 16:03 - 16:06
    they're fine faults that there are
  • 16:06 - 16:09
    then you come here to this point it seems like
  • 16:09 - 16:13
    olney what's going on export file compile errors of compile warnings yet
  • 16:13 - 16:15
    which one export everything we don't care
  • 16:15 - 16:17
    stories click
  • 16:17 - 16:21
    and then we come here this is the most interesting part of the whole thing
  • 16:21 - 16:24
    what we want to do when we actually create this jar file and this is
  • 16:24 - 16:28
    something we only need to do when we have other jar file but the a c ally
  • 16:28 - 16:29
    brief need to worry about
  • 16:29 - 16:33
    wait for what's known as generate a manifest file
  • 16:33 - 16:37
    basically all the manifest file is it's a complicated name manifest in backup
  • 16:37 - 16:40
    investors out forms like all what has been you know it sounds like you're on a
  • 16:40 - 16:43
    boat doesn't like to have the cruise director and i like all words the
  • 16:43 - 16:44
    passenger manifest
  • 16:44 - 16:47
    wrote a column manifested austin emphathize like two month long and then
  • 16:47 - 16:50
    you add one lines when it becomes three lines one
  • 16:50 - 16:54
    it's basically just a little bit of administrative information that's capt
  • 16:54 - 16:55
    around with your jar file
  • 16:55 - 16:59
    so knows all what kinda stuff for you using with this jar file that's really
  • 16:59 - 17:00
    all it is
  • 17:00 - 17:03
    so what we want to do is generate the manifest file we make sure save the
  • 17:03 - 17:06
    manifest in the workspaces check which it should be if you click generate and
  • 17:06 - 17:07
    test file
  • 17:07 - 17:10
    and then you need to specify where you want to save the manifest file
  • 17:10 - 17:13
    and the place i want to say that is basically in the same folder for my name
  • 17:13 - 17:17
    sir for project in the name manifests are usually the name you give it a good
  • 17:17 - 17:18
    browse around if you want to
  • 17:18 - 17:21
    but usually the name you give it is the name of the folder that all your project
  • 17:21 - 17:25
    stuff sent and then the name manifest destiny than actual name
  • 17:25 - 17:26
    answer any questions about that
  • 17:26 - 17:27
    manifest off
  • 17:27 - 17:30
    the other thing you need to do when you're specifying a georgia george just
  • 17:30 - 17:32
    a bunch of classes
  • 17:32 - 17:34
    it needs to know in some sense
  • 17:34 - 17:37
    if someone can that running this chart with you actually you'll see that in
  • 17:37 - 17:39
    fact you can run a jar
  • 17:39 - 17:42
    where should it start which class is the one
  • 17:42 - 17:44
    of which i should call its main
  • 17:44 - 17:48
    and that's what you specify here select the class of the application entry
  • 17:48 - 17:49
    points
  • 17:49 - 17:51
    is kind of a very formal way of saying
  • 17:51 - 17:54
    where should i start running
  • 17:54 - 17:58
    so the place i want to start running is it lists you all of the classes
  • 17:58 - 18:01
    that have a main method for those are all the ones and start running some
  • 18:01 - 18:05
    names are for the only one i click up and so it says the main classes name sir
  • 18:05 - 18:09
    and now there's no more next buttons now i can do is put finish
  • 18:09 - 18:14
    and i just created a juror
  • 18:14 - 18:17
    and you like are you guys got doubleclick doubleclick
  • 18:17 - 18:18
    or not there yet
  • 18:18 - 18:21
    now there's two things that you'll notice if you look over here in the
  • 18:21 - 18:23
    package explorer
  • 18:23 - 18:26
    you'll notice now we have something called a manifest fark is that's why i
  • 18:26 - 18:26
    saved it
  • 18:26 - 18:30
    and i also have names surfer jot dot jar the jar file i just created they were
  • 18:30 - 18:33
    both put in the same folder with my other
  • 18:33 - 18:36
    you know files that's why i want to save them so they have michelle from the
  • 18:36 - 18:39
    package explore now you're the funky things
  • 18:39 - 18:43
    even though we created this manifest in created this jar they don't have quite
  • 18:43 - 18:46
    the right information that we want to what we do is we double click on the
  • 18:46 - 18:48
    manifest file to open it up
  • 18:48 - 18:49
    here's the whole manifest file
  • 18:49 - 18:52
    it's got a version which is one point no
  • 18:52 - 18:55
    and it's not the main class which is named surf why does it know the main
  • 18:55 - 18:58
    classes nameserver
  • 18:58 - 19:01
    cuz i told it right that the application entry point just forward
  • 19:01 - 19:04
    letting me know that i told it
  • 19:04 - 19:06
    that's why the application starts
  • 19:06 - 19:08
    now there's one other thing i need
  • 19:08 - 19:10
    besides ducking for cover one can you get started
  • 19:10 - 19:13
    what i need to do it i need to say hey you know what
  • 19:13 - 19:15
    names are free and i think it's time
  • 19:15 - 19:18
    but you also need to use the aclu libraries and it says
  • 19:18 - 19:21
    how yet you didn't tell me about the same i've written you say well now i'm
  • 19:21 - 19:22
    going to add
  • 19:22 - 19:27
    the coveted third mondale and talked about in the manifest fosamax modify the
  • 19:27 - 19:27
    manifest file
  • 19:27 - 19:30
    at something called the classpath
  • 19:30 - 19:34
    and all of class that is it's actually looks just like this capital c dash
  • 19:34 - 19:35
    capital p
  • 19:35 - 19:37
    classpath just tells basically
  • 19:37 - 19:39
    uh... the application
  • 19:39 - 19:43
    what other stuff for using are there other jar files that you're using and so
  • 19:43 - 19:45
    what you specify here
  • 19:45 - 19:49
    is the name of any jar files that you're going to be using as part of your
  • 19:49 - 19:51
    program separated by space
  • 19:51 - 19:55
    some unease pcm dodge are here is a cm najjar overhear has
  • 19:55 - 19:58
    i'm way you'd be a cm libraries no drawn some jar file
  • 19:58 - 20:02
    and i'm also going to use the jar file i just created name surfer dot jar
  • 20:02 - 20:06
    if i had three or four more jar file that list them on the same line so if
  • 20:06 - 20:09
    you were going to write an application someday where you're like
  • 20:09 - 20:13
    hey i got this drop off my friend here the job by downloaded from the web which
  • 20:13 - 20:14
    i wouldn't encourage you to do
  • 20:14 - 20:17
    and hear the sardar falcon somewhere else his list of all your space in
  • 20:17 - 20:18
    between
  • 20:18 - 20:22
    and then you save the file that's the problem most difficult thing that people
  • 20:22 - 20:24
    forget it saved the fosse save the manifesto
  • 20:24 - 20:27
    and now what exactly do all this
  • 20:27 - 20:31
    created jawahar all over again placard
  • 20:31 - 20:32
    wife it's just like misaddressed
  • 20:32 - 20:34
    here and i was going to work
  • 20:34 - 20:37
    he recommended a little bit different if i'm robin dong a file maneuvering export
  • 20:37 - 20:39
    i'm going to take the advanced ports i'm going to write
  • 20:39 - 20:42
    like on the project name pick export
  • 20:42 - 20:45
    just says that brings up exactly same window
  • 20:45 - 20:47
    i'm going to export a jar file
  • 20:47 - 20:50
    i come over here why do i want to export sorry abt all this crap eunice again
  • 20:50 - 20:53
    what i want to export is not all the stuff i just want to export everything
  • 20:53 - 20:55
    in my default
  • 20:55 - 20:59
    why do i want to say that i want to save it in the same place i had before you
  • 20:59 - 21:00
    might say but now im
  • 21:00 - 21:03
    aren't going to replace the one that already exists
  • 21:03 - 21:07
    i need to replace the one that already exist updated my manifest i need say hey
  • 21:07 - 21:09
    buddy it's not just about you anymore
  • 21:09 - 21:14
    now it also involves a cm judge our like okay okay you can replace the old
  • 21:14 - 21:16
    so i'm going to put it in the uk
  • 21:16 - 21:17
    places before
  • 21:17 - 21:22
    now a quick next here's the thing about export warning export baritone karen
  • 21:22 - 21:22
    export
  • 21:22 - 21:25
    here is the only place where things are different
  • 21:25 - 21:29
    the second time i go through this whole thing i don't want to generate another
  • 21:29 - 21:30
    manifest file
  • 21:30 - 21:34
    cuz i generated a manifest file the first time and then i modified
  • 21:34 - 21:39
    what i want to do is use that modified to manifest file so i say use existing
  • 21:39 - 21:41
    manifest from workspace
  • 21:41 - 21:42
    which is again just a formal way of saying
  • 21:42 - 21:45
    yeah use the manifest part are you there
  • 21:45 - 21:48
    asked me where they manifest on strangely enough if you look
  • 21:48 - 21:52
    this is exactly the same tax this year
  • 21:52 - 21:54
    yang belgrade's it it's like
  • 21:54 - 21:58
    while real broader trapping the suns out everyone singin in the streets
  • 21:58 - 22:00
    that's you know you just say that that's the one you want to use its going to be
  • 22:00 - 22:02
    the same name
  • 22:02 - 22:03
    and now i noticed this
  • 22:03 - 22:05
    which class of the entry point is great out
  • 22:05 - 22:09
    it's great acts like a little bit before your entry point is named surfer
  • 22:09 - 22:12
    that's in the manifest file if that's already in a manifest on using it
  • 22:12 - 22:16
    doesn't need to know what again so it doesn't even like me specified again
  • 22:16 - 22:17
    so you know that's different
  • 22:17 - 22:18
    and then i click finish
  • 22:18 - 22:21
    and give me one last warning you sure you want to over i got last drop on he
  • 22:21 - 22:25
    was your friend he was hanging out with you since the beginning about
  • 22:25 - 22:27
    three minutes ago and i say yes long way
  • 22:27 - 22:30
    we we know each other that long thanks for playing
  • 22:30 - 22:33
    now i've created this drop on your life
  • 22:33 - 22:33
    primary
  • 22:33 - 22:36
    what you do now
  • 22:36 - 22:39
    i come over here and i said
  • 22:39 - 22:42
    or the jar file displayed
  • 22:42 - 22:44
    one thing i can do it the drop by the n_ double click on it
  • 22:44 - 22:47
    and by double click on the jar file
  • 22:47 - 22:50
    it just starts kicking off the names are propagation
  • 22:50 - 22:54
    right i don't need a clips anymore to go and ron and have little run big compile
  • 22:54 - 22:59
    i have a lap haitian unlike our yeah bob how popular it right now bob kind of
  • 22:59 - 23:02
    alfono means on that some other interesting ones are going to be the
  • 23:02 - 23:05
    other night off
  • 23:05 - 23:07
    six after the sixties
  • 23:07 - 23:09
    dawn done deal thanks for playing
  • 23:09 - 23:12
    so can you name your children vermont make a comeback
  • 23:12 - 23:15
    and so he interpret just kinda running here and it's fun it's just a little
  • 23:15 - 23:16
    stand-alone application
  • 23:16 - 23:19
    now if you want to pack it to the sop and send it to a friend of yours what
  • 23:19 - 23:23
    you would actually do he wouldn't just sending surfer about dot jar
  • 23:23 - 23:26
    what you would do is you would say hey you know what i want to do
  • 23:26 - 23:28
    i want to create
  • 23:28 - 23:29
    i'll i'll just do it in here
  • 23:29 - 23:31
    some new folder
  • 23:31 - 23:35
    so i'm going to create some new folder and all call this my programmer whatever
  • 23:35 - 23:37
    you want to call him talking to call it mean surfer again ferreting out for the
  • 23:37 - 23:39
    call mister my program
  • 23:39 - 23:41
    and want to put my program
  • 23:41 - 23:42
    that folder
  • 23:42 - 23:44
    if the jar
  • 23:44 - 23:45
    of my program
  • 23:45 - 23:50
    also going to put in the jar obviously enlai break as i also need that kind of
  • 23:50 - 23:50
    separate
  • 23:50 - 23:55
    and i also need in here and he gave the files like names dot data and not names
  • 23:55 - 23:58
    dash data reading about all the data to get reading on the program starts it's
  • 23:58 - 24:01
    not like magically that's just going to be very down right it's not going to go
  • 24:01 - 24:03
    in try to find out file
  • 24:03 - 24:04
    so i need to put all this stuff here
  • 24:04 - 24:07
    and now this folder or something i could zip up and sent to a friend of mine on
  • 24:07 - 24:09
    my friend get so they would be like all
  • 24:09 - 24:11
    nature provides our
  • 24:11 - 24:13
    and then they go
  • 24:13 - 24:16
    so now you can package up any program that you've written in this class
  • 24:16 - 24:17
    remember to put in maine
  • 24:17 - 24:20
    you got to go through started this to part
  • 24:20 - 24:24
    create the jar exporter process modify the manifest great other jar put it out
  • 24:24 - 24:25
    there again
  • 24:25 - 24:26
    but you're going to go
  • 24:26 - 24:28
    face any questions about that
  • 24:28 - 24:31
    now you can package up in and share with friends
  • 24:31 - 24:34
    now what's even cooler than sharing with friends that you could email stuff too
  • 24:34 - 24:36
    is share with friends on the web
  • 24:36 - 24:39
    as you just have mike you know millions of fans on the web most of the leaders
  • 24:39 - 24:42
    don't know about but they're probably you know in the late hours of the night
  • 24:42 - 24:45
    looking at your web page that exist
  • 24:45 - 24:46
    and you can actually take
  • 24:46 - 24:48
    anne
  • 24:48 - 24:51
    files that you crave your like jar files and make them available in a web browser
  • 24:51 - 24:54
    now there's one other thing i should mention the scandal thing before you
  • 24:54 - 24:55
    send now you go
  • 24:55 - 24:59
    credo messed up and send it off your mom or dad died monday i break our book why
  • 24:59 - 25:00
    it's a good time
  • 25:00 - 25:04
    in order for them to run your job clouds they need to have the java runtime
  • 25:04 - 25:05
    environment install
  • 25:05 - 25:09
    i remember on like the second week of class when we said although it is just
  • 25:09 - 25:10
    one oh six website
  • 25:10 - 25:14
    you need to download eclipse there's a thing called the jr you also need to
  • 25:14 - 25:15
    download
  • 25:15 - 25:15
    if you have a map
  • 25:15 - 25:19
    the jerry in most cases already installed if you have windows it's not
  • 25:19 - 25:19
    installed
  • 25:19 - 25:23
    they need to go and down you can actually sent into the cfo_ six pages
  • 25:23 - 25:27
    a day download the gary here is a copy of my cannot five
  • 25:27 - 25:28
    go ahead and install it
  • 25:28 - 25:31
    and then they can run your programs because your program can't run if you're
  • 25:31 - 25:34
    poor if the computer doesn't have a job or write it's a bunch of stuff is going
  • 25:34 - 25:36
    to execute java bytecode
  • 25:36 - 25:36
    if you'd like
  • 25:36 - 25:39
    what java bytecode allen told me were java bytecode is
  • 25:39 - 25:42
    i don't know what to do with it and so i won't run into any of the java runtime
  • 25:42 - 25:43
    environment
  • 25:43 - 25:47
    now assuming of johnson's summer have the java runtime environment
  • 25:47 - 25:50
    they could go to take a web page
  • 25:50 - 25:52
    and you might put some page on the web
  • 25:52 - 25:56
    yeah allows you to load your applicant your ap lit is just in web applied
  • 25:56 - 25:58
    version of your program
  • 25:58 - 25:59
    and so here
  • 25:59 - 26:02
    all look it's running inside a web browser right this is of the actual
  • 26:02 - 26:07
    application this is my web browser or cuz i could like from here go to
  • 26:07 - 26:07
    you know
  • 26:07 - 26:10
    i don't know some search engine
  • 26:10 - 26:12
    right i'm sittin in the web browser
  • 26:12 - 26:14
    i'm not just running a regular application
  • 26:14 - 26:18
    on my desktop but this guy's actually running in my web browser
  • 26:18 - 26:20
    how did i make that happen
  • 26:20 - 26:21
    here's how i make it
  • 26:21 - 26:24
    i create a web page
  • 26:24 - 26:27
    if you don't know about age ten on creating web pages
  • 26:27 - 26:30
    unfortunately i can explain that to you and five minutes
  • 26:30 - 26:33
    but what i can show you is basically what this bosnia look like so if you
  • 26:33 - 26:37
    know a little bit of html or you just want to essentially copy and paste this
  • 26:37 - 26:38
    idea
  • 26:38 - 26:39
    this'll work for you
  • 26:39 - 26:43
    so all you do as you say i want to decipher the entire page that generates
  • 26:43 - 26:45
    that allows your applicant run
  • 26:45 - 26:48
    usse this page's html state is all things called pat
  • 26:48 - 26:53
    the name of that page is named surfer an acquittal table on the cradle border
  • 26:53 - 26:56
    around my applications but i want to business
  • 26:56 - 26:59
    what's my application my whole updation is right here
  • 26:59 - 27:01
    i have a catholic
  • 27:01 - 27:03
    what's the name of the archive
  • 27:03 - 27:08
    which is a java archive the contains my applicants name surfer dot jar
  • 27:08 - 27:11
    code is what's the entry point right this time no longer have the manifest
  • 27:11 - 27:14
    file available to it so it does what's my entry point
  • 27:14 - 27:18
    named jeffrey dot class that's where you start running felt that i want to go to
  • 27:18 - 27:20
    nature for dot class fine with me now if i start running
  • 27:20 - 27:23
    and the space i'm going to give you are running on the screen is five hundred
  • 27:23 - 27:24
    seven hundred by five hundred
  • 27:24 - 27:26
    and that little snippet of code
  • 27:26 - 27:30
    is what goes on whatever web surfer this webserver this is sitting on
  • 27:30 - 27:32
    looks for those job clouds
  • 27:32 - 27:36
    slaps them into the page and then someone good to go to running for java
  • 27:36 - 27:38
    program inside of us
  • 27:38 - 27:41
    just wondered how many people know html
  • 27:41 - 27:45
    you folks are over summer some number folks that this might be reasonable
  • 27:45 - 27:48
    thing to do if not you just don't need to worry about it it's not a big deal
  • 27:48 - 27:51
    just send the application your friends
  • 27:51 - 27:54
    the one i can use you know if you create a little webpage
  • 27:54 - 27:57
    is that when something is running on the web page it does not have access to the
  • 27:57 - 27:59
    rest of the files
  • 27:59 - 28:01
    what that means is
  • 28:01 - 28:06
    if i actually happened to be over here notice i have index dot html i have name
  • 28:06 - 28:09
    surfer dodge are not have a cm dot rar
  • 28:09 - 28:12
    what happened to my name's dash datafile
  • 28:12 - 28:14
    yet it doesn't exist
  • 28:14 - 28:17
    why doesn't exist 'cause i couldn't really anyway 'cause once i'm running on
  • 28:17 - 28:21
    the web browser for security reasons it doesn't let you get going to pull stuff
  • 28:21 - 28:23
    out of your files
  • 28:23 - 28:27
    okay 'cause evaded people could you really bad things your computer
  • 28:27 - 28:30
    what you need to do if you're like a mountain where is that data you you
  • 28:30 - 28:33
    minus running show from the web what'd you do
  • 28:33 - 28:36
    yours fears the dirty little secret
  • 28:36 - 28:39
    actually created giant array that had all the data in it
  • 28:39 - 28:41
    and made a part of the program
  • 28:41 - 28:44
    so sometimes you can do stuff like that if you don't want to actually read from
  • 28:44 - 28:45
    a file
  • 28:45 - 28:48
    the other thing you can do is you can take those files and include them in the
  • 28:48 - 28:49
    jar file
  • 28:49 - 28:52
    to the jar copy not only have compiled class in the cars have data files about
  • 28:52 - 28:55
    another way of doing if you want to do it
  • 28:55 - 28:58
    but we just don't have time to talk about the decals those kind of the same
  • 28:58 - 28:58
    process
  • 28:58 - 29:03
    and when you're exporting stuff the dropped by use of something data files
  • 29:03 - 29:05
    so that's clearly executed
  • 29:05 - 29:08
    now i know that we know all this funky stuff about all acts to go back put on a
  • 29:08 - 29:12
    web page if i want to just like you know feel unhappy i'm going to go
  • 29:12 - 29:15
    it's time to come back to our friend
  • 29:15 - 29:18
    standard job as a standard java what kind of allowed us to all you know think
  • 29:18 - 29:20
    about doing to stop as we learned about me
  • 29:20 - 29:24
    and i want to show you a couple examples of program could actually don't use the
  • 29:24 - 29:25
    aclu libraries at all
  • 29:25 - 29:28
    to show you why we use the a c my brisket one thing you might be wondering
  • 29:28 - 29:30
    if
  • 29:30 - 29:34
    why weren't we just doing the standard java thing the whole time
  • 29:34 - 29:35
    and part of the reason is
  • 29:35 - 29:39
    things are just so much easier and cooler when you have the same way myself
  • 29:39 - 29:41
    we go back over to a close
  • 29:41 - 29:44
    we're coming down with names are for an office manifesto
  • 29:44 - 29:48
    here's a program that's written in standard java rights at hello world on
  • 29:48 - 29:50
    the screen
  • 29:50 - 29:53
    this is something you could down in the first class by saying public last hello
  • 29:53 - 29:56
    world extends console program imprint lane
  • 29:56 - 29:59
    hello world out to the screen and you would have gotten it in the consul
  • 29:59 - 30:03
    so what's different here what's different here is we have public last
  • 30:03 - 30:04
    hello world
  • 30:04 - 30:07
    and it doesn't extend anything it doesn't extend program doesn't extend
  • 30:07 - 30:08
    concord program
  • 30:08 - 30:13
    there's no imports for the a c l_ libraries we're not using any defense
  • 30:13 - 30:17
    so we don't have a console program we don't have a nice little consul
  • 30:17 - 30:20
    but we white stuff out to this displays a nice little window
  • 30:20 - 30:24
    while we do have a something called the system output consul and if we want to
  • 30:24 - 30:28
    put stuff on back it looks real seller to what you had before we'd use print
  • 30:28 - 30:32
    land which is why we made the method that you use call prints match theirs
  • 30:32 - 30:37
    but weeks a systemic dot out dot println text one print out
  • 30:37 - 30:40
    again here i have a meaner it might mean that they can have whatever i want and
  • 30:40 - 30:42
    that's just for execution starts
  • 30:42 - 30:43
    so if i compiled list
  • 30:43 - 30:45
    and running
  • 30:45 - 30:47
    let me just compile and run to show you why
  • 30:47 - 30:51
    hello world in kind of this world is not all that cool
  • 30:51 - 30:53
    careful our world
  • 30:53 - 30:54
    it just ran
  • 30:54 - 30:59
    and they're like partner and i don't see anything
  • 30:59 - 31:02
    cuz you don't get a call we know that comes up is like a lower over here i am
  • 31:02 - 31:04
    on this window for a budget act
  • 31:04 - 31:06
    you have what's called the system console
  • 31:06 - 31:10
    the system console like you happen to be using a development in violent like a
  • 31:10 - 31:11
    klutz or something else
  • 31:11 - 31:14
    is basically just a window in that development environment that shows
  • 31:14 - 31:16
    messages that you print out
  • 31:16 - 31:19
    if you happen to be in the bad old days but i think i raised over here where you
  • 31:19 - 31:22
    have command-line text we actually type stuff in
  • 31:22 - 31:25
    because i would just be that same window where the text would appear where you
  • 31:25 - 31:26
    can't
  • 31:26 - 31:30
    so if you don't get it in a separate we know it is not all that will get a lot
  • 31:30 - 31:34
    of times would notify closed anyway so you don't see a
  • 31:34 - 31:38
    now if we want to pick up a notch it's a token on yahoo so wide use the consul
  • 31:38 - 31:42
    one i do something graphical so here's graphical hello world
  • 31:42 - 31:44
    and so what we want to do is
  • 31:44 - 31:45
    we want to create a window
  • 31:45 - 31:49
    a new window that is going to have some title associated with it and we're going
  • 31:49 - 31:52
    to put the text hello world in that window
  • 31:52 - 31:55
    why we need to do what we get worse to excuse respectively
  • 31:55 - 31:58
    we need to create something called a j three in which you never have to worry
  • 31:58 - 31:59
    about before
  • 31:59 - 32:02
    what they gave frame it's actually a frame that's going to pull the window
  • 32:02 - 32:05
    so it's actually one week run we're going to start running rapidshare
  • 32:05 - 32:09
    it's going to create a little window force that we can display stuffing
  • 32:09 - 32:10
    well we're going to put in that window
  • 32:10 - 32:13
    we're going to put a label j labeled you've seen before this is just like
  • 32:13 - 32:14
    you've seen before
  • 32:14 - 32:17
    we're going to create a j label that's called hello world
  • 32:17 - 32:20
    and we want this label to be centered justified as opposed to left just
  • 32:20 - 32:24
    fighter rightist five tiny stage a label dot center to center justified
  • 32:24 - 32:28
    if i don't give a destination it'll by default be left justified looked kind of
  • 32:28 - 32:29
    because one attacker
  • 32:29 - 32:32
    and then i grabbed this label to my frame
  • 32:32 - 32:36
    so similar to the idea cabinet can listen adding stuff to the candice's
  • 32:36 - 32:39
    exactly analogous right we want to make it just as easily when you saw standard
  • 32:39 - 32:39
    java
  • 32:39 - 32:41
    all the same concept applied
  • 32:41 - 32:45
    here were just adding the j label which as you know now is a g component in the
  • 32:45 - 32:47
    big java hierarchy
  • 32:47 - 32:50
    and j components can be added to ge frames
  • 32:50 - 32:52
    so we have a jail able to get at a twenty three
  • 32:52 - 32:56
    i set aside tragic frame which is five hundred by three hundred that tells me
  • 32:56 - 32:58
    how big the windows going to be when it starts
  • 32:58 - 33:01
    and then there's the other crafty stuff but i need to do that just you would
  • 33:01 - 33:02
    think alike
  • 33:02 - 33:05
    why do i need to do that right it's just doesn't make any sense
  • 33:05 - 33:09
    that i would not otherwise want to have it this way what you're going to do
  • 33:09 - 33:12
    if someone clicks close on the window a little x the top of the screen to close
  • 33:12 - 33:12
    the window
  • 33:12 - 33:14
    i need to say hey
  • 33:14 - 33:18
    if son click that then you need to close yourself otherwise the window by the way
  • 33:18 - 33:20
    the application keeps running
  • 33:20 - 33:23
    which seems odd but we need to have that they're pretty optician stop running
  • 33:23 - 33:24
    and then we think
  • 33:24 - 33:27
    window yeah i know i created un everything
  • 33:27 - 33:28
    you need to make yourself visible
  • 33:28 - 33:31
    otherwise no one will be able to see you
  • 33:31 - 33:35
    why when i pray that we know that i was i going to make a visible
  • 33:35 - 33:37
    that's how we use the a c l_ libraries
  • 33:37 - 33:40
    so we need to make sure that this guy visibility is true
  • 33:40 - 33:42
    and appear on this
  • 33:42 - 33:45
    you're a graphical hello so after all the squawk to write
  • 33:45 - 33:51
    yours graphical lovro
  • 33:51 - 33:55
    we do have one and all of that explain to you so that you could get hello world
  • 33:55 - 33:56
    bring your like
  • 33:56 - 34:00
    somewhere in the social now work in a corner need to worry about how the world
  • 34:00 - 34:01
    in the middle of my screen
  • 34:01 - 34:03
    that's cuz you have this new hybrid
  • 34:03 - 34:07
    so like okay let's let's keep it up even one more not shit you know i couple
  • 34:07 - 34:10
    right what are those now stopping interaction like that should be
  • 34:10 - 34:14
    something that maybe you know i get some benefit from having to stand for java so
  • 34:14 - 34:16
    out of interactive version of hello
  • 34:16 - 34:19
    through the interactive version of lalo na some of the stop should begin to get
  • 34:19 - 34:22
    a little bit more
  • 34:22 - 34:24
    repetitive in the sense that you have your main you have your j frame the
  • 34:24 - 34:27
    frame is called interactive flow that's the title of that window
  • 34:27 - 34:30
    what we're going to add to this day play with a new
  • 34:30 - 34:32
    class that we're going to create called a moving label
  • 34:32 - 34:35
    and i'll show you what a moving label doesn't just second but we need to set
  • 34:35 - 34:36
    aside the window
  • 34:36 - 34:40
    again set default close operation exit on clothes
  • 34:40 - 34:44
    and set visibility to true so baseball this does is create this window or
  • 34:44 - 34:45
    particular size
  • 34:45 - 34:48
    and if you add this thing called a moving label to it and moving label just
  • 34:48 - 34:51
    another class i create what's a movie label
  • 34:51 - 34:54
    a moving label is a j component
  • 34:54 - 34:57
    it needs to be a gay component because i want to add a tool for
  • 34:57 - 35:01
    and to display something to frame i what i can only display components knapp
  • 35:01 - 35:03
    brings this can extend component
  • 35:03 - 35:05
    and it's going to implement our friend of mouse listener
  • 35:05 - 35:08
    because it's going to listen for the past year what all i remember mouths
  • 35:08 - 35:11
    listener that's why like the mouse got click and drag at all that stuff sans
  • 35:11 - 35:12
    act the same
  • 35:12 - 35:16
    so i have my construct ojai constructor had to have some starting texas label
  • 35:16 - 35:19
    and starting x and y location
  • 35:19 - 35:21
    thatcher what kind of familiar to you
  • 35:21 - 35:24
    anti based i guess tore off the tax expert yet to like
  • 35:24 - 35:26
    and this guy wants the lesson from out of that
  • 35:26 - 35:30
    so ted adam else listeners and it needs to say
  • 35:30 - 35:31
    if you get some out of that
  • 35:31 - 35:35
    send them to me to send them debits switches
  • 35:35 - 35:38
    so this a little bit different than what you've written in your programs before
  • 35:38 - 35:41
    where you just said you know adam alice was knowing you didn't you just had an
  • 35:41 - 35:46
    open print close pronounced 'cause we kind of poop
  • 35:46 - 35:49
    naturally by things get a little bit funky
  • 35:49 - 35:53
    the difference between this and thinking about having some sort of label that you
  • 35:53 - 35:56
    just display on the campus right some taxes just put up on your canvas and it
  • 35:56 - 35:58
    just sits there and it's fun
  • 35:58 - 36:02
    is that this guy i know i have to worry about what's known as painting itself
  • 36:02 - 36:05
    which means it needs to draw itself on the screen your like but when i have
  • 36:05 - 36:08
    labeled before they just knew how to draw themselves
  • 36:08 - 36:11
    yeah that's because we gave you a label does a little bit smarter knew that it
  • 36:11 - 36:12
    was a label that should rockville
  • 36:12 - 36:16
    this guy needs to be told you're going to draw yourself
  • 36:16 - 36:19
    though that they call paying component that gets called whenever this guy
  • 36:19 - 36:22
    should get displayed on the screen or some other thread that's going to call
  • 36:22 - 36:23
    the for you automatically
  • 36:23 - 36:26
    and it says here is the graphics
  • 36:26 - 36:27
    context in which a dryer self
  • 36:27 - 36:30
    safely within our graphics contact somebody draw some strength
  • 36:30 - 36:33
    and that's a method name everything is not important here i just showed you
  • 36:33 - 36:36
    those extra craft you need to worry about right which is why we didn't want
  • 36:36 - 36:38
    to do all the stuff began
  • 36:38 - 36:42
    now this booking steamy or whatever the mountains clicked i get the new acts
  • 36:42 - 36:43
    wire location
  • 36:43 - 36:44
    and i repeat
  • 36:44 - 36:47
    what is repaint meaning to redraw yourself
  • 36:47 - 36:52
    and i'm going to redraw myself at this new xy location because when i call
  • 36:52 - 36:53
    repaint
  • 36:53 - 36:56
    someone comes along and says hey to repaint this area
  • 36:56 - 36:59
    i'm going to call dual pane component method so you can read paint yourself
  • 36:59 - 37:00
    you like
  • 37:00 - 37:04
    well this is really we are now in like almost we're here i get a mouse click
  • 37:04 - 37:08
    and i know that i want to drop my sri drama itself but rather than telling
  • 37:08 - 37:09
    myself directly to redraw myself
  • 37:09 - 37:13
    i don't tell the system paid i'll need to get repainted in the systems as
  • 37:13 - 37:14
    possible
  • 37:14 - 37:15
    uh... as the sort of like
  • 37:15 - 37:20
    you know that java high allison arafat happiness are pointed you want to know
  • 37:20 - 37:23
    like you need tear
  • 37:23 - 37:25
    someday if you act like they were anti-war
  • 37:25 - 37:26
    we won't get in
  • 37:26 - 37:29
    units i can breed on partner
  • 37:29 - 37:30
    other hot
  • 37:30 - 37:33
    you know i think i need to repay my topic how to fix that those are ok you
  • 37:33 - 37:37
    need repairs are four one i'm ready for you to repeat yourself
  • 37:37 - 37:39
    all call your pain components method
  • 37:39 - 37:42
    until then no no you don't repeat itself
  • 37:42 - 37:45
    and saturday that's other stuff in the system to worry about all yall in there
  • 37:45 - 37:46
    with you you have to get repainted
  • 37:46 - 37:49
    okay now call your pain component you come a long thick
  • 37:49 - 37:52
    all cable nominee promised off the new act violently
  • 37:52 - 37:55
    so kinda convoluted the whole notion of like
  • 37:55 - 37:59
    you're doing something here and you're asking someone else to do something for
  • 37:59 - 38:03
    you and i'm going to call you back to do what you were julian sands
  • 38:03 - 38:07
    now makes a little bit more sounds after we talked about directed at you've seen
  • 38:07 - 38:09
    all the stuff
  • 38:09 - 38:11
    thurday class not so hot
  • 38:11 - 38:14
    so if we were on this
  • 38:14 - 38:17
    this is called up interactive hello
  • 38:17 - 38:20
    base but where does it just brings up the article that sixty s by six a rocks
  • 38:20 - 38:23
    in the middle of the straight and not everytime i click them
  • 38:23 - 38:26
    mouse button right because this is the mouth with the bank over here
  • 38:26 - 38:28
    everytime i click the mouse button
  • 38:28 - 38:32
    the x_ y_ location of the mouse becomes the new base point
  • 38:32 - 38:33
    for the tax they get stronger
  • 38:33 - 38:37
    and so i just moved to rounds
  • 38:37 - 38:40
    any questions about that
  • 38:40 - 38:41
    so there's a standard java
  • 38:41 - 38:45
    you've seen all the concepts in the a c we using the atm_ i've read the
  • 38:45 - 38:48
    concepts rather saying the notion of adding things and i should have about
  • 38:48 - 38:51
    seles has not affect the whole mouth listeners concept we just took the
  • 38:51 - 38:56
    standard job ideas and use them sort of in conjunction with used him libraries
  • 38:56 - 38:58
    but there's a lot of things in the a scam i break it just made it so much
  • 38:58 - 39:02
    easier to like for example b graphics contest entries or to write a social
  • 39:02 - 39:05
    network for whatever and say you're welcome to continue using the atm_
  • 39:05 - 39:07
    library dot
  • 39:07 - 39:10
    but some people are wondering wide will use these libraries and this is the
  • 39:10 - 39:14
    reason why there's just a whole lot of propped you'd have to worry about
  • 39:14 - 39:20
    i'm question
  • 39:20 - 39:24
    you'd be use in like you know your favorite word processor like notepad
  • 39:24 - 39:28
    and there's actually some places which i won't you know name but that there is
  • 39:28 - 39:31
    it's actually reasonable that you know that some schools and your first
  • 39:31 - 39:34
    programming class what you do is they say while you need to have like no
  • 39:34 - 39:36
    pattern you need to have some text editor
  • 39:36 - 39:39
    and then we're gonna do command-line stuff you're gonna type in like name
  • 39:39 - 39:43
    surfer names dash data dot textron your program and then everything's gonna be
  • 39:43 - 39:44
    taxed
  • 39:44 - 39:48
    so one thing i want to leave you with now in our final few moments together
  • 39:48 - 39:51
    sort of a notion we were starting to meet next week talk about life after the
  • 39:51 - 39:54
    five had to give you notion that if you want to go on in terms of learning more
  • 39:54 - 39:57
    about java specially standard java
  • 39:57 - 40:01
    we said i just started things off by giving you you know this book which
  • 40:01 - 40:04
    talks all about the cm libraries and this i think is a great book to actually
  • 40:04 - 40:06
    learn everything with a new vcm libraries
  • 40:06 - 40:12
    but if you want to go on worth of other resources you can use
  • 40:12 - 40:16
    that's not pretty if you don't like the java section of any bookstore just would
  • 40:16 - 40:20
    be practiced a while one but i would recommend not that i get my kickbacks
  • 40:20 - 40:23
    restart called learning job a it's actually pretty good time some of the
  • 40:23 - 40:27
    examples just off your actually based on this book it's a little bit
  • 40:27 - 40:30
    that's why we don't use the text book in this class if in fact and we get up did
  • 40:30 - 40:32
    we break two thousand page mark
  • 40:32 - 40:36
    all right so close it so close with the index
  • 40:36 - 40:41
    now in nineteen
  • 40:41 - 40:44
    that some other books that actually the original specification of the java
  • 40:44 - 40:47
    programming language the same older version of the book is this is one that
  • 40:47 - 40:49
    was like a week candidate if you are not the old version
  • 40:49 - 40:52
    i forget which version of acting out a second edition i think now there are
  • 40:52 - 40:54
    like three or four some impact
  • 40:54 - 40:55
    looks a little bit bigger birds actually
  • 40:55 - 40:59
    four books it specifies the language job it's actually very well written as a
  • 40:59 - 41:02
    reference inside of recommend this as well
  • 41:02 - 41:05
    if you're going to like all i want it all
  • 41:05 - 41:06
    the big job
  • 41:06 - 41:07
    is vague
  • 41:07 - 41:11
    i think it might actually crossed the thousand page all yachts like thousand
  • 41:11 - 41:14
    the spirits like twelve hundred
  • 41:14 - 41:17
    and if you really want to get a hard time like but now i'm all about web
  • 41:17 - 41:19
    based java
  • 41:19 - 41:23
    java server programming like everything or do i like a lot of things you don't
  • 41:23 - 41:26
    want to know if whatever they want to know one more
  • 41:26 - 41:28
    and that's just a small set
  • 41:28 - 41:31
    right so they're just a few bucks i'd recommend if you want to go on beyond
  • 41:31 - 41:32
    this class
  • 41:32 - 41:35
    but you can go into any bookstore news get inundated with a ton of stuff but
  • 41:35 - 41:39
    now you have a context for kind of putting all the pieces together because
  • 41:39 - 41:41
    you've seen all the other things that you actually need to know to be able to
  • 41:41 - 41:46
    work with the huge set of tools that job actually
  • 41:46 - 41:49
    so any questions about any of our staff
  • 41:49 - 41:50
    you're going to go
  • 41:50 - 41:53
    alright power to a couple minutes early cuz most the time i like to go a couple
  • 41:53 - 41:55
    minutes late
  • 41:55 - 41:55
    have a good weekend
Title:
Lecture 26 | Programming Methodology (Stanford)
Description:

Lecture by Professor Mehran Sahami for the Stanford Computer Science Department (CS106A). Professor Sahami lectures non-standard Java and shows the class a few books he recommends for further readings on Java.

CS106A is an Introduction to the engineering of computer applications emphasizing modern software engineering principles: object-oriented design, decomposition, encapsulation, abstraction, and testing. Uses the Java programming language. Emphasis is on good programming style and the built-in facilities of the Java language.

Complete Playlist for the Course:
http://www.youtube.com/view_play_list?p=84A56BC7F4A1F852

CS106A at Stanford Unversity:
http://www.stanford.edu/class/cs106a/

Stanford Center for Professional Development:
http://scpd.stanford.edu/

Stanford University:
http://www.stanford.edu

Stanford University Channel on YouTube:
http://www.youtube.com/stanford

more » « less
Video Language:
English
Duration:
42:11
Eunjeong_Kim added a translation

English subtitles

Revisions