la5er Posted December 3, 2011 Report Share Posted December 3, 2011 If you have ever wanted to learn to program a computer or learn the inner workings of computers this post is for you. It is a simplified version of 4 years of curriculum you would otherwise learn at a university.First there is computer theory which covers decision trees. As with everything in life when you reach a point or moment you either make a decision to go left or go right. This is how computers work as well. The moment in this case is a parent node and the decisions are the child nodes of that parent node. As a program executes its tree starts to grow branches with each user input and terminates at the last child of which is a leaf in this case.There are truth tables that are part of computer theory. And they use AND, OR, THEN, and IFFAND is true if the two inputs on both sides are true otherwise falseOR is false if both inputs are false otherwise trueTHEN is true if the first input is true otherwise falseIFF is true if both inputs are true otherwise falseWhen you append an "N" at the beginning of the four above operations you get the negation or opposite however this is only the case for OR and AND making them NOR and NAND respectivelyThere are methods computers use to store data that is complex. It stores them in 2 modes: BIN and HEXBIN is read as such: 10000000 is 1, 01000000 is 2, 00100000 is 4, and so on. Any combination of the 8 different BIN "WORDS" yields the summation. i.e. 11000000 is 3, 10100000 is 5, and so on.HEX is read a little differently but instead of a WORD of 8 bits it is a WORD of 2 HEX characters ranging from 0 to F with F being a value of 15. So you have 1100 1100 meaning 3 3, 1101 1100 meaning B 3. You then have data-types of which ALL programs are ultimately broken down into. Strings, Boolean, Integers, Floats, and Doubles.Strings are things like "Hi, How are you doing". Booleans are either True or FalseIntegers are any number without a decimal point in themFloats are huge numbers that have a high degree of precision that have a decimal point in them.Doubles are simplified versions of Floats. A difference between a Float and Double can be noted as: Float: 357373772374166272.6727272782342173215461 Double: 426272.3351Keep in mind when they can be interchangeable to a degree. There is a range at which they can cover that distinguishes them though.Next reply to this topic will be about how to write a program. I hope I get a community wide interest as that will open the door for me to post further replies. Link to comment Share on other sites More sharing options...
RikuoAmero Posted December 4, 2011 Report Share Posted December 4, 2011 Nice. I taught myself most of this already growing up around computers, but sweet having it all in one place. You get a V for Victory from me! Link to comment Share on other sites More sharing options...
Malyssa Rahl Posted December 4, 2011 Report Share Posted December 4, 2011 Silly La5er. Everyone knows that computers, and many other things, run on magic smoke. When all of the magic smoke escapes, it stops working! Link to comment Share on other sites More sharing options...
ogmo Posted December 8, 2011 Report Share Posted December 8, 2011 I am a little bit confused. I always thought the LSB is on the right end. Because in C 10000000 is equal to 128, 0100000 to 64 and so on. And 1101 1100 would be DC.Besides a Computer stores always data in Binary format. Hexadecimal is only a abbreviated form : )And normally double is the short form for "double float". so it should bedouble: 965821431.1285479654float: 26272.3351 Link to comment Share on other sites More sharing options...
la5er Posted December 9, 2011 Author Report Share Posted December 9, 2011 I am a little bit confused. I always thought the LSB is on the right end. Because in C 10000000 is equal to 128, 0100000 to 64 and so on. And 1101 1100 would be DC.Besides a Computer stores always data in Binary format. Hexadecimal is only a abbreviated form : )And normally double is the short form for "double float". so it should bedouble: 965821431.1285479654float: 26272.3351I wonder if I can say touche on some of your points. However there is big-endian and little-endian. it all depends on what platform the programmers worked on sparc v intel for an example. At any rate. Lets continue with our lessons.Lets see how programs are written. Lets take a simple example. A car. Cars have different types of which have their own properties. Hatchback, sedan, pickup, sports-car, etc... These are PUBLIC in scope and are part of the package of car. Lets call these form-factors classes.Now you wouldnt put a spoiler on a pickup truck if youre a sane person. Nor would you put a 'dualy' on a hatchback, or a rolled-rear pan on the back of a mini-van. These are private properties of their respective class.Now, how do all these datatypes we talked about earlier? Well all vehicles have wheels. Lets say the wheels in this case are an integer with a value or count assigned to them to make them an integer. They all have engines as well but the engine comes in a class of its own because they come in twin, v4, etc... They also are 2 stroke or 4 stroke. Can use diesel, unleaded, premium, or hybrid fuels. The cylinder count is an integer that has a value assigned to it, if its on or off being a boolean, in reverse or forward which is also another boolean, the fuel type which is a string describing its type. Etc....Each vehicle has a paint color(string in this case), How much fuel it can have in its tank(double) i.e. 1.2L, 2.2L,, 4L etc...Now that we have done all this ground work lets see how the code looks.Namespace vehicle { public class engine { private string fuel private boolean turnedOn private boolean direction private integer cylinders private double fuel } Public class pickup truck { private engine engine = new engine() //This is required to be new because you cannot set an engines properties that havent been beyond the blue-print(new) phase engine.fuel = 34.4 engine.cylinders = 6 engine.turnedOn = false engine.direction = forward ....(fill in the rest as a challenge) private string color red private integer seats = 4 private boolean crewCab = true private string licensePlate = "12A-5FK" private turnOn(keyTurned) { if keyTurned = true Engine.turnedOn = true else Engine.turnedOn = false } ...... (fill this in with more methods as a challenge) } ..... (fill the rest of the namespace with other vehicles and properties.}The reasoning behind the private and public word modifiers are because you wouldnt want to turn that cars engine on next to you while in your own car would you? Nor would you want to all the sudden go disco on your paint job cause some guy decides to rainbow up his world?The public word means that you can "buy" a car off the lot with customized(private) features to your hearts content.Next topic if I receive more interest will be HOW to put a spoiler on the back of a motorcycle! It can be done!The challenge awaits you, will you take it? Link to comment Share on other sites More sharing options...
Alegend1994 Posted December 27, 2011 Report Share Posted December 27, 2011 I was able to follow the first post very easily, probably because I learnt it all in Secondary School (High School), but this post was a little harder to grasp, but I eventually understood it. It's actually almost the same as making posts with the [\URL] and [\IMG], only a bit more advanced. Link to comment Share on other sites More sharing options...
Gambit3014 Posted December 27, 2011 Report Share Posted December 27, 2011 http://epicawesome.com/files/imagecache/ImagePost585x650/images/1/never-obsolete.jpg Link to comment Share on other sites More sharing options...
Dae314 Posted December 27, 2011 Report Share Posted December 27, 2011 You should probably mention somewhere in that second post that you're talking about the Object Oriented Paradigm. Even more specifically, you might want to mention that you're talking about OOP in what appears to be pseudo-code for Java or C++ (Python for instance is OO but does not have public/private keywords).You also failed to mention abstraction in the first post which makes me a bit sad. Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now