Jump to content

Basic computer science question.

Nicnac

Okay, So I am just at the beginning of reading up about tensor flow and the likes.

I have done some python stuff and C++ but it's ridiculous compared to real programming.

So can one of you geeks please explain to me in simple words (pretend i am a 13 year old  Actually pretend I am a 10 year old, lol) the whole concept of "bit-ness" like signed/unsigned integers and floating points?

I have refreshed my knowledge on vectors but really I always sucked at maths..

So yea any explanation here is appreciated and some light reading you can recommend would also be appreciated a lot :) 

Thanks in advance!

Folding stats

Vigilo Confido

 

Link to comment
Share on other sites

Link to post
Share on other sites

Also, how tf (not tensorflow ^^) is this being read? it's supposed to show floating point numbers exactly.

 

434px-Gleitkommazahlen_svg.png.9cdf4b6e434c5743a31c0881a5353a22.png

 

"Mantissenlänge"= Significand

Folding stats

Vigilo Confido

 

Link to comment
Share on other sites

Link to post
Share on other sites

10 minutes ago, Nicnac said:

signed/unsigned integers and floating points?

Signed = that bit or byte value can be positive or negative.

So a 2 bit signed value can be -1 to 1, an 2 bit unsigned value would be 0-3. The first bit will be used to declare positive or negative.

-1 would be 1 1 and 1 would be 0 1

 

Unsigned = 0 - whatever the length is.

 

Floating point =  Same as signed where some bits will be used to decide for the exponent (where the comma goes)

 

When you use any of these you need to take the lenght into account. Because for example an 8bit (1byte) value can go to 255 the signed 8bit goes to 127.

You however have the same range. Unsigned its 0-255, signed -127 to 127

 

Its very simple and there are many sources to use for this stuff ;) 

Link to comment
Share on other sites

Link to post
Share on other sites

3 minutes ago, Dujith said:

Signed = that bit or byte value can be positive or negative.

So a 2 bit signed value can be -1 to 1, an 2 bit unsigned value would be 0-3. The first bit will be used to declare positive or negative.

-1 would be 1 1 and 1 would be 0 1

 

Unsigned = 0 - whatever the length is.

 

Floating point =  Same as signed where some bits will be used to decide for the exponent (where the comma goes)

 

When you use any of these you need to take the lenght into account. Because for example an 8bit (1byte) value can go to 255 the signed 8bit goes to 127.

You however have the same range. Unsigned its 0-255, signed -127 to 127

 

Its very simple and there are many sources to use for this stuff ;) 

thanks for that clarification! but still... And I feel really dumb for this.. Why is it a 2 bit value when it ranges from 0-3 (unsigned)? I mean that is 4 values it can be, right? 0,1,2,3 so why is it called 2bit? 

Folding stats

Vigilo Confido

 

Link to comment
Share on other sites

Link to post
Share on other sites

Just now, Nicnac said:

thanks for that clarification! but still... And I feel really dumb for this.. Why is it a 2 bit value when it ranges from 0-3 (unsigned)? I mean that is 4 values it can be, right? 0,1,2,3 so why is it called 2bit? 

Thats how the number is made up, out of 2 bits. A bit can be 0 or 1, so thats 2 options.

2 bit you double that number, so 4 options:

 

0 0 = 0

0 1 = 1

1 0 = 2

1 1 = 3

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, Nicnac said:

thanks for that clarification! but still... And I feel really dumb for this.. Why is it a 2 bit value when it ranges from 0-3 (unsigned)? I mean that is 4 values it can be, right? 0,1,2,3 so why is it called 2bit? 

2 bits is likr saying 2 digits

 

2 digits = 100 numbers in decimal

2 bits = 4 numbers in binary

Link to comment
Share on other sites

Link to post
Share on other sites

@Nicnac

 

Signed / unsigned

A signed binary number uses its most significant bit (MSB) to decide whether or not the number is positive or negative

 

For example:

