Click here to Skip to main content
15,887,596 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hello Everyone, I have been programming for quite a while. I apologize if my English isn't that great, but my native languages are Spanish and Português. 
I have studied programming and languages for a very long time, but I still have some doubts.
I basically understand if not everything a lot, but I struggle to put those ideas into play.
First I want to walk you down my thought process, 

**IF AT ANY TIME YOU BELIEVE I AM WRONG OR WHAT I AM SAYING MAKES NO SENSE, *PLEASE* BY ALL MEANS CORRECT ME.**

Programming is easy in theory. 

It's just four basic mathematical calculations done to values. They are **addition, subtraction, multiplication, and division.** **Division** is **subtraction** in series and **multiplication** is addition in **series**.

To the computer **everything** is a number. 

Everything is binary. In fact, text, strings, etc. are all composed of binary numbers. If there is not a numeric value associated to something such as an offset, variable, memory direction, value, etc. which the computer can use to make a decision, it is basically worthless, as even strings have their values such as length, comparing characters which understood by the computer to be binary digits.

Memory is examined in bits by powers of 4 as it equals either 4 binary values such as 0011 or just one hexadecimal values which would be something such as:

 1. 2 bits 
 2. 4 bits(one hex value)  
 3. 8 bits(a byte/2 hex values)12 
 4. 16(2 bytes/4 hex values such as 0xFFFF = 111111111111111) 
 5. 20 
 6. 24 
 7. 28 
 8. 32(4 bytes or 8 hex values 0xFFFFFFFF = 11111111111111111111111111111111)
 9. 36

Variables are just houses with directions for data.

A function uses there houses to implement one of the four fundamental operations**(+,-,*,/)** on each other to produce something or alter.

A **class**, **Object**, and **Instance** are just a group of **variables** (values subjected to change) with specialized processes (processes which are used to alter or produce a value from others or through itself) which are fused together by an individual provided they have a basic logical connection. This logical connection is determined by the user. For example, even if it is bad practice I can technically have an A object and B object work together and share a variable or process which is concerned with something. Both do it in a different way (I understand Polymorphism and related subjects of operator overloading) but because in essence, following this simple map: 

**instance (unrelated object) -> object (implementation of a class) -> class (grouped variables and functions) -> function (grouped variables with rules) -> variables (values with names) -> value (calculative number)** 
anything can really be logically paired because everything can share a numeric value with something else.

Object, Instance, Function, and Variable names have no real or subjective importance to the machine. This is just so that the programmer has an easier time understanding everything. A variable named *a, thisvariable, complexAndLongVariable, x, hg, cool, etc.* are all the same to a computer, it is just a location, when I analyze code I disregard it. In a sense the value is more important because it's what is being calculated, no? 

Data structures come in two distinct flavors, either solo or paired. Since as proven above everything is a number which is a value that can be calculated or operated on, a "data structure" only holds this through a proxy such as a memory direction or to us, its variable name, which is why the names are inherently unimportant. These are solo data structures such as
**x = 1
y = 2
z = x + y**
etc.
They only hold a single value. 
Paired is the same thing to a computer, but to us it seems as if they are connected or grouped together such as in a hash, array, string, tree, etc.
    a = [1,2,3,4,5,6,7]
These values are all under the "umbrella" named a, but they exist independently and can be altered by either making a new array with an altered value, or by changing the value directly (depends on the programming language).

After considering my form of thinking, then how can I apply this theory to better develop and create something in practice?

I always think out my code in a pseudocode fashion, but it seems that I struggle doing this. I practice daily too.
I mean, I think the naming of certain variables or functions make it confusing because they abstract the underlying processes which make it difficult for you to understand.

Let me show you, my dear viewer, a concrete example of what I mean when I struggle.
Link:
 <https://github.com/TASVideos/desmume/blob/master/desmume/src/MMU.cpp>

    squaredbit  = (u64) ((((u64) ~0LL) >> 1) & 
                        ~(((u64) ~0LL) >> 2));

This is one example from the link above. 
I understand you are storing a value, but what the hell do all of those parenthesis do? I understand it is to separate the code, and in fact it looks as if the values which are identifiable are being NOT operated, shifted 1 or 2 bits to the right individually and ANDed together.
I guess I just don't understand the logic behind doing this?

    u16 spicnt = T1ReadWord(MMU.MMU_MEM[ARMCPU_ARM7][(REG_SPICNT >> 20) & 0xff], REG_SPICNT & 0

This is another thing, so the output of a function named T1ReadWord is stored as a number which has other variables being calculated either by shifting 20, ANDing 11111111, etc.

Pretty much if anything is looked at for long enough, it is just putting a value in a memory and calculating off of it and further expanding on that single variable, am I wrong to think this is what programming is?
For example:

 1. A = 1 
 2. B = A * 2 
 3. C = A * B + A 
 4. D = C + B + A + A 
 5. E = D + B + B + A +D * C 
 6. F = D * A * B * E * C * A 
 7. on.. and on... and on... till it becomes something like this... 
 8. Z = A + 1 * (B/C) + G (J ~ S) S * T

    + V + K * Q

I believe that predefined functions are also things I struggle with because I might to understand something, fundamentally as another person. To understand terms such as Heap and Stack or even Array in English was a nightmare. I still refer to it by their names in my native language. Could language be a factor in this?

Could syntax or grammar be the issue?
Has anyone else faced a problem like mine before?
Theoretically, I am really good at this, but practically I am useless because of something I have yet to understand. 

Thank you, please link me anything you may have to assist me in my endeavours.


What I have tried:

Please help me.
Thank you.
I have tried to read all sorts of books, but I am struggling.
Posted
Updated 3-Jul-20 14:45pm
Comments
[no name] 3-Jul-20 16:00pm    
First of all, forget "Everything is binary". This is "only" the path of history. Circuits designed at the beginning with 0 Volts for binary 0 and 5Volts for a one (base 2).
But there could also be a system which works with -5Volts, 0 Volts and 5 Volts and it will end in a system based on 3.

There is so much more to mention. I like your thoughts ;)
KarstenK 4-Jul-20 4:51am    
A computer is a machine which deals with 1 and 0 as "on" and "off". Every higher abstrayction is a model of humans. Read about "Touring machine". We as human use programming languages to tell the computer what it should do. It starts from "add 1 to 1 and print that number" ;-)

Unfortunately, this is the wrong type of forum for this: it amounts to a full mentoring job and we really aren't set up for that at all, nor do most of us have the time.
 
Share this answer
 
Comments
[no name] 3-Jul-20 16:22pm    
A 5. I like the question.
Quote:
Object, Instance, Function, and Variable names have no real or subjective importance to the machine. This is just so that the programmer has an easier time understanding everything.
True, but this isn't unique to computers. It's just creating higher levels of abstraction so that people familiar with the domain (music, tennis, economics...) can have efficient discussions.

Quote:
To understand terms such as Heap and Stack or even Array in English was a nightmare. I still refer to it by their names in my native language. Could language be a factor in this?
I think you're right. If I came across those terms in a language in which I wasn't reasonably fluent, I think I would react the same way.

And I think your English is pretty good!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900