**Pastebin code is listed below**
[2009/02/12 13:15] Snowdrop Short: ok .. I think we should start now
[2009/02/12 13:15] Snowdrop Short: how have you all done
[2009/02/12 13:15] Snowdrop Short: have you had time to look at some
of the code we talked about last?
[2009/02/12 13:15] Tinsel Silvera: yes
[2009/02/12 13:15] Adelle Fitzgerald: yes :)
[2009/02/12 13:15] Tinsel Silvera: I was able to get all the Thursday
codes to work
[2009/02/12 13:15] Christy Lock: yes
[2009/02/12 13:16] Adelle Fitzgerald: im starting to get a better
understanding of object orientated programming now too
[2009/02/12 13:16] Snowdrop Short smiles
[2009/02/12 13:16] Snowdrop Short: last tuesday, we talked about
classes and objects
[2009/02/12 13:16] Snowdrop Short: but for the thursday sessions, I'd
like to start more with the fundamentals
[2009/02/12 13:17] Adelle Fitzgerald nods
[2009/02/12 13:17] Christy Lock: kk
[2009/02/12 13:17] Adelle Fitzgerald: I'll take the chat log btw
[2009/02/12 13:17] Snowdrop Short: thank you Adelle
[2009/02/12 13:17] Tinsel Silvera: the tuesday code i hit a snag with
- will try again when i read the chat
[2009/02/12 13:18] Snowdrop Short: when we finished last, we looked
at a function for calculating factorials
[2009/02/12 13:18] Snowdrop Short: I'll quickly find it and put it on
pastebin
[2009/02/12 13:19] Snowdrop Short:
http://www.pastebin.ca/1335324
[2009/02/12 13:20] Adelle Fitzgerald: go it
[2009/02/12 13:20] Snowdrop Short: although this one is slightly
different
[2009/02/12 13:20] Adelle Fitzgerald: *giot
[2009/02/12 13:20] Adelle Fitzgerald: bleh
[2009/02/12 13:20] Christy Lock: yup me2
[2009/02/12 13:20] Snowdrop Short: in the other version, I had used
the datatype "int"
[2009/02/12 13:20] Snowdrop Short: and now I'm using "decimal"
[2009/02/12 13:21] M1sha Dallin: decimal?
[2009/02/12 13:21] M1sha Dallin: constrained range?
[2009/02/12 13:21] Snowdrop Short: yes, c# and .net has a number of
different inbuilt numeric types
[2009/02/12 13:21] Snowdrop Short: byte, short, int, long, float,
double and decimal
[2009/02/12 13:22] Simulator Version v0.5 shouts: OpenSimulator
Server 0.6.2.8309 (OS Microsoft Windows NT 5.2.3790 Service Pack 2)
ChilTasks:True PhysPrim:True
[2009/02/12 13:22] Snowdrop Short: the more memory they consume, the
better the precision
[2009/02/12 13:22] Snowdrop Short: decimals has the higest precision
of them all
[2009/02/12 13:22] Adelle Fitzgerald: are they in that oredr of
precision?
[2009/02/12 13:22] Snowdrop Short: yes
[2009/02/12 13:22] Adelle Fitzgerald: kk
[2009/02/12 13:23] M1sha Dallin: 16 bytes - just looked it up
[2009/02/12 13:23] Snowdrop Short: although precision is a bit
imprecise
[2009/02/12 13:23] Snowdrop Short: some are only integer values
[2009/02/12 13:23] Snowdrop Short: like byte, int, short, long
[2009/02/12 13:24] Snowdrop Short: float, double and decimal can have
fractions
[2009/02/12 13:24] Adelle Fitzgerald: so the first lot can only be
whole numbers?
[2009/02/12 13:24] M1sha Dallin: Is that a wise choice for a
factorial function?
[2009/02/12 13:24] Snowdrop Short: yes, only whole numbers
[2009/02/12 13:24] Snowdrop Short: decimal?
[2009/02/12 13:25] M1sha Dallin: yes
[2009/02/12 13:25] M1sha Dallin: is factorial 3.5 defined?
[2009/02/12 13:25] Snowdrop Short: no, factorial is our own function
[2009/02/12 13:25] M1sha Dallin: yep - so is a decimal a wise choice
for the parameter type?
[2009/02/12 13:25] Snowdrop Short: using decimal we can calculate a
higner factorial than using ints
[2009/02/12 13:26] Snowdrop Short: because it allows for higher
numbers
[2009/02/12 13:26] M1sha Dallin: ok
[2009/02/12 13:26] Snowdrop Short: if you were to take the factorial
of 50 in the old version
[2009/02/12 13:26] Snowdrop Short: you'd get an error
[2009/02/12 13:26] Snowdrop Short: actually I think you should try it
[2009/02/12 13:27] Christy Lock: yipe
[2009/02/12 13:27] Christy Lock: boom
[2009/02/12 13:27] Snowdrop Short: just for the fun of it :-)
[2009/02/12 13:27] Tinsel Silvera: definite boom
[2009/02/12 13:27] Jeff 1564: long -9223372036854775808 to
9223372036854775807
[2009/02/12 13:29] M1sha Dallin: I get an error at factorial 50 with
decimal as well
[2009/02/12 13:29] Starky Rubble: heh
[2009/02/12 13:30] Snowdrop Short: good thing I'm not keeping the log
[2009/02/12 13:30] Adelle Fitzgerald: hehe
[2009/02/12 13:30] Snowdrop Short: ok
[2009/02/12 13:30] Adelle Fitzgerald: factorial 50 just crash booms
[2009/02/12 13:30] Snowdrop Short: maybe 50 is too much
[2009/02/12 13:30] Snowdrop Short: 30 possibly
[2009/02/12 13:30] Adelle Fitzgerald: crash boom again
[2009/02/12 13:31] Snowdrop Short: 24 goes ok
[2009/02/12 13:31] Snowdrop Short: 26 too
[2009/02/12 13:31] Snowdrop Short: but you get the picuture
[2009/02/12 13:32] M1sha Dallin: 27! max with decimal
[2009/02/12 13:32] Snowdrop Short: I was trying to say that all
interger types exists in two variants
[2009/02/12 13:32] Snowdrop Short: signed and unsigned
[2009/02/12 13:32] Snowdrop Short: the unsigned ones can be twice as
big as the signed ones
[2009/02/12 13:33] Christy Lock: ah ok
[2009/02/12 13:33] Snowdrop Short: besides the decimal thing
[2009/02/12 13:33] Starky Rubble: got it
[2009/02/12 13:33] Snowdrop Short: do you notice anything else which
is different in the code?
[2009/02/12 13:33] M1sha Dallin: using v
[2009/02/12 13:33] Snowdrop Short: yes
[2009/02/12 13:33] M1sha Dallin: so you don't get the 3! = 120 error
[2009/02/12 13:34] Snowdrop Short: yes
[2009/02/12 13:34] Snowdrop Short: it is a technique used by
programmers to help reduce the number of mistakes they make
[2009/02/12 13:34] Snowdrop Short: it is called "DRY"
[2009/02/12 13:34] Snowdrop Short: "DO'NT REPEAT YOURSELF"
[2009/02/12 13:35] Snowdrop Short: this way I don't risk forgetting
to change one value and not the other
[2009/02/12 13:35] Adelle Fitzgerald: ohh thats cool
[2009/02/12 13:35] Snowdrop Short: so when every you find your self
repeating yourself in code
[2009/02/12 13:35] Snowdrop Short: think "DRY"
[2009/02/12 13:37] Snowdrop Short: before we get into the next
example I'd like to discuss, I think we should talk a bit about
"using"
[2009/02/12 13:37] Snowdrop Short: what is it supposed to do?
[2009/02/12 13:38] Christy Lock: it allows us to use the functions in
those libraries?
[2009/02/12 13:38] Snowdrop Short nods
[2009/02/12 13:38] Snowdrop Short: that's exactly it
[2009/02/12 13:38] Snowdrop Short: c# relieas on the .net framework
[2009/02/12 13:38] Snowdrop Short: relies, even
[2009/02/12 13:39] Snowdrop Short: and we are telling the compiler
and the runtime engine that this program needs to access the library
called "System"
[2009/02/12 13:39] Snowdrop Short: inside system, exists the
"Console"
[2009/02/12 13:39] Snowdrop Short: which is a library of functions we
can use to print on the console
[2009/02/12 13:40] Christy Lock: ah ha ok
[2009/02/12 13:40] M1sha Dallin: can you do : using System.Console;
to avoid typing Console.Writeline and just say WriteLine?
[2009/02/12 13:41] Snowdrop Short: I have updated the pastebin with
something which does exactly the same
[2009/02/12 13:41] Snowdrop Short:
http://www.pastebin.ca/1335365
[2009/02/12 13:41] Snowdrop Short: no, not really
[2009/02/12 13:41] Snowdrop Short: we'll get into more about that
later
[2009/02/12 13:41] Snowdrop Short: when we talk about namespaces
[2009/02/12 13:42] Starky Rubble: ok
[2009/02/12 13:42] M1sha Dallin: ok - the new version matches what is
recommended for Ada - use with (which may not have an equivalent in
C#) but not using
[2009/02/12 13:42] Adelle Fitzgerald: right, so instead of defining
the library at the begining
[2009/02/12 13:42] Adelle Fitzgerald: right, so instead of defining
the library at the begining it is definfig the library as it needs it
[2009/02/12 13:42] Snowdrop Short: yes
[2009/02/12 13:42] Adelle Fitzgerald: would that help to keep memory
down?
[2009/02/12 13:43] Starky Rubble: so System.Console.WriteLine
specifies the library, the object andthe method?
[2009/02/12 13:43] Snowdrop Short: using is a way of saying "if you
cannot find console anywhere, look into the library System"
[2009/02/12 13:43] M1sha Dallin: but may mean you get one you weren't
expecting if many Console.WriteLines exist?
[2009/02/12 13:44] Snowdrop Short: it helps reduce the number of
words we need to type in order to use the console
[2009/02/12 13:44] Snowdrop Short: that's part of it
[2009/02/12 13:44] Snowdrop Short: when the compiler and the runtimes
starts up
[2009/02/12 13:45] Snowdrop Short: it sees that there is no "Console"
thing defined in our program
[2009/02/12 13:45] Snowdrop Short: and goes to search for it
[2009/02/12 13:45] Adelle Fitzgerald: but it would increase the
number of word we have to type if for every line we have to write
System.Console.WriteLine
[2009/02/12 13:45] Snowdrop Short: by giving the exact name:
"System.Console" the compiler knows exactly where to look
[2009/02/12 13:46] Jeff 1564: so it will be faster?
[2009/02/12 13:46] Snowdrop Short: yes, so using is "just" a way of
making it easier to write the code
[2009/02/12 13:46] Snowdrop Short: no, when it comes to execution, it
will have the exact same speed
[2009/02/12 13:46] Snowdrop Short: but don't worry about speed
[2009/02/12 13:46] Starky Rubble: in the end it compiles the same
either way?
[2009/02/12 13:47] Snowdrop Short: first worry about getting it right
[2009/02/12 13:47] Snowdrop Short: when it works
[2009/02/12 13:47] Snowdrop Short: worry about getting it fast
[2009/02/12 13:47] Snowdrop Short: but most programs never get past
the "get it right" phase
[2009/02/12 13:47] Starky Rubble: right - just like Assembler lol
[2009/02/12 13:47] Adelle Fitzgerald: but if you declare 'Using
System' at the begining, then for each 'Console.WriteLine' it would
have to look up in the library, and slow down the compiling only?
[2009/02/12 13:47] Snowdrop Short: it compiles the same either way
[2009/02/12 13:48] Snowdrop Short: just a very tiny fraction, hardly
anything mentioning
[2009/02/12 13:48] Adelle Fitzgerald: so the ebst practice would be
to declare 'Using System' at the begining, right?
[2009/02/12 13:48] Adelle Fitzgerald: *best
[2009/02/12 13:48] Snowdrop Short: it really depends on the
circumstances
[2009/02/12 13:48] M1sha Dallin: I would argue not :-)
[2009/02/12 13:49] Snowdrop Short: but yes, most of the time it makes
it easier
[2009/02/12 13:49] Snowdrop Short: and it does have another benefit
[2009/02/12 13:49] Starky Rubble: I like easier lol
[2009/02/12 13:49] Snowdrop Short: but we'll get to that later
[2009/02/12 13:49] Snowdrop Short: again, there are no hard rules
[2009/02/12 13:49] Snowdrop Short: just personal preferences
[2009/02/12 13:49] Starky Rubble: so can one use multiple libraries?
[2009/02/12 13:49] Adelle Fitzgerald: ok, for an example, if you had
a program taht used Console.WriteLine 2000 times, then it would eb far
better to declare that at the begining, but if you had another
function you used only once, then declare that on that line of code?
[2009/02/12 13:50] Snowdrop Short: no
[2009/02/12 13:50] Adelle Fitzgerald: *declare that once on that line
of code
[2009/02/12 13:50] Snowdrop Short: it depends also on how explicit
you want to be in your code
[2009/02/12 13:51] Snowdrop Short: when you type something out that
explicit, most programmers will notice that is wasn't necessary and
wonder why
[2009/02/12 13:51] Snowdrop Short: it is a way of leaving hints in
the code
[2009/02/12 13:51] Snowdrop Short: but that's getting beyond our
selves
[2009/02/12 13:51] Adelle Fitzgerald nods
[2009/02/12 13:51] Snowdrop Short: but it has to do with clarity of
the program
[2009/02/12 13:52] Snowdrop Short: and clarity of programming is
actually next on my agenda
[2009/02/12 13:52] Starky Rubble: self-documenting code
[2009/02/12 13:52] Snowdrop Short: I have a small challenge for you
[2009/02/12 13:52] Snowdrop Short: I'm going to present you with a
program
[2009/02/12 13:52] Snowdrop Short: and I'd like for you to work two
and two
[2009/02/12 13:52] Snowdrop Short: and figure out what it does
[2009/02/12 13:53] Snowdrop Short: like we did last thursday
[2009/02/12 13:53] Snowdrop Short: so Christy and Starky work
together
[2009/02/12 13:53] Christy Lock: kk
[2009/02/12 13:53] Snowdrop Short: eagle and m!sha work together
[2009/02/12 13:53] Snowdrop Short: and Adelle and Jeff is a team
[2009/02/12 13:53] Snowdrop Short: but I warn you, it is tricky and
it is not easy
[2009/02/12 13:54] Starky Rubble: cool
[2009/02/12 13:54] Adelle Fitzgerald: :)
[2009/02/12 13:54] Snowdrop Short:
http://www.pastebin.ca/1335385
[2009/02/12 13:55] Snowdrop Short: have you got it?
[2009/02/12 13:55] Christy Lock: yes
[2009/02/12 13:55] M1sha Dallin: yep - I'd fire the programmer :-)
[2009/02/12 13:55] Snowdrop Short: ok, I'll give you 10 minutes
[2009/02/12 13:55] Snowdrop Short: at the most
[2009/02/12 13:58] Snowdrop Short: let me know when you give up :-)
[2009/02/12 13:59] Snowdrop Short: you can even try to run it if you
want
[2009/02/12 14:01] BlueWall Slade: .
[2009/02/12 14:02] M1sha Dallin: It doesn't seem to have a purpose
[2009/02/12 14:02] Snowdrop Short smiles
[2009/02/12 14:02] Snowdrop Short: I promise you it does
[2009/02/12 14:02] Snowdrop Short: but it is not easy to see through
[2009/02/12 14:04] Snowdrop Short: the whole purpose of this program
is to introduce you to code comments
[2009/02/12 14:04] Snowdrop Short: and what it can do to a program
[2009/02/12 14:04] Jeff 1564: smiles :)
[2009/02/12 14:05] Snowdrop Short: ok .. time is up
[2009/02/12 14:05] Christy Lock: lol good lesson
[2009/02/12 14:05] Snowdrop Short: what does our friendly little
program do?
[2009/02/12 14:05] Adelle Fitzgerald: shows a mess?
[2009/02/12 14:05] Christy Lock: confuses us?
[2009/02/12 14:05] Snowdrop Short: have you tried to run it?
[2009/02/12 14:05] Christy Lock: yes
[2009/02/12 14:05] Adelle Fitzgerald: at first I thought something to
do with dates
[2009/02/12 14:05] Starky Rubble: Obfuscates some code
[2009/02/12 14:05] Christy Lock: I replaced 1617 with 1 to try to get
a better idea
[2009/02/12 14:05] Adelle Fitzgerald: but when I ran it, it didnt
seem that way
[2009/02/12 14:06] Christy Lock: That got me a = 1 B =4
[2009/02/12 14:06] Starky Rubble: why the special case for 38?
[2009/02/12 14:06] Starky Rubble: or 40
[2009/02/12 14:06] Snowdrop Short:
http://www.pastebin.ca/1335404
[2009/02/12 14:07] Snowdrop Short: try to take a look at this
[2009/02/12 14:07] M1sha Dallin: :-)
[2009/02/12 14:08] BlueWall Slade: haaa
[2009/02/12 14:08] M1sha Dallin: Julian or Gregorian Calendar?
[2009/02/12 14:08] Snowdrop Short: gregorian
[2009/02/12 14:08] M1sha Dallin: ok :-)
[2009/02/12 14:08] Snowdrop Short: you can see that by the limit of
1583
[2009/02/12 14:09] M1sha Dallin: the lost fortnight
[2009/02/12 14:09] Snowdrop Short: ok, can anybody tell me what the
program does now?
[2009/02/12 14:09] Christy Lock: oh yeah
[2009/02/12 14:09] M1sha Dallin: I got as far as thinking it must be
days or times somewhere
[2009/02/12 14:09] Starky Rubble: well it tells you when the bunny
hops
[2009/02/12 14:09] Adelle Fitzgerald: day and month for easter
[2009/02/12 14:10] Snowdrop Short smiles
[2009/02/12 14:10] Christy Lock: I thought it was what wallstreet
used to calculate my investments
[2009/02/12 14:10] Snowdrop Short: some programmers will tell you
that code must be self documenting
[2009/02/12 14:10] Starky Rubble: heh they laid an egg
[2009/02/12 14:10] Snowdrop Short: but I think this piece of code
proves that sometimes comments does have value
[2009/02/12 14:11] Starky Rubble: I agree completely but good
varnames etc can bring more clarity
[2009/02/12 14:11] Snowdrop Short: yes, but actually the names of the
variables aren't that bad
[2009/02/12 14:11] Starky Rubble: so it isnt either / or
[2009/02/12 14:11] Snowdrop Short: but the algorithm is complex
[2009/02/12 14:11] Snowdrop Short: no, it never is
[2009/02/12 14:12] BlueWall Slade: the return type of void
[2009/02/12 14:12] Snowdrop Short: it is "do it reasonably"
[2009/02/12 14:12] Snowdrop Short: void
[2009/02/12 14:12] Snowdrop Short: is a special datatype
[2009/02/12 14:12] Christy Lock: no way for me its got to have the
comments
[2009/02/12 14:12] BlueWall Slade: then having out a and out b
[2009/02/12 14:12] Starky Rubble: is a bit bucket
[2009/02/12 14:12] Snowdrop Short: and means there is is no data
[2009/02/12 14:12] BlueWall Slade: I never noticed that bout C#
[2009/02/12 14:13] Snowdrop Short: it tells the compiler and the
programmer that the function doesn't return any values
[2009/02/12 14:13] Starky Rubble: out is like Return?
[2009/02/12 14:13] Snowdrop Short: not like return
[2009/02/12 14:13] BlueWall Slade: but, you name a&b in the
parameters
[2009/02/12 14:13] Snowdrop Short: but that there isn't supposed to
be a return
[2009/02/12 14:14] Snowdrop Short: with the out?
[2009/02/12 14:14] BlueWall Slade: yes
[2009/02/12 14:14] Snowdrop Short: what do you think it tells?
[2009/02/12 14:14] BlueWall Slade: mmm, looks sort-of like a property
[2009/02/12 14:15] BlueWall Slade: unles it is a type of pointer -
that is what it looks like
[2009/02/12 14:15] BlueWall Slade: a pointer to the variable you
wannt to hold the data
[2009/02/12 14:15] BlueWall Slade: line an *int
[2009/02/12 14:15] Snowdrop Short: no, c# has no pointers
[2009/02/12 14:16] Starky Rubble: like a weird sort of global
[2009/02/12 14:16] Snowdrop Short: (I'm cheating, but for now it is
true)
[2009/02/12 14:16] Christy Lock: is that like an out of range thingy?
[2009/02/12 14:16] BlueWall Slade: it has out?
[2009/02/12 14:16] Snowdrop Short: ok, it tells the compiler and
programmer
[2009/02/12 14:16] Starky Rubble: you refer to is as OUT on both ends
[2009/02/12 14:16] Snowdrop Short: that the value will be changed by
the method
[2009/02/12 14:16] BlueWall Slade: lol, a pointer
[2009/02/12 14:16] Snowdrop Short: so a and b, will be changed
[2009/02/12 14:17] Snowdrop Short: not really a pointer
[2009/02/12 14:17] BlueWall Slade: I will study it later - I thought
that was interesting
[2009/02/12 14:17] Snowdrop Short: the only way a function or a
method can change one of the "parameters" is if it is marked for
change
[2009/02/12 14:17] Starky Rubble: it is Bluewall lol
[2009/02/12 14:18] Snowdrop Short: there are two different markings
[2009/02/12 14:18] Snowdrop Short: ref and out
[2009/02/12 14:18] BlueWall Slade: & and *
[2009/02/12 14:18] Starky Rubble: reference is pointer
[2009/02/12 14:18] BlueWall Slade: hehe
[2009/02/12 14:18] Snowdrop Short: ref means that the function/method
will use the value and change it
[2009/02/12 14:18] Starky Rubble: ah
[2009/02/12 14:18] Snowdrop Short: what programmers call a "side
effect"
[2009/02/12 14:18] Starky Rubble: right
[2009/02/12 14:19] Snowdrop Short: and out means that it will not be
used during calculations internally in the function/method
[2009/02/12 14:19] Snowdrop Short: but only returned as output
[2009/02/12 14:19] Starky Rubble: I see
[2009/02/12 14:19] Snowdrop Short: call it a function which returns
more than one value
[2009/02/12 14:20] BlueWall Slade: ok
[2009/02/12 14:20] BlueWall Slade: so it caould be used instead of
returning a structure
[2009/02/12 14:20] Snowdrop Short: yes
[2009/02/12 14:20] Snowdrop Short: or anything really
[2009/02/12 14:20] BlueWall Slade: ++
[2009/02/12 14:21] Starky Rubble: Im confused by the terminology a
bit
[2009/02/12 14:21] Starky Rubble: Is Calculate a method?
[2009/02/12 14:21] Snowdrop Short: yes it is called a method in c#
[2009/02/12 14:21] Jeff 1564: same boat Starky
[2009/02/12 14:22] Snowdrop Short: almost everthing which performs
some operations are called methods
[2009/02/12 14:22] Simulator Version v0.5 shouts: OpenSimulator
Server 0.6.2.8309 (OS Microsoft Windows NT 5.2.3790 Service Pack 2)
ChilTasks:True PhysPrim:True
[2009/02/12 14:22] Starky Rubble: Ok so then when using Out, it must
be done in the Method def and also in the calling of the method or
what?
[2009/02/12 14:22] Snowdrop Short: yes
[2009/02/12 14:22] Starky Rubble: calling
[2009/02/12 14:22] Starky Rubble: ok
[2009/02/12 14:22] Snowdrop Short: that is one of the things I love
about c#
[2009/02/12 14:23] Snowdrop Short: that way you know what is going on
when reading other peoples code
[2009/02/12 14:23] Snowdrop Short: both when you are looking at the
method
[2009/02/12 14:23] Snowdrop Short: and when you look at where it is
called from
[2009/02/12 14:23] Starky Rubble: ok one last fundamental thing...
[2009/02/12 14:23] Snowdrop Short: it helps bring clarity to the code
[2009/02/12 14:23] Starky Rubble: for the moment lol
[2009/02/12 14:24] Starky Rubble: So objects are made of nouns and
verbs
[2009/02/12 14:24] Starky Rubble: the data are the nouns - the
methods are the verbs?
[2009/02/12 14:24] Starky Rubble: or not....
[2009/02/12 14:24] Snowdrop Short: pretty much
[2009/02/12 14:24] Starky Rubble: ok
[2009/02/12 14:25] Starky Rubble: Im getting there lol
[2009/02/12 14:25] Snowdrop Short: actually when doing object
oriented analysis
[2009/02/12 14:25] Snowdrop Short: that is exactly what you use
[2009/02/12 14:25] M1sha Dallin: It's one way of identifying classes
and methods when analysing a problem
[2009/02/12 14:26] Snowdrop Short: ok..
[2009/02/12 14:26] Snowdrop Short: there is still one thing we
haven't really talked about
[2009/02/12 14:26] Snowdrop Short: well two things
[2009/02/12 14:26] Snowdrop Short: but lets thake this one first
[2009/02/12 14:26] Snowdrop Short: what is "class" all about
[2009/02/12 14:27] Snowdrop Short: we've used it in all the samples
[2009/02/12 14:27] Starky Rubble: objects?
[2009/02/12 14:27] Snowdrop Short: but never really talked about it
[2009/02/12 14:27] Snowdrop Short: at least not on thurdays
[2009/02/12 14:27] Christy Lock: thats the template
[2009/02/12 14:28] Jeff 1564: is where the objects goes
[2009/02/12 14:28] Jeff 1564: ?
[2009/02/12 14:28] Snowdrop Short: for now lets just call it a
container of methods
[2009/02/12 14:28] Snowdrop Short: so we have a container of methods
[2009/02/12 14:29] Snowdrop Short: which is called "MainClass"
[2009/02/12 14:30] Snowdrop Short: we could have, and most of the
time we will have, a long list of methods inside a class
[2009/02/12 14:30] Starky Rubble: the whole thing is a series of
nested contaiers like one of this dolls
[2009/02/12 14:31] Snowdrop Short nods
[2009/02/12 14:31] Snowdrop Short: and it is even true about nesting
them inside each others
[2009/02/12 14:31] Starky Rubble: wrapped in curlies
[2009/02/12 14:31] Snowdrop Short: so if we return to the Console
thingie again
[2009/02/12 14:32] Snowdrop Short: it is also defined in a class
[2009/02/12 14:32] Snowdrop Short: and has a long list of methods
[2009/02/12 14:32] Snowdrop Short: one of those methods is called
"WriteLine"
[2009/02/12 14:33] Snowdrop Short: one of the greath strength of .net
is that you can combine binaries from all sorts of sources into one
program
[2009/02/12 14:33] Snowdrop Short: like in OpenSim
[2009/02/12 14:33] Starky Rubble: class.method
[2009/02/12 14:33] Snowdrop Short: it uses a number of external
sources
[2009/02/12 14:34] Snowdrop Short: some for handling jpeg
[2009/02/12 14:34] Snowdrop Short: some for logging
[2009/02/12 14:34] Snowdrop Short: some for XMLRPC
[2009/02/12 14:34] Snowdrop Short: and it works both on linux and
windows and mac without recompiling
[2009/02/12 14:34] BlueWall Slade: XMPP
[2009/02/12 14:34] Snowdrop Short: (almost)
[2009/02/12 14:34] Snowdrop Short: and XMPPP
[2009/02/12 14:34] Snowdrop Short: -p
[2009/02/12 14:35] Snowdrop Short: so what are the odds that one
developer working on some project defines a class called "Users"
[2009/02/12 14:35] BlueWall Slade: pretty high
[2009/02/12 14:35] Adelle Fitzgerald: agreed
[2009/02/12 14:36] Snowdrop Short: and another programmer in Shanghai
also creates a class called "Users"
[2009/02/12 14:36] Snowdrop Short: but with different methods and
functionality
[2009/02/12 14:36] Starky Rubble: thats where the containerization
comes in
[2009/02/12 14:36] Snowdrop Short: so if I decided to use both
libraries
[2009/02/12 14:37] Snowdrop Short: how would we know if it was a
"Shanghai" User or a "London" user?
[2009/02/12 14:37] Starky Rubble: Shanghi.user
[2009/02/12 14:37] Snowdrop Short: I'll give you a hint
[2009/02/12 14:37] Snowdrop Short: it is called "namespaces"
[2009/02/12 14:37] Sporty Chap: Namespaces?
[2009/02/12 14:37] Christy Lock: well the namespce it is in
[2009/02/12 14:38] Snowdrop Short: yes
[2009/02/12 14:38] Christy Lock: are they part of the classes inside?
[2009/02/12 14:38] Starky Rubble: another doll
[2009/02/12 14:38] Jeff 1564: :)
[2009/02/12 14:38] Snowdrop Short: yes, they are part of the class
definition
[2009/02/12 14:38] Starky Rubble: namespaces contain classes
[2009/02/12 14:38] Starky Rubble: ?
[2009/02/12 14:38] Sporty Chap: Sorry I didn't realize there was a
class today but I definitely want to be here, lol.
[2009/02/12 14:38] Snowdrop Short: so, what is the full namespace
path of our "Calculate" method?
[2009/02/12 14:39] Snowdrop Short: c# programming every tuesday and
wednesday
[2009/02/12 14:39] Snowdrop Short: you are welcome Sporty
[2009/02/12 14:39] Sporty Chap: Thank you. :)
[2009/02/12 14:39] Christy Lock: Lesson05
[2009/02/12 14:39] Starky Rubble: lesson05.MainClass.Caculate?
[2009/02/12 14:39] Snowdrop Short: Starky is almost right
[2009/02/12 14:40] Snowdrop Short: but not entirely
[2009/02/12 14:40] Snowdrop Short: anybody have a better guess?
[2009/02/12 14:40] Christy Lock: Lesson05.MainClass.Caculate?
[2009/02/12 14:40] Snowdrop Short: yes
[2009/02/12 14:40] Snowdrop Short smiles
[2009/02/12 14:41] Snowdrop Short: there is a big difference between
capitals and non capitals in c#
[2009/02/12 14:41] Snowdrop Short: short is not the same as Short
[2009/02/12 14:41] Starky Rubble: Case Matters!
[2009/02/12 14:41] Snowdrop Short: yes, very much so
[2009/02/12 14:41] Starky Rubble: heh
[2009/02/12 14:42] Snowdrop Short: and it is considered bad style to
use that on purpose
[2009/02/12 14:42] BlueWall Slade gave you C# Class 2/12/09 missing
segment.
[2009/02/12 14:42] Snowdrop Short: because it is so easy to make a
mistake
[2009/02/12 14:42] Snowdrop Short: ok
[2009/02/12 14:42] Snowdrop Short: so now we've got the namespace
thing in places
[2009/02/12 14:42] Snowdrop Short: lets return to the using thing
[2009/02/12 14:43] Snowdrop Short: because by saying "using System;"
[2009/02/12 14:43] Snowdrop Short: I told the compiler to go find
"Console" by it self
[2009/02/12 14:43] Snowdrop Short: rather than spelling out the full
namespace name
[2009/02/12 14:43] Snowdrop Short: that is why you cannot say "using
System.Console;"
[2009/02/12 14:44] Snowdrop Short: because only namespace names can
be used in a "using"
[2009/02/12 14:44] Christy Lock: ah ha ok I see
[2009/02/12 14:44] Sporty Chap: Ohhhh.
[2009/02/12 14:44] M1sha Dallin: ok
[2009/02/12 14:45] Snowdrop Short: and lets return to our
Shanghai.User and London.User class
[2009/02/12 14:45] Starky Rubble: is namespace the outermost layerÉ
[2009/02/12 14:45] Snowdrop Short: lets say I had written
[2009/02/12 14:45] Snowdrop Short: using Shanghai;
[2009/02/12 14:45] Snowdrop Short: using London;
[2009/02/12 14:45] Snowdrop Short: and then simply referred to "User"
in my program
[2009/02/12 14:45] Starky Rubble: confusion
[2009/02/12 14:46] Snowdrop Short: there'd be a problem telling which
one I meant
[2009/02/12 14:46] Snowdrop Short: so sometimes you use the full
namespace name in order to avoid confusion
[2009/02/12 14:47] Snowdrop Short: ok
[2009/02/12 14:47] Snowdrop Short: when you look inside the Calculate
method
[2009/02/12 14:47] Snowdrop Short: you see something called:
[2009/02/12 14:47] Snowdrop Short: switch(....)
[2009/02/12 14:47] Snowdrop Short: and
[2009/02/12 14:47] Snowdrop Short: case ...:
[2009/02/12 14:47] Snowdrop Short: what is that about
[2009/02/12 14:47] Snowdrop Short: ?
[2009/02/12 14:48] Starky Rubble: code branching
[2009/02/12 14:48] Sporty Chap: Flow control! XD
[2009/02/12 14:48] Christy Lock: like an if then else thing?
[2009/02/12 14:48] Starky Rubble: yes
[2009/02/12 14:48] Snowdrop Short: gee... I wonder if I'm moving too
slow here
[2009/02/12 14:48] Starky Rubble: but different in that it is not
nested testing
[2009/02/12 14:48] Snowdrop Short: you definately seems to know it
all
[2009/02/12 14:49] Snowdrop Short: should I pick up the pace?
[2009/02/12 14:49] Sporty Chap: No, I've been plowing through C# for
Dummies so I half-know a half-dozen things halfway. =3
[2009/02/12 14:49] Christy Lock: lol yeah I been hacking on lsl for
awhile so Im guessing a bit
[2009/02/12 14:49] Starky Rubble: I know code in general but no c/
[2009/02/12 14:49] Starky Rubble: c/
[2009/02/12 14:50] Christy Lock: the namespace thing was completly
new to me
[2009/02/12 14:50] Starky Rubble: agreed
[2009/02/12 14:50] Snowdrop Short: ok
[2009/02/12 14:50] Snowdrop Short: next time we'll get into object
orientation
[2009/02/12 14:51] Snowdrop Short: encapsulation, inheritance
[2009/02/12 14:51] Snowdrop Short: and the likes
[2009/02/12 14:51] Snowdrop Short: and I think that you should start
to write some of your own programs
[2009/02/12 14:52] Snowdrop Short: as some excersises
[2009/02/12 14:52] Starky Rubble: maybe when talking about a general
coding concept like SwitchéCase in your lesson just ask if we are
comfortable in our understanfing of oit
[2009/02/12 14:52] Sporty Chap: What time of the day do these start?
[2009/02/12 14:52] Christy Lock: I made one that writes a text file
to the drive from osgrid
[2009/02/12 14:52] Snowdrop Short: the thursday classes starts at
21:00 gmt
[2009/02/12 14:53] Snowdrop Short: and tuesday it is at 20:00
[2009/02/12 14:53] Snowdrop Short: gmt
[2009/02/12 14:53] Sporty Chap: Ahh thanks.
[2009/02/12 14:53] Snowdrop Short: tuesdays is focussed on c# for
developers
[2009/02/12 14:53] Snowdrop Short: e.g. php and java script
programmers
[2009/02/12 14:54] Snowdrop Short: one has written a ton of code in
fortran
[2009/02/12 14:54] Snowdrop Short: etc.
[2009/02/12 14:54] Sporty Chap: K thankee.
[2009/02/12 14:54] Starky Rubble: both are interesting lol
[2009/02/12 14:54] Christy Lock: any homework?
[2009/02/12 14:55] Snowdrop Short: yes
[2009/02/12 14:55] Snowdrop Short: I'd like for you to go discovering
in the System
[2009/02/12 14:55] Snowdrop Short: namespace
[2009/02/12 14:55] Snowdrop Short: knowing what things are premade
and ready for you to use is important
[2009/02/12 14:56] Christy Lock: ok cool!
[2009/02/12 14:56] Snowdrop Short: don't go too deep, but take a good
look at Console
[2009/02/12 14:56] Snowdrop Short: it can do quite a lot
[2009/02/12 14:56] Snowdrop Short: if you feel you are up to it
expore some more
[2009/02/12 14:56] Christy Lock: is the MSDN site the best for that?
[2009/02/12 14:56] Snowdrop Short: yes, by far
[2009/02/12 14:57] Snowdrop Short: the documentation on MSDN is
better than on MONO
[2009/02/12 15:01] Adelle Fitzgerald: i'm struggling a bit on
namespace, but I'll haev a good read up over the next few days
[2009/02/12 15:01] Adelle Fitzgerald: oh she gone :(
[2009/02/12 15:01] Adelle Fitzgerald: grr
[2009/02/12 15:01] Jeff 1564: :)
[2009/02/12 15:01] Teleport completed from
http://slurl.com/secondlife/Lbsa%20Plaza/126/126/43
[2009/02/12 15:01] The region you have entered is running a different
simulator version. Click this message for details.
[2009/02/12 15:02] Adelle Fitzgerald: hehe laggy
[2009/02/12 15:02] Adelle Fitzgerald: im struggling a little with
namespace, but I'll have a good read up over the enxt couple of days
[2009/02/12 15:02] Adelle Fitzgerald: I think i understand the
concept though
[2009/02/12 15:03] Snowdrop Short: you can always go ask me on IRC
[2009/02/12 15:03] Snowdrop Short: if you have any questions
[2009/02/12 15:03] Adelle Fitzgerald: okies, thanks :)
[2009/02/12 15:03] Snowdrop Short: really, I was just finishing up
[2009/02/12 15:03] Snowdrop Short: the sim lasted a longer than it
usually do
[2009/02/12 15:04] M1sha Dallin: :-)
[2009/02/12 15:04] Snowdrop Short: it's a good opportunity for the
devs to learn abit about how it works under stress
[2009/02/12 15:04] Jeff 1564: my last log ends here [2009/02/12
14:56] Snowdrop Short: yes, by far
[2009/02/12 15:04] Starky Rubble: good class Teach!
[2009/02/12 15:05] Snowdrop Short: thank you
[2009/02/12 15:05] Snowdrop Short smiles
[2009/02/12 15:05] Snowdrop Short: next will be objects/classes,
inheritance, encapsulation
[2009/02/12 15:05] Snowdrop Short: maybe polymorphisms
[2009/02/12 15:05] Starky Rubble: ooooh
[2009/02/12 15:05] Adelle Fitzgerald: O.o
[2009/02/12 15:05] Starky Rubble: heh
[2009/02/12 15:06] Snowdrop Short: and well try to write some code,
so be ready to run your IDE
[2009/02/12 15:06] Adelle Fitzgerald: :)
[2009/02/12 15:06] Jeff 1564: ok
[2009/02/12 15:06] Starky Rubble: yes maam
[2009/02/12 15:06] Snowdrop Short: learning by doing :-)
[2009/02/12 15:06] Adelle Fitzgerald: yesh
[2009/02/12 15:06] Starky Rubble: creative destruction lol
[2009/02/12 15:07] Snowdrop Short nods
[2009/02/12 15:07] Adelle Fitzgerald: destructive creation ;)
[2009/02/12 15:07] Starky Rubble: heh
[2009/02/12 15:07] Snowdrop Short: it is getting late around here in
my place
[2009/02/12 15:07] Starky Rubble: g'night
[2009/02/12 15:07] Snowdrop Short: so I'll scoot right of to bed
[2009/02/12 15:07] Adelle Fitzgerald: okies, thank very much
Snowdrop :)
[2009/02/12 15:07] Snowdrop Short: nite all
[2009/02/12 15:07] Adelle Fitzgerald: nighty!
[2009/02/12 15:07] M1sha Dallin: ty - g'night
http://www.pastebin.ca/1335324
using System;
namespace Lesson02
{
class MainClass
{
static decimal Factorial(decimal n)
{
decimal result = 1;
for(decimal i=1; i<=n; i++)
result = result * i;
return result;
}
public static void Main(string[] args)
{
decimal v = 24;
Console.WriteLine("The factorial of {0}={1}", v, Factorial(v));
}
}
}
http://www.pastebin.ca/1335365
namespace Lesson02
{
class MainClass
{
static decimal Factorial(decimal n)
{
decimal result = 1;
for(decimal i=1; i<=n; i++)
result = result * i;
return result;
}
public static void Main(string[] args)
{
decimal v = 24;
System.Console.WriteLine("The factorial of {0}={1}", v, Factorial
(v));
}
}
}
http://www.pastebin.ca/1335385
using System;
namespace Lesson05
{
class MainClass
{
static void Calculate(out int d, out int m, int y)
{
int FirstDig, Remain19, temp;
int tA, tB, tC, tD, tE;
FirstDig = y / 100;
Remain19 = y % 19;
temp = (FirstDig - 15) / 2 + 202 - 11 * Remain19;
switch(FirstDig)
{
case 21:
case 24:
case 25:
case 27:
case 28:
case 29:
case 30:
case 31:
case 32:
case 34:
case 35:
case 38:
temp = temp - 1;
break;
case 33:
case 36:
case 37:
case 39:
case 40:
temp = temp - 2;
break;
}
temp = temp % 30;
tA = temp + 21;
if(temp == 29)
tA = tA - 1;
if(temp == 28 && Remain19 > 10)
tA = tA - 1;
tB = (tA - 19) % 7;
tC = (40 - FirstDig) % 4;
if(tC == 3)
tC = tC + 1;
if(tC > 1)
tC = tC + 1;
temp = y % 100;
tD = (temp + temp / 4) % 7;
tE = ((20 - tB - tC - tD) % 7) + 1;
d = tA + tE;
if(d > 31)
{
d = d - 31;
m = 4;
}
else
{
m = 3;
}
}
public static void Main(string[] args)
{
int a;
int b;
Calculate(out a, out b, 1617);
Console.WriteLine("Result a={0}, b={1}", a, b);
}
}
}
http://www.pastebin.ca/1335404
using System;
namespace Lesson06
{
class MainClass
{
//EASTER DATE CALCULATION FOR YEARS 1583 TO 4099
// y is a 4 digit year 1583 to 4099
// d returns the day of the month of Easter
// m returns the month of Easter
// Easter Sunday is the Sunday following the Paschal Full Moon
// (PFM) date for the year
// This algorithm is an arithmetic interpretation of the 3 step
// Easter Dating Method developed by Ron Mallen 1985, as a vast
// improvement on the method described in the Common Prayer Book
// Because this algorithm is a direct translation of the
// official tables, it can be easily proved to be 100% correct
// This algorithm derives values by sequential inter-dependent
// calculations, so ... DO NOT MODIFY THE ORDER OF CALCULATIONS!
static void Calculate(out int d, out int m, int y)
{
int FirstDig, Remain19, temp; //intermediate results
int tA, tB, tC, tD, tE; //table A to E results
FirstDig = y / 100; //first 2 digits of year
Remain19 = y % 19; //remainder of year / 19
// calculate PFM date
temp = (FirstDig - 15) / 2 + 202 - 11 * Remain19;
switch(FirstDig)
{
case 21:
case 24:
case 25:
case 27:
case 28:
case 29:
case 30:
case 31:
case 32:
case 34:
case 35:
case 38:
temp = temp - 1;
break;
case 33:
case 36:
case 37:
case 39:
case 40:
temp = temp - 2;
break;
}
temp = temp % 30;
tA = temp + 21;
if(temp == 29)
tA = tA - 1;
if(temp == 28 && Remain19 > 10)
tA = tA - 1;
//find the next Sunday
tB = (tA - 19) % 7;
tC = (40 - FirstDig) % 4;
if(tC == 3)
tC = tC + 1;
if(tC > 1)
tC = tC + 1;
temp = y % 100;
tD = (temp + temp / 4) % 7;
tE = ((20 - tB - tC - tD) % 7) + 1;
d = tA + tE;
// return the date
if(d > 31)
{
d = d - 31;
m = 4;
}
else
{
m = 3;
}
}
public static void Main(string[] args)
{
int day;
int month;
Calculate(out day, out month, 1617);
Console.WriteLine("Result day={0}, month={1}", day, month);
}
}
}