Chat Transript - June 1, 1997
[Don] joins at Sun Jun 01 19:52:59 1997 from 206.173.45.52
[David] joins at Sun Jun 01 19:56:54 1997 from 151.198.127.17
David=> hello |
[wachsmut] joins at Sun Jun 01 19:57:28 1997 from 153.35.6.46
wachsmut=> Hi - I am late, almost -:) | |
Don=> no problem | |
wachsmut=> Hi guys .... | |
David=> hello | |
Don=> Dr. w. remember the NBA finals are on right now | |
wachsmut=> let's wait a couple more minutes, see if anyone else joins, | |
wachsmut=> actually, the TV is in the background ! | |
wachsmut=> sound only | |
wachsmut=> that's the beauty of virtual classes .... |
[Rob] joins at Sun Jun 01 19:59:38 1997 from 128.122.175.22
wachsmut=> hi rob ! | |
Rob=> Hi, I'm in. | |
Rob=> hi | |
wachsmut=> Great .... let's wait 2 more minutes, then | |
wachsmut=> I'll announce the gameplan for today | |
David=> I had a problem with PFE? | |
wachsmut=> yes ? | |
wachsmut=> what was the problem, david ? | |
David=> error: Can't start pfe0532 helper module..it did work for me once! | |
wachsmut=> hmmmmm ..... | |
wachsmut=> there's a new version of PFE ... versin 7.00?? | |
wachsmut=> I'll change the link on my page, maybe reinstalling will help. | |
David=> I'm sorry..after f11 and enter | |
wachsmut=> Alright ... looks like attendence is kind of low today, | |
wachsmut=> perhaps competing with the NBA finals was not a good idea ! | |
Don=> | |
Don=> you can say that again!!! | |
wachsmut=> Anyway, let's start in any case (sorry -:) |
[Jenn] joins at Sun Jun 01 20:03:15 1997 from 199.174.180.155
wachsmut=> Alright, here's what I have planned for today | |
wachsmut=> (hi Jenny) | |
Jenn=> HI! | |
wachsmut=> First, I ask some questions ... | |
wachsmut=> then you get to ask questions ... | |
wachsmut=> then some new stuff | |
wachsmut=> then - if there's still time - some general comments..... | |
wachsmut=> Alright, here are my questions. | |
wachsmut=> Anybody who wants to answer, go right ahead ..... | |
wachsmut=> what three steps are needed to declare an array ? | |
Don=> the type the name and the size | |
Jenn=> you need to define it | |
wachsmut=> type and name goes together .... | |
wachsmut=> size, yes, and then to populate the array ... | |
wachsmut=> alright, what's the new return type for a method (other than double etc) | |
wachsmut=> nothing (pun intended) ? | |
wachsmut=> well ???? | |
Don=> is it void?? | |
wachsmut=> yes | |
wachsmut=> thanks ! | |
wachsmut=> means: nothing to return, basically. | |
wachsmut=> Alright, if a method does NOT use void as return type, then | |
wachsmut=> what is a word that must show up in the method body? | |
Don=> return | |
wachsmut=> great ! | |
wachsmut=> alright, moving on.... | |
wachsmut=> what two different categories make up a class ? | |
Jenn=> data fields and methods | |
wachsmut=> great ! | |
wachsmut=> what's the difference between a class and an object ? | |
David=> a class can be made up of many objects | |
wachsmut=> like when building a house ..... |
[aisha] joins at Sun Jun 01 20:09:12 1997 from 149.150.180.135
wachsmut=> sorry ... | |
Don=> the class is the idea and the object is the workins of that idea | |
Rob=> an object is an instance of a class | |
wachsmut=> yes, that's a good way of phrasing it, Don. | |
wachsmut=> Class is an abstract description, | |
wachsmut=> an object is a 'real' existing entity, modeled after the | |
wachsmut=> blueprint of a class. | |
wachsmut=> Often, the distinction is blured .... | |
wachsmut=> couple more: how do you instantiate an object ? | |
Don=> by making it a field in another object | |
wachsmut=> (hi aisha) | |
aisha=> hi | |
wachsmut=> yes, and by using what special keyword ? | |
Don=> new | |
wachsmut=> thanks ! | |
wachsmut=> three more: what's a constructor ? | |
aisha=> | |
Don=> a method that gets done automatically | |
wachsmut=> exactly when ? | |
aisha=> | |
Don=> when the object is instatiated | |
wachsmut=> yes ... right on the money, as usual ! | |
wachsmut=> What's the name of a constructor .... ? | |
Don=> the same as the class | |
wachsmut=> yes .... last one (maybe somebody else ?) | |
wachsmut=> How many constructors does the String class have ? | |
wachsmut=> well ? | |
wachsmut=> they are in the notes, named: String(???) - how many ? | |
Rob=> two | |
David=> 3 | |
wachsmut=> well, both are right.... | |
Rob=> do i hear four? | |
wachsmut=> I mentioned two in the notes, but there actually are more... | |
Don=> 16 | |
wachsmut=> ha ha ... too many ! | |
wachsmut=> more on that stuff a little later .... | |
wachsmut=> Now, do you have any questions ? | |
wachsmut=> other than: who's winning, bulls or what's their name ? | |
Rob=> Maybe, just a bureaucratic one... | |
wachsmut=> go ahead ... | |
aisha=> is anyone there? i am not getting any dialog on my screen. | |
Rob=> The assignments in the latter two lecture two notes... on classes, etc. | |
Rob=> and strings.. | |
wachsmut=> yes ? | |
Rob=> Are those due today... that is, are we "up to" this material. | |
wachsmut=> ah ... great question. | |
wachsmut=> Alright, here's the deal: | |
wachsmut=> the 'assignments' *should* be completed to stay | |
wachsmut=> current with the 'flow' of the lecture | |
wachsmut=> and not to run out of time at the end of class. | |
wachsmut=> But, what I will grade at the end is | |
wachsmut=> the four portfolio pieces, the two non-programming | |
wachsmut=> pieces (to be explained Wed), and - for three credits - | |
wachsmut=> the 'larger' project at the end. | |
wachsmut=> BUT - if you don't do the assignments pretty close | |
wachsmut=> to when they are assigned, you won't have | |
wachsmut=> much of a chance to have a decent | |
wachsmut=> portfolio ...... | |
Rob=> ok... | |
wachsmut=> in my opinion. |
[aisha] leaves at Sun Jun 01 20:18:51 1997
wachsmut=> On Wed, we also will | |
wachsmut=> discuss how you think the class is going right now | |
wachsmut=> and whether we should continue this way. | |
wachsmut=> Any changes (more chat, less chat, more assignments, | |
wachsmut=> less assignments, actual grading of assignments etc) is | |
wachsmut=> possible, anything goes. | |
wachsmut=> Oh, I forgot .... | |
wachsmut=> every assignment you do put on Sciris, | |
wachsmut=> I will 'correct' if you want me to. |
[aisha] joins at Sun Jun 01 20:20:09 1997 from 149.150.180.135
wachsmut=> I look at your homepages (all have one by now) | |
wachsmut=> and I check the links. If I see an assignment, I'll take a look | |
wachsmut=> at it, check it out, and I'll send comments .... | |
wachsmut=> starting tonight / tomorrow. | |
wachsmut=> If there are no assignments, well, good for me, and | |
wachsmut=> you have to do the 4 pieces anyway .... | |
wachsmut=> so .... | |
wachsmut=> What else ? | |
wachsmut=> Nothing ? | |
Don=> pretty clear so far | |
wachsmut=> Great .... let's get more difficult, then .... | |
wachsmut=> Here's some new stuff: | |
David=> is this the last chat before Wensday? | |
wachsmut=> the class String has two constructors, i.e. | |
wachsmut=> two methods with the same name. That is actually something | |
wachsmut=> very common, and it is called "overloading". | |
wachsmut=> Overlaoding means to have *one* method name, but define it | |
wachsmut=> more than once, with a *different* set of input parameters. | |
wachsmut=> Every method, constructor or otherwise, can be overloaded. | |
wachsmut=> As an example, recall the 'Rectaqngle' class: | |
wachsmut=> class Rectangle | |
wachsmut=> { | |
wachsmut=> Rectangle() // constructor | |
wachsmut=> void setDimenions(double _width, double _height); | |
wachsmut=> void computeArea(); | |
wachsmut=> void computePerimeter(); | |
wachsmut=> void display(); | |
wachsmut=> } | |
wachsmut=> | |
wachsmut=> what would be a good second constructor to add to this class ? | |
wachsmut=> In other words, if you need a Rectangle, what do you really | |
wachsmut=> need to specify, often ? | |
wachsmut=> Well, you either create a rectangle of kind of undetermined | |
wachsmut=> dimenions, or you already know the width and height of the | |
wachsmut=> rectangle you need, and you therefore create that right away. | |
wachsmut=> What I mean is to add a second constructor to the | |
wachsmut=> Rectangle class that takes as input ? | |
wachsmut=> Well ? Anyone ? | |
wachsmut=> Hmmmm .... is this too tricky ? | |
wachsmut=> Is anyone still listening (please, all say 'aye') | |
Rob=> Still here. | |
Don=> aye | |
Jenn=> yes | |
wachsmut=> thanks .. | |
David=> input parms | |
wachsmut=> okay, let me ask again. | |
aisha=> i'm here(finally) | |
wachsmut=> If you were to ask me to give you a Rectangle, what | |
wachsmut=> exactly would you tell me ? | |
Don=> wht is the height and width | |
wachsmut=> Say I am a carpenter, speciallizing in creating REctangles. | |
wachsmut=> Yes, thanks. | |
aisha=> | |
wachsmut=> So, we add a constructor like this to the Rectangle class: | |
wachsmut=> Rectangle(double _width, double _height) | |
wachsmut=> { | |
wachsmut=> name = "Rectangle"; | |
wachsmut=> width = _width; | |
wachsmut=> height = _height; | |
wachsmut=> } | |
wachsmut=> Then I can say, in the 'ShapeTest' class: | |
wachsmut=> either: | |
wachsmut=> Rectangle r = new Rectangle(); | |
wachsmut=> or | |
wachsmut=> Rectangle r = new Rectangle(2, 4); | |
wachsmut=> The Java compiler will look at the input parameters, | |
wachsmut=> and automatically pick the correct constructor. | |
wachsmut=> Pretty cool ! | |
wachsmut=> So, as your first 'next' assignment: | |
wachsmut=> Enhance the Rectangle *and Circle* class with an additional | |
wachsmut=> constructor each. Also, change the 'ShapeTest' class accordingly. | |
wachsmut=> And, make sure that none of the old functionality of the class | |
wachsmut=> disappears, i.e. do not take away the old constructors. | |
wachsmut=> Do you know what I mean ? |
[aisha] leaves at Sun Jun 01 20:32:20 1997
Don=> so you can either enter them | |
Don=> or ask for them |
[aisha] joins at Sun Jun 01 20:32:35 1997 from 149.150.180.135
wachsmut=> eactly ! | |
wachsmut=> Exactly ! | |
wachsmut=> Remember, the goal is to make a class as flexible as possible. | |
wachsmut=> Maybe you need a Rectangle, but don't know the dimenions: | |
wachsmut=> use Rectangle r = new Rectangle() | |
wachsmut=> then, when you know the dimensions later, use: | |
wachsmut=> | |
wachsmut=> | |
wachsmut=> r.setDimenions(2, 3); | |
wachsmut=> Or, if you know the dimenions right away, use: | |
wachsmut=> Rectangle r = new Rectangle(2, 3); | |
wachsmut=> our class accomodates both users ! | |
wachsmut=> *Every* method can get overloaded ! | |
wachsmut=> In fact, you already know at least two such methods that | |
wachsmut=> are overloaded: | |
wachsmut=> Strings() - because I listed two constructors ! | |
wachsmut=> And | |
wachsmut=> System.out.println() | |
wachsmut=> because that works for integers, double, strings, anything .... so | |
wachsmut=> it's overloaded a lot, and *very* convenient for us to use ! | |
wachsmut=> Instead of saying : String.out.printlnInteger(10); and | |
wachsmut=> String.out.printlnDouble(2.0); | |
wachsmut=> we simply say: System.out.println(whatever) and let the compiler | |
wachsmut=> pick the right method for us ! | |
wachsmut=> Now better ? | |
wachsmut=> I maan: can you do it now, for the Rectangle and the Circle class ? | |
Don=> does that mean it will check to see if there | |
Don=> ARE values , and if not do the getvalue section? | |
wachsmut=> well, I am not sure what you mean with 'getvalue' section, but | |
wachsmut=> take a look at another example, quickly. | |
wachsmut=> Say I have a class that contains a 'String' field, an integer field, | |
wachsmut=> and a double field. | |
Don=> the part that we must add to get the values if not supplied by the program | |
wachsmut=> I also need a method 'doubleIt' for each field, that simply doubles the | |
wachsmut=> corresponding field. I could do this: | |
wachsmut=> void doubleItString(String newString) | |
wachsmut=> void doubleItInteger(integer x) | |
wachsmut=> void doubleItDouble(double z) | |
wachsmut=> and the corresponding fields would become twice the input. | |
wachsmut=> That means to the user of the class, they will have to | |
wachsmut=> remember those three names ... inconvenient. | |
wachsmut=> Instead, I declare one method three times : | |
wachsmut=> doubleIt(String s); | |
wachsmut=> doubleIt(integer x) | |
wachsmut=> doubleIt(double z) | |
wachsmut=> | |
wachsmut=> and then, the user simply says: 'doubleIt(10)', and the compile | |
wachsmut=> will pick the method for integers, or 'doubleIt("Bert")', and | |
wachsmut=> the compiler will pick the method for Strings ..... | |
wachsmut=> That's good for the user of the class ! | |
wachsmut=> As the designer, I still need to write three seperate methods, they | |
wachsmut=> simply have all the same method name, but different input | |
wachsmut=> parameters. | |
wachsmut=> long answer .... hope it helps. | |
wachsmut=> Oh, and no input parameter is also possible, and different from | |
wachsmut=> one integer parameter, or two double ones, and so on. | |
wachsmut=> Overloading is one of the 'staples' of OOP (object oriented programming) | |
wachsmut=> All with me ? | |
wachsmut=> (you can say 'no' if you like !) | |
wachsmut=> or yes ... | |
wachsmut=> or 'well, maybe, but ...' | |
Rob=> yes... | |
Jenn=> i think so.... | |
David=> I will be | |
Don=> kind of shaky but will have to look at he print after we're done again | |
wachsmut=> Good. But, I hope you can see the 'good' of this concept, | |
Rob=> We don't really discuss overloading in the BMIS C/C++ course, but | |
wachsmut=> even if it might look surprising initially ! | |
Rob=> for those of you who took either one of those courses, it's in the text | |
Rob=> and it's the same idea. | |
wachsmut=> And, in this lecture, as of tonight ! | |
wachsmut=> I'll post extensive notes after the chat session. | |
wachsmut=> One more - perhaps even more puzzling thing: | |
wachsmut=> If you look at the Rectangle and the Circle class together, | |
wachsmut=> you - as good programmers - should be annoyed by something: | |
wachsmut=> repetition ! | |
wachsmut=> No good programmer likes to 'write things twice', | |
wachsmut=> they rather do some kind of construction that | |
wachsmut=> executes twice, or something, but without typing it twice. | |
wachsmut=> In fact, *any* time you use 'cut-and-paste' when writing a program, | |
wachsmut=> there should be a better way to do it ! | |
wachsmut=> So: | |
wachsmut=> is there a better way to do it with our Rectangle and Circle class ? | |
wachsmut=> Yes - and it's called 'inheritance' ! | |
wachsmut=> Both Rectangle and Circle have in common that they both | |
wachsmut=> define a 'name', an 'area', and a 'perimeter' field, and they both have | |
wachsmut=> exactly the same 'display' method ! | |
wachsmut=> That's a waste of typing, and should be avoided, | |
wachsmut=> and I will tell you how .... | |
wachsmut=> in the posted lecture ! | |
wachsmut=> (after all, it's getting close to the end). | |
wachsmut=> Again, there will be a bunch of assignments in the lecture | |
wachsmut=> notes. PLEASE (!) do them before we meet on Wed !!!!!!! | |
wachsmut=> which leads me to my concluding remarks: | |
wachsmut=> We'll meet for real on Wed, 5:30, Fahy Hall 252. Please think | |
wachsmut=> about they way this course is working out: | |
wachsmut=> can we go on like this for another four weeks, or should | |
wachsmut=> we change anything ? | |
wachsmut=> Let me know what you think, and I'll ajust.... | |
wachsmut=> in case you were wondering what I was planning: | |
wachsmut=> week 1: Intro to OOP (over on Wed.) | |
wachsmut=> week 2: applets, layout managers, awt, gui, graphics | |
wachsmut=> awt = abstract windows toolkit, | |
wachsmut=> gui = graphical user interface (buttons and such) | |
wachsmut=> week 3: thread of execution, exception handling | |
wachsmut=> week 4: network programming, client/server programming, etc | |
wachsmut=> week 5: SQL databases, if there's time for it. | |
wachsmut=> Class over: June 30th (we can keep on going longer, | |
wachsmut=> if that's what the 'group' wants to do). | |
wachsmut=> Alright .... I am gettin cramps ... anyone wants to add anything ? | |
wachsmut=> hmmm .... | |
wachsmut=> pretty quite bunch out there ..... | |
wachsmut=> I wish I could see what you're really doing -:) | |
Rob=> I have a hunch that people haven't quite digested the material so far, | |
wachsmut=> we shall try 'video conferencing' next week ! | |
Rob=> as of yet. | |
Don=> that's true | |
wachsmut=> oh, I see .... | |
Don=> i'm sure there will be questions | |
Don=> after I sit down and re-read this chat | |
wachsmut=> I see ... too much, too fast ? | |
Don=> no, it just is hard to take it all in woithout any real exapmles to sit next to | |
wachsmut=> yes .... | |
wachsmut=> but I looked at last time's chat, and I did not see | |
Don=> comparing your notes to the examples is the way i find it easy to learn | |
wachsmut=> that everybody was able to complete the examples, so | |
wachsmut=> I thought this time we'll do without 'real time' examples using | |
wachsmut=> telnet..... | |
wachsmut=> Alright ..... | |
wachsmut=> It's just about time to quit, I guess ..... | |
wachsmut=> David, Jenn, Aisha, are you sort of coming along ? | |
David=> yes, but I need to invest more time.. | |
Jenn=> yeah... i just need to look at examples to help me understand whats going on | |
aisha=> sort of. i have a lot of catching up to do. | |
wachsmut=> Alright, then. Why don't we call it quits, for now, then. | |
wachsmut=> I will post the lecture notes (and a lot of it) in about one hour from now |
[aisha] leaves at Sun Jun 01 20:58:46 1997
wachsmut=> i.e. at about 10pm (there's just a few more things to fix). |
[aisha] joins at Sun Jun 01 20:58:52 1997 from 149.150.180.135
wachsmut=> It will cover, in details, overloading, inheritance, and our last new | |
wachsmut=> concept called 'polymorphism' (which we will not need much, so | |
wachsmut=> you can kind of skip it for now). | |
wachsmut=> | |
wachsmut=> I'll be handing around for another couple of minutes, but 'class' | |
wachsmut=> is officially over, then. | |
Don=> Rob and Dr w. | |
wachsmut=> Thanks for 'coming', hope it was - a little bit - worthwhile, | |
wachsmut=> and I see you and Wed ! | |
wachsmut=> Yes? | |
Don=> seeing as how you helped me with my post about running | |
Don=> from home, just wanted to let you know how i fixed it. | |
Rob=> ok | |
wachsmut=> yes ? | |
Don=> I had the programs in a different dir form the jdk and that was | |
Don=> givibg me problems | |
Rob=> hmmm... | |
wachsmut=> hmmm ... | |
Don=> i moved the .java files to the same dir as the jdc and it workrd fine | |
Don=> thanks for your help> | |
Rob=> You don't mean that you put the pfe in the same dir as java | |
Rob=> Oh, i see, you put your progam files in the same dir as the jdk files... | |
wachsmut=> Actually, everything is supposed to work regardless of where your | |
Rob=> I don't see why you need to. | |
Rob=> right | |
wachsmut=> programs, or the JDK, or the PFE is .... but | |
Don=> yes thathats what i thought | |
wachsmut=> if that fixed your problem, than that's okay, whatever works, works. | |
Don=> i typed java c:\javapr\test1.java and i had problems | |
wachsmut=> AHA ! | |
Don=> but when i moved test.java into c:\java\bin it worked fine | |
wachsmut=> Yes, you are right ! | |
wachsmut=> First, switch to the directory where the class files are... | |
wachsmut=> then 'java filename'. | |
wachsmut=> You can't execute classes in different directories from the current one, | |
wachsmut=> unless | |
wachsmut=> these directory are known to the JDK. | |
Don=> OK | |
wachsmut=> Known directories to the JDK are: | |
wachsmut=> - the directory of the binaries | |
wachsmut=> - the current one | |
wachsmut=> - all those mentioned in a env. variable 'CLASSPATH'... | |
wachsmut=> we can go into details on a discussion post, if you want..... | |
Don=> ok thanks |
Don=> bye |
[Don] leaves at Sun Jun 01 21:05:16 1997
wachsmut=> It's 9:05, you are free to rejoin the bulls game ! | |
wachsmut=> if you like, | |
wachsmut=> or to ask me more questions ! | |
David=> Bye | |
wachsmut=> byew | |
Jenn=> good night |
[Jenn] leaves at Sun Jun 01 21:05:50 1997
Rob=> bye... see you wednesday. |
[Rob] leaves at Sun Jun 01 21:06:02 1997
[David] leaves at Sun Jun 01 21:06:06 1997
wachsmut=> perhaps not ..... | |
wachsmut=> Alright, I got to leave ..... | |
wachsmut=> |
[wachsmut] leaves at Sun Jun 01 21:06:58 1997
[Don] joins at Sun Jun 01 21:07:32 1997 from 206.173.45.52
[Don] leaves at Sun Jun 01 21:07:41 1997
[aisha] leaves at Sun Jun 01 21:07:48 1997