010 = +2, because the MSB (highlighted in bold) is a 0

1110 = -6, because the MSB is a 1 signifying the number is negative.

 

Signed binary numbers, have a reduced range of numbers they can represent, because that 1st bit is used to signify sign and not a value.

e.g. an 8 bit binary integer using 2s complement, has a range of  -(2n-1 )  to +2n-1 -1, 10000000 = -128, 01111111 = +127

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Unsigned binary numbers are just standard binary integers

 

For example:

1010 = 10

0001 = 1

 

Unsigned binary numbers have a range of 2n - 1, where n is the number of bits. e.g. an 8 bit integer has a range of zero to 2- 1 = 255, represented by 11111111.

============================================================================================================

Floating Point

 

gets a bit complicated depending on the system you use (single, double etc.), check out the link below for a UK A-level explanation, which does a better job that I could of explaining it simply! :D

 

http://www.teach-ict.com/as_as_computing/ocr/H447/F453/3_3_4/floating_point/miniweb/pg6.htm

 

 

 

 

Note: if anything above is incorrect drop me a note.

Link to comment
Share on other sites

Link to post
Share on other sites

Number are stored in a computer in 2 formats, integer (fixed point) and floating point. The bitness refers to the number of binary digits used to represent it. Ie a 32 bit integer uses 32 binary digits. An unsigned integer is a whole number that can only represent positive values. A 32 bit, unsigned integer can represent whole numbers from 0 to +4294967295. 

 

The problem with them is that you can only represent postive numbers. So we can also use a format called a signed integer. Signed integers can represent positive and negative values. The sign is stored in most significant bit, 0 meaning positive  and 1 being negative. A 32 bit signed integer can represent from  -2,147,483,648 to +2,147,483,648. 

,

To recapwith a 4bit, signed integer, +5 would be 0101 and - 5 would be 1011...

 

What, what? 

 

You see, the easy way would be to represent +5 as 0101 and - 5 as 1101.

Just the sign bit changes. 

But that representation has problems. For starters, when you look at all possible number combinations, you find that you actually lose 2 numbers. 

But there's a much more serious problem. Look at these 2 numbers, 0000 and 1000. If we consider them to be signed, we have +0 and -0.

 

And thats a NIGHTMARE for hardware design. So instead, we use a notation called 2's complement. 

With 2s complement, we NOT every bit of a number and add 1 to get its opposite. 

That's why +5 is 0101 and - 5 is 1011. 

An added benefit is that we can perform subtraction on signed integers by adding the opposite of one of the operands. 

 

Now let's look at floating point numbers. 

Floating point numbers let you represent non-integers, postive and negative. 

In principle, you can store stuff like +5.1 ; - 13.0 ; 0.000053 or +5368258, all with the same format. 

The format is called ieee 754

download.png.a2c5b088b65502250f905ce4e311aa78.png

 

The precise layout changes a bit depending on the size (16 bit fp16, 32 bit fp32, fp64 etc), bit here's how it works. 

 

Floating point numbers work a lot like scientific notation. 

In effect, 0.1 can be represented as 10^-1, 0.4 can be represented as 4*10^-1 etc. All this except in binary. Tom scott did a nice video on it

 The sign bit in ieee 754 is pretty self explanatory, but the "exponent" is the significant figures, and the "mantissa" is the power the exponent is brought to. 

 

The mantissa is actually represented as an unsigned integer. To store small numbers, however, it needs to be negative. 

 

For reasons of speed, we don't use 2s complement for it. Instead, we use whats called biasing. An 8 bit unsigned integer can hold 0 to +255.

If we bias it, however, we consider that anything under +127 should be considered as negative. Thus, a mantiasa of 0 is treated like a - 127. 

 

Here you go. 

 

I'm confused how you where able to do c++ without knowing at least some of it, however, as it is pretty low level as far as high level languages go... 

 

