csharpfritz / csharp_with_csharpfritz

Show notes, slides, and samples from the CSharp with CSharpFritz show
MIT License
659 stars 215 forks source link

Couple of suggestions on notebook 1 #47

Open hasack opened 4 years ago

hasack commented 4 years ago

Listened to the recording for notebook 1 and felt like there were a few jumps or assumptions that newbies like me might not immediately get so had some suggestions that might make the stepping stones closer together:

// Everything in C# is an object

Can there be a short definition of what it means to be 'an object'? Something like:

_"The idea that there's a series of out-of-the-box (or user designed) specifications / blueprints - known as TYPES. When something new is created to those specifications / blueprints, it's known as an OBJECT.

As a result of being built to those particular blueprints / specifications, the new object will have characteristics (known as properties), and things it can do (known as methods).

A real world example would be if I got a new vehicle (let's call it 'myVehicle') built to 'car' specifications. It has characteristics (properties) such as colour, make, model. It also has things it can do (methods) like go forward, reverse.

The example OBJECT myVehicle is said to be "of TYPE car".

Properties are usually retrieved by adding a .Something after the name of the object. For example car.colour might return 'blue'.

Methods are usually triggered with .Something(). For example car.Goforward()

The brackets allow for extra detail to be added to the instruction. For example, instructing the car to advance a distance of 3 might be car.Goforward(3)"_

// Maybe an introduction to Type Casting

_"Trying to squeeze something that is originally of one shape into another shape. For example squeezing an integer into a hole designed for a decimal. C# can figure that out (implicit conversion) on the basis it fits into the hole with space left over.

However, trying to do the other way round (decimal into something designed for an integer) does not want to go naturally, so needs to be forced (explicit conversion)."_

// Modify and assign at the same time

Worth putting the equivalent code after in a comment?

e.g. // apples = apples + 10; e.g. // apples = apples - 10; ...

Just thoughts - happy to write up and send over PR if useful. If doesn't work / fit the flow, no worries.

csharpfritz commented 4 years ago

Sounds like a worthy update.. if you'd like to send over a PR that would be a great help