AMD Ryzen R7 1700 (3.8ghz) w/ NH-D14, EVGA RTX 2080 XC (stock), 4*4GB DDR4 3000MT/s RAM, Gigabyte AB350-Gaming-3 MB, CX750M PSU, 1.5TB SDD + 7TB HDD, Phanteks enthoo pro case

Link to comment
Share on other sites

Link to post
Share on other sites

Don’t worry about the nitty gritty of what’s going on behind the scenes. Just know the large picture, programmers need not care how complier does thing like heap, stack, or how digital circuitry work.

Sudo make me a sandwich 

Link to comment
Share on other sites

Link to post
Share on other sites

-moved to programming-

Solve your own audio issues  |  First Steps with RPi 3  |  Humidity & Condensation  |  Sleep & Hibernation  |  Overclocking RAM  |  Making Backups  |  Displays  |  4K / 8K / 16K / etc.  |  Do I need 80+ Platinum?

If you can read this you're using the wrong theme.  You can change it at the bottom.

Link to comment
Share on other sites

Link to post
Share on other sites

On ‎2‎/‎3‎/‎2018 at 7:41 AM, TheCarbonPhoenix said:

e.g. an 8 bit binary integer using 2s complement, has a range of  -(2n-1 )  to +2n-1 -1, 10000000 = -128, 01111111 = +127

only -128 to 127 if you are assigning 0 to be a neg value

0 is neutral

so you get 127 neg and 127 pos and 1 neutral =255 values with power off state(needs no bits at all)for 256 options

Link to comment
Share on other sites

Link to post
Share on other sites

14 hours ago, wasab said:

Don’t worry about the nitty gritty of what’s going on behind the scenes. Just know the large picture, programmers need not care how complier does thing like heap, stack, or how digital circuitry work.

That depends on what kind of programmer you are. Some low level programmers have to write all the platforms and tools that your high level systems run on so you "don't need to worry about the nitty gritty". Perhaps the OP wants to learn about the low level so he can decide if that is the domain he likes to work in or not ?

 

One would also expect of any programmer to actually be interested in the "nitty gritty". Not being so comes across as if you're not really interested in the subject and doing the job against your will, barely doing the least necessary to scrape by. I'm pretty sure you won't get very far that way.

 

And off course, the day will inevitably come when all your high level models fail and your software does not behave they way you think it should have because some low level implementation details can not be obscured at the high level. Issues like false sharing, branch predictor misses and cache behavior totally breaking theoretical performance models come to mind.

 

That aside, basic concepts like how binary numbers work are relevant at all levels.

 

3 hours ago, bcguru9384 said:

only -128 to 127 if you are assigning 0 to be a neg value

0 is neutral

so you get 127 neg and 127 pos and 1 neutral =255 values with power off state(needs no bits at all)for 256 options

-128 to 127 is the norm for 8 bit signed.

128 negative numbers + 127 positive numbers + 1 zero = 256 combinations, which fits exactly 8 bits.

Link to comment
Share on other sites

Link to post
Share on other sites

4 hours ago, Unimportant said:

That depends on what kind of programmer you are. Some low level programmers have to write all the platforms and tools that your high level systems run on so you "don't need to worry about the nitty gritty". Perhaps the OP wants to learn about the low level so he can decide if that is the domain he likes to work in or not ?

 

One would also expect of any programmer to actually be interested in the "nitty gritty". Not being so comes across as if you're not really interested in the subject and doing the job against your will, barely doing the least necessary to scrape by. I'm pretty sure you won't get very far that way.

 

And off course, the day will inevitably come when all your high level models fail and your software does not behave they way you think it should have because some low level implementation details can not be obscured at the high level. Issues like false sharing, branch predictor misses and cache behavior totally breaking theoretical performance models come to mind.

 

That aside, basic concepts like how binary numbers work are relevant at all levels.

 

-128 to 127 is the norm for 8 bit signed.

128 negative numbers + 127 positive numbers + 1 zero = 256 combinations, which fits exactly 8 bits.

Most programmers would just use the tools created by others rather than reinvent the wheel. That’s why I say don’t worry about nitty and gritty of things. 

Sudo make me a sandwich 

Link to comment
Share on other sites

Link to post
Share on other sites

20 hours ago, wasab said:

Don’t worry about the nitty gritty of what’s going on behind the scenes. Just know the large picture, programmers need not care how complier does thing like heap, stack, or how digital circuitry work.

@Unimportant beat me to it, but I would like to add some very specific cases: In all computer science/software engineering/computer engineering courses ever you will take these classes:

  1. Digital Devices
    • Learn about how digital circuitry works
  2. Data Structures
    • Learn about things like stacks, trees (which includes heaps), linked lists...

Beyond that, the introduction to programming II course at my uni touched on linked lists, trees, and stacks. Those three data sets are very fundamental to how useful computer programs work. 

And yes, it's also important to understand those concepts from the perspective of the compiler/runtime. For example, a developer who uses python to make a recursive Fibonacci number generator (a very beginner oriented task) and proceeds to try to use it to find the Nth Fibonacci number where N is greater than 1000 might find that he or she continually gets "Maximum Recursion Depth Error" which is really just a "Stack Overflow Error".

Or, for example, an intermediate developer experimenting with .NET Garbage Collection might naively think that one could keep track of objects by storing an ObjectIdGenerator with the appropriate keys, while simultaneously letting the object(s) the developer is tracking fall out of scope (such that they might get collected). He or she would be surprised, however, to find out that this method of finding out if an object survives a garbage collection will never work. If the developer does not understand the basic concepts of Garbage Collection, he or she will never be able to figure out why it doesn't work. 

Another beginner example would be the developer who is getting OutOfMemory exceptions when allocating large arrays. The developer who does not understand how arrays work under the hood (which is very closely linked with processor addressing modes) will never be able to figure out why this is happening. 

Is it important for a developer to be good enough to write a compiler/runtime for a modern language? Absolutely not.
Is it important, however, for a developer to be good enough to understand how the runtime will handle his or her objects? Absolutely.

ENCRYPTION IS NOT A CRIME

Link to comment
Share on other sites

Link to post
Share on other sites

1 hour ago, straight_stewie said:

@Unimportant beat me to it, but I would like to add some very specific cases: In all computer science/software engineering/computer engineering courses ever you will take these classes:

  1. Digital Devices
    • Learn about how digital circuitry works
  2. Data Structures
    • Learn about things like stacks, trees (which includes heaps), linked lists...

Beyond that, the introduction to programming II course at my uni touched on linked lists, trees, and stacks. Those three data sets are very fundamental to how useful computer programs work. 

And yes, it's also important to understand those concepts from the perspective of the compiler/runtime. For example, a developer who uses python to make a recursive Fibonacci number generator (a very beginner oriented task) and proceeds to try to use it to find the Nth Fibonacci number where N is greater than 1000 might find that he or she continually gets "Maximum Recursion Depth Error" which is really just a "Stack Overflow Error".

Or, for example, an intermediate developer experimenting with .NET Garbage Collection might naively think that one could keep track of objects by storing an ObjectIdGenerator with the appropriate keys, while simultaneously letting the object(s) the developer is tracking fall out of scope (such that they might get collected). He or she would be surprised, however, to find out that this method of finding out if an object survives a garbage collection will never work. If the developer does not understand the basic concepts of Garbage Collection, he or she will never be able to figure out why it doesn't work. 

Another beginner example would be the developer who is getting OutOfMemory exceptions when allocating large arrays. The developer who does not understand how arrays work under the hood (which is very closely linked with processor addressing modes) will never be able to figure out why this is happening. 

Is it important for a developer to be good enough to write a compiler/runtime for a modern language? Absolutely not.
Is it important, however, for a developer to be good enough to understand how the runtime will handle his or her objects? Absolutely.

I know many professional self taught programmers who are not educated on the theoretical side but code so much better than most recent computer science graduates. Really, many of these college educated simply can NOT code. 

 

You can obviously see this by looking at the 2016 developer survey in which 44% of the employeed full time developer answer they either have no college degrees or studied something completely unrelated in college like psychology(e.g. mark zurkenberg)

 

Bottom line knowledge in theory is a plus but it is not a skill nor will it compensate for a lack of skill. Coding skills can be attain without understanding the underlying theory just like you do not need to understand wind theory, rotation torque of a wheel, static fiction on the rubber and pavement, and ect to understand how to ride a bicycle.

 

But do note that big employers like NASA and google still will require a degree because it would be a terrible idea to tell others that a guy without a degree is managing their multi billion dollar banking system regardless if the person is competent at the job or not. If you are a researcher, theory is a must have no question. Regular programmers do noy require them as much as you think.

Edited by wasab
Stupid autocorrect

Sudo make me a sandwich 

Link to comment
Share on other sites

Link to post
Share on other sites

1 hour ago, wasab said:

I know many professional self taught programmers who are not educated on the theoretical side but code so much better than most recent computer science graduates. Really, many of these college educated simply can NOT code. 

 

You can obviously see this by looking at the 2016 developer survey in which 44% of the employeed full time developer answer they either have no college degrees or studied something completely unrelated in college like psychology(e.g. mark zurkenberg)

 

Bottom line knowledge in theory is a plus but it is not a skill nor will it compensate for a lack of skill. Coding skills can be attain without understanding the underlying theory just like you do not need to understand wind theory, rotation torque of a wheel, static fiction on the rubber and pavement, and ect to understand how to ride a bicycle.

 

But do note that big employers like NASA and google still will require a degree because it would be a terrible idea to tell others that a guy without a degree is managing their multi billion dollar banking system regardless if the person is competent at the job or not. If you are a researcher, theory is a must have no question. Regular programmers do noy require them as much as you think.

This has nothing to do with being self-taught or college educated, nor skill.

Not everything about the low level machine can be abstracted away, and even the abstractions depend on certain basic knowledge. We're not talking chiseling your own logic gates in a slab of silicon here, but basic concepts about how every computer works.

 

You will be surprised at how much any of those successful self-taught programmers know about the basic operation of the system, probably much more then you think. It automatically comes with the territory because you cannot avoid it forever for any non-trivial program. The real underlying system will bite you in the ass eventually and you'll have to investigate, before you know it you're down the rabbit hole.

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, Unimportant said:

This has nothing to do with being self-taught or college educated, nor skill.

Not everything about the low level machine can be abstracted away, and even the abstractions depend on certain basic knowledge. We're not talking chiseling your own logic gates in a slab of silicon here, but basic concepts about how every computer works.

 

You will be surprised at how much any of those successful self-taught programmers know about the basic operation of the system, probably much more then you think. It automatically comes with the territory because you cannot avoid it forever for any non-trivial program.

i did say what i posted is relevant to programmer, not those who worked inside a circuit lab. 

Sudo make me a sandwich 

Link to comment
Share on other sites

Link to post
Share on other sites

6 hours ago, wasab said:

Bottom line knowledge in theory is a plus but it is not a skill nor will it compensate for a lack of skill. Coding skills can be attain without understanding the underlying theory just like you do not need to understand wind theory, rotation torque of a wheel, static fiction on the rubber and pavement, and ect to understand how to ride a bicycle.

Your analogy is faulty. If we were discussing the difference between the user (the bicycle rider) and the developer (the bicycle) engineer, then it would work. Writing a computer program necessarily means you are engineering software. If you do it any other way then you are either a beginner or incompetent, even if you can hide that incompetency behind the libraries of others.

To put this in more concrete terms relating to computer science, one does not need to understand how to write an array in assembly to use an array in C#. But one should understand that an array requires a contiguous block of memory to hold it, and what effect that might have on choosing between an array and a linked list. 

To put the above example in terms that you can understand: A bicycle rider probably doesn't need to know how to make a tire, but he should atleast understand why skinny smooth street tires go on street bikes and fat knobby tires go on mountain bikes, and why it will cause problems if it's done the other way around. 

But you are correct, nothing can compensate for incompetency. If you are incompetent, then you are incompetent, period. However, one could argue (and quite correctly) that the entire practice of writing computer programs is an exercise in applying theory.

ENCRYPTION IS NOT A CRIME

Link to comment
Share on other sites

Link to post
Share on other sites

1 hour ago, straight_stewie said:

Your analogy is faulty. If we were discussing the difference between the user (the bicycle rider) and the developer (the bicycle) engineer, then it would work. Writing a computer program necessarily means you are engineering software. If you do it any other way then you are either a beginner or incompetent, even if you can hide that incompetency behind the libraries of others.

To put this in more concrete terms relating to computer science, one does not need to understand how to write an array in assembly to use an array in C#. But one should understand that an array requires a contiguous block of memory to hold it, and what effect that might have on choosing between an array and a linked list. 

To put the above example in terms that you can understand: A bicycle rider probably doesn't need to know how to make a tire, but he should atleast understand why skinny smooth street tires go on street bikes and fat knobby tires go on mountain bikes, and why it will cause problems if it's done the other way around. 

But you are correct, nothing can compensate for incompetency. If you are incompetent, then you are incompetent, period. However, one could argue (and quite correctly) that the entire practice of writing computer programs is an exercise in applying theory.

My point is that a car mechanic does not need 4 years worth of mechanical engineering education to fix a car and neither should a computer programmer. Vice verse is true, an electrical engineer with 4 year education might not necessarily know how to fix your light bulb nor will a computer engineering students know how to fix your laptop's broken screen.

 

Most programmers are using the tools to create, they are not there to reinvent the wheel like writing their own kernel, compiler, designing their own programming languages, their own APIs, and their game engines from scratch ect. 

Sudo make me a sandwich 

Link to comment
Share on other sites

Link to post
Share on other sites

4 minutes ago, wasab said:

Most programmers are using the tools to create, they are not there to reinvent the wheel like writing their own kernel, compiler, designing their own programming languages, their own APIs, and their game engines from scratch ect. 

There is a big jump between knowing why a large array will sometimes result in out of memory errors and making an operating system or defining a formal language.

Your comment about APIs perplexes me, however. Pretty much the entire process of designing a new object (class) is deciding on what public members are necessary to interact with that object. In other words, when you design a class, you are really designing the API of that class, and then you will add any hidden functionality necessary to implement that API. 

Your comments are nonsensical. You're essentially trying to compare knowing how an array works to designing a processor with which you can make an array, and then telling us that we are wrong for telling the OP how signed numbers work because "he shouldn't have to be concerned with that", but that's precisely what he asked when he asked:

On 2/3/2018 at 6:50 AM, Nicnac said:

So can one of you geeks please explain to me in simple words (pretend i am a 13 year old  Actually pretend I am a 10 year old, lol) the whole concept of "bit-ness" like signed/unsigned integers and floating points?

 

ENCRYPTION IS NOT A CRIME

Link to comment
Share on other sites

Link to post
Share on other sites

34 minutes ago, straight_stewie said:

There is a big jump between knowing why a large array will sometimes result in out of memory errors and making an operating system or defining a formal language.

Your comment about APIs perplexes me, however. Pretty much the entire process of designing a new object (class) is deciding on what public members are necessary to interact with that object. In other words, when you design a class, you are really designing the API of that class, and then you will add any hidden functionality necessary to implement that API. 

Your comments are nonsensical. You're essentially trying to compare knowing how an array works to designing a processor with which you can make an array, and then telling us that we are wrong for telling the OP how signed numbers work because "he shouldn't have to be concerned with that", but that's precisely what he asked when he asked:

 

by API i meant you dont need to manually code your own when there are so many universally used APIs already built in, case point, gui. why would anyone wish to write their own gui APIs on java when there are already universally used JavaFX or swing for example.

 

This is like someone making their own writing utensil instead of simply purchasing a pen from a store. 

 

And if you are using an alredy existing api, why should you worry how about vector functions or those nitty gritty math that are used by these gui apis? Do you understand what i mean?

 

also, the kid is obviously interested in programming rather than just asking a technical question otherwise he wouldnt be posting in the programming subforum

 

In this day and age, many programmers are not even discriminant about the usage of a pointer vs that of a reference within a local scope. Some even stupidly leave global variables public, disregarding encapsulation for the sake of convenience. Pointing out potential misuse of array vs a list is hardly the worst ive seen.

Edited by wasab
Did not finish

Sudo make me a sandwich 

Link to comment
Share on other sites

Link to post
Share on other sites

1 hour ago, wasab said:

by API i meant you dont need to manually code your own when there are so many universally used APIs already built in, case point, gui. why would anyone wish to write their own gui APIs on java when there are already universally used JavaFX or swing for example.

All an API is is the public interface that you use to interact with a program. For example:

 

public class Program
{
  static void Main[]()
  {
    Console.WriteLine(Example.bar(3, 4, 5) + Example.kungfu(6, 7, 8));
    Console.ReadLine();
  }
}

public static class Example
{
  private int foo(int x, int y) => return x + y;
  
  public int bar(int x, int y, int z) => return z * foo(x, y);
  public int kungfu(int x, inty, int z) => return x * foo(y, z);
}


We have an object Example. This object contains methods foo, bar, and kungfu. However, the Public API for Example is only bar and kungfu. Programmers interact with bar and kungfu. 

And at it's core, that's all an API is. In OOP, the act of creating an object necessitates the act of creating an API.

 



BTW, it's everything I can do to not rip you up over your clear overconfidence in your lack of any kind of knowledge in the subject. For goodness sake, you can't even separate an example from the point.

There are three stages of learning:

  1. The stage where you know nothing but think you know everything.
  2. The stage where you know some, and realize how little you know.
  3. The stage where you know everything but think you know nothing.

ENCRYPTION IS NOT A CRIME

Link to comment
Share on other sites

Link to post
Share on other sites

1 hour ago, straight_stewie said:

All an API is is the public interface that you use to interact with a program. For example:

 


public class Program
{
  static void Main[]()
  {
    Console.WriteLine(Example.bar(3, 4, 5) + Example.kungfu(6, 7, 8));
    Console.ReadLine();
  }
}

public static class Example
{
  private int foo(int x, int y) => return x + y;
  
  public int bar(int x, int y, int z) => return z * foo(x, y);
  public int kungfu(int x, inty, int z) => return x * foo(y, z);
}


We have an object Example. This object contains methods foo, bar, and kungfu. However, the Public API for Example is only bar and kungfu. Programmers interact with bar and kungfu. 

And at it's core, that's all an API is. In OOP, the act of creating an object necessitates the act of creating an API.

 



BTW, it's everything I can do to not rip you up over your clear overconfidence in your lack of any kind of knowledge in the subject. For goodness sake, you can't even separate an example from the point.

There are three stages of learning:

  1. The stage where you know nothing but think you know everything.
  2. The stage where you know some, and realize how little you know.
  3. The stage where you know everything but think you know nothing.

I know what an api is. I am telling you no one will invent their own collections of libraries and framework if one already existed for a particular needs. Do you reverse engineer and write your own gorahics api if you want to code your graphics?

 

 

also you condescendingly accusing me of ignorance isn’t helping your argument in any shape or form.

 

Edit: never mind, you seem to know that api can exist without oop. You are still not understanding that I meant apis as those that already exist to solve our needs, as collections and frameworks. Not you inventing the wheels and creating your own for everything elementary and low level like GUI creation and everything in between.

Edited by wasab
Mentioned above

Sudo make me a sandwich 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×