this post was submitted on 27 Jul 2023
5 points (77.8% liked)

No Stupid Questions

34964 readers
530 users here now

No such thing. Ask away!

!nostupidquestions is a community dedicated to being helpful and answering each others' questions on various topics.

The rules for posting and commenting, besides the rules defined here for lemmy.world, are as follows:

Rules (interactive)


Rule 1- All posts must be legitimate questions. All post titles must include a question.

All posts must be legitimate questions, and all post titles must include a question. Questions that are joke or trolling questions, memes, song lyrics as title, etc. are not allowed here. See Rule 6 for all exceptions.



Rule 2- Your question subject cannot be illegal or NSFW material.

Your question subject cannot be illegal or NSFW material. You will be warned first, banned second.



Rule 3- Do not seek mental, medical and professional help here.

Do not seek mental, medical and professional help here. Breaking this rule will not get you or your post removed, but it will put you at risk, and possibly in danger.



Rule 4- No self promotion or upvote-farming of any kind.

That's it.



Rule 5- No baiting or sealioning or promoting an agenda.

Questions which, instead of being of an innocuous nature, are specifically intended (based on reports and in the opinion of our crack moderation team) to bait users into ideological wars on charged political topics will be removed and the authors warned - or banned - depending on severity.



Rule 6- Regarding META posts and joke questions.

Provided it is about the community itself, you may post non-question posts using the [META] tag on your post title.

On fridays, you are allowed to post meme and troll questions, on the condition that it's in text format only, and conforms with our other rules. These posts MUST include the [NSQ Friday] tag in their title.

If you post a serious question on friday and are looking only for legitimate answers, then please include the [Serious] tag on your post. Irrelevant replies will then be removed by moderators.



Rule 7- You can't intentionally annoy, mock, or harass other members.

If you intentionally annoy, mock, harass, or discriminate against any individual member, you will be removed.

Likewise, if you are a member, sympathiser or a resemblant of a movement that is known to largely hate, mock, discriminate against, and/or want to take lives of a group of people, and you were provably vocal about your hate, then you will be banned on sight.



Rule 8- All comments should try to stay relevant to their parent content.



Rule 9- Reposts from other platforms are not allowed.

Let everyone have their own content.



Rule 10- Majority of bots aren't allowed to participate here.



Credits

Our breathtaking icon was bestowed upon us by @Cevilia!

The greatest banner of all time: by @TheOneWithTheHair!

founded 1 year ago
MODERATORS
 

I don't know (but wanna learn) programming, but, for example, can't you inspect the code of an app if it's installed?

(yeah this is kind of a stupid question.)

EDIT: Thanks for the clarification, guys!

all 16 comments
sorted by: hot top controversial new old
[–] [email protected] 3 points 1 year ago* (last edited 1 year ago) (2 children)

No.

First, "open source" doesn't just mean "you can read the source"; it means that you have rights to modify it and make new versions too.

Second, compiled programs (e.g. most programs you run on a phone or a desktop PC) do not have source available for you to read.

[–] [email protected] 1 points 1 year ago (1 children)

Open source means you can read the source, Free software means you can modify and redistribute.

[–] [email protected] 1 points 1 year ago (1 children)

Well, no.

The term "open source software" was specifically invented to refer to the same set of software licenses as "free software"; but with a different political angle.

Really. You can look it up.

[–] [email protected] 2 points 1 year ago (1 children)

I remember reading the opposite back in the day, that this is why RMS dislikes the term "open source" and prefers "Free software" as more descriptive. Open source refers to software where you can read the source, but the license it's under does not necessarily gaurantee freedom to the user.

[–] [email protected] 1 points 1 year ago (2 children)

The people who coined the term "open source software" disagree, though. They're allowed to be right about the use of their own term.

(And extensionally, the set of software licenses accepted as "open source" by the "open source" people, and the set accepted as "free software" by the "free software" people, are the same set of licenses. Both agree that Microsoft "Shared Source" is not in this set, for example.)

[–] [email protected] 1 points 1 year ago

I'll take your word for it :)

[–] [email protected] 0 points 1 year ago (2 children)

Ah, that makes sense, thanks for clarifying.

[–] [email protected] 2 points 1 year ago (1 children)

It's not a perfect analogy, but a good way to think about it if you're not a programmer is to say "why do we need recipes when we can just buy a product in the store and read the ingredients list".

Just because you know the ingredients, that doesn't mean you know how to put them together in the right order, in the right quantities, and using the correct processes to recreate the finished product.

[–] [email protected] 1 points 1 year ago

If a 5star chef is making a dish, I wouldn't know what they put in it anyways, so I think this analogy still works.

If they would show me the recipe/source code, I probs would be astonished, like "Oh yeah, now I can taste the $(whatever ingredient) in it!", but wouldn't be able to put it together like them

[–] [email protected] 1 points 1 year ago

Going into a little more detail:

There are plenty of ways to do open source, and the differences mostly come down to the license something is published under. Some licenses prohibit redistribution, while others restrict commercial use. One of the more popular permissive licenses is the GNU General Public License (or GPL for short). Which you can read up on over here.

Technically there's nothing stopping you from ignoring the terms of the license agreement and just doing whatever. Think "agreeing to the terms without actually reading them". While the licenses are usually proper grounds for legal action, it depends on the project and the resources associated wether actual legal action is within the realm of possibilities.

When it comes to "everything is open source", you're technically correct in the sense that you can reverse engineer everything and the amount of work you're willing to put in is the only limiting factor. Compiled code and techniques like code obfuscation and encryption will pose barriers, but they will not protect from someone determined to get in. In the same way a door lock will not protect you from someone who brings a blowtorch.

Some code is technically not open source, but is delivered in human-readable form. This is the case for things like websites and scripts in languages like python. Other software is compiled (pre-converted to specific instructions for your processor), and is delivered in binary, which is not particularly human-readable. But with the right tools even binary applications can be "decompiled" and converted into something slightly more closely resembling the original source code.

A great one liner from the YouTube channel Low-level Learning is "everything is open source if you can read assembly".

So, in summary: It depends how you look at it, generally speaking open source means that te source code is available for the public to see and that you're free to submit any suggestions or improvements to the code, no matter who you are. In practise the source code is sometimes visible (out of technical necessity or for troubleshooting purposes) even though the product is not open source, in which case the end user license agreement will likely contain a clause prohibiting you from doing anything with it.

[–] [email protected] 2 points 1 year ago

Kinda. What you're referring to is "decompilation", which is the process of taking the output of a compiler and trying to reverse-engineer the code that produced it. But decompiled code is really hard to read and modify, because it isn't what humans wrote, it's what the compiler translated it into, and that can have some unexpected changes than are mostly irreversible. And, since it's closed source, if you somehow manage to make a change, you can't re-release it -- you don't have the license to do so.

With open source, you see the same code as the maintainers, so it has the high-level programming concepts and good variable names, and you have permissions to fork and release your own version.

[–] [email protected] 2 points 1 year ago

Your computer's CPU doesn't understand human language or code, so programs are compiled from human-readable programming languages (like C++, Rust, etc.) into binary machine code. Machine code is basically just a bunch of CPU instructions and data that are formatted specifically for your CPU's architecture (depending on if it's x86, ARM, etc.).

Most of the time, when you install a program/app/game, you're only getting the compiled binary in your CPU's machine code, so you couldn't view the original "source code" without going through a complex process called "decompilation". And even then, you wouldn't have the legal rights to share or modify that code for others to use.

For something to be considered truly "open source", it not only makes the original source code available to the user, it also publishes that code under a license like the GPL which gives the user certain rights to use, copy, and/or modify the code.

[–] [email protected] 1 points 1 year ago

Expanding a bit on what others have said, for anybody who is further interested (simplified; this whole discussion could be pages and pages of explanation)

The code we write (source code), and the code that makes the machine do its thing (executable code) are usually very different, and there are other programs (some are compilers, others are interpreters, I'm sure there are others still) to help translate. Hopefully my examples and walkthrough below help illustrate what others have meant by their answers and gives some context on how we got to where we are, historically

At the bare metal/electricity flowing through a processor you're generally dealing with just sequences of 0s and 1s - usually called machine code. This sequence of "on" and "off" is the only thing hardware understands, but is really hard for humans, but it's all we had at first. A program saved as machine code is typically called a binary (for formattings sake, I added spaces between the bytes/groups of 8 bits/binary digits)

00111110 00000001 00000110 00000001 10000000 00100110 00000000 00101110 00000000 01110111

A while later, we started to develop a way of writing things in small key words with numerical values, and wrote a program that (simplified) would replace the key words with specific sequences of 0s and 1s. This is assembly code and the program that does the replacements is called an assembler. Assemblers are pretty straight forward and assembly is a close 1:1 translation to machine code; meaning you can convert between the two

LD A, 0x01
LD B, 0x01
ADD A,B
LD H, 0x00
LD L, 0x00
LD (HL), A

These forms of code are usually your executable codes. All the instructions to get the hardware to do its thing are there, but it takes expertise to pull out the higher level meanings

This kind of writing still gets tedious and there are a lot of common things that you'd do in assembly that you might want shortcuts for. Some features for organization got added to assembly, like being able to comment code, add labels, etc but the next big coding step forward was to create higher level languages that looked more like how we write math concepts. These languages typically get compiled, by a program called a compiler, into machine code, before the code can run. Compilers working with high level languages can detect a lot of things and do a lot of tricks to give you efficient machine code; it's not so 1:1

This kind of representation is what is generally "source code" and has a lot of semantic things that help with understandability

int main() {
  int result = 1+1;
}

There are some, very popular, high level languages now that don't get compiled into machine code. Instead an interpreter reads the high level language and interprets it line by line. These languages don't have a compilation step and usually don't result in a machine code file to run. You just run the interpreter pointing to the source directly. Proprietary code that's interpreted this way usually goes through a process called obfuscation/minimization. This takes something that looks like:

def postCommentAction(commentText, apiConnection) {
  apiConnection.connect()
  apiConnection.postComment(commentText, userInfo)
  apiConnection.close()
}

And turns it into:

def func_a(a,b){b.a();b.b(a,Z);b.c();}

It condenses things immensely, which helps performance/load times, and also makes it much less clear about what the code is doing. Just like assembly, all the necessary info is there to make it work, but the semantics are missing

So, to conclude - yes, you can inspect the raw instructions for any program and see what it's doing, but you're very likely going to be met with machine code (that you can turn into assembly) or minified scripts instead of the kind of source code that was used to create that program

[–] [email protected] 1 points 1 year ago

No. You're probably thinking of what people refer to as "source available" which means the source is there and technically no one can stop you from looking at it but you're not free to do whatever you want with it like you are open source stuff. It's sort of a bad terminology but it is less.loaded than "free" which can mean "free as in beer" or "free as in speech".

Somethings aren't even source available either. Just because you can reverse engineer something doesn't mean the source is available. Even JavaScript which is not compiled is not always considered source available. It is often minified and obfuscated in the browser. All variable names get replaced with junk.

In summary, open source refers to specifically to your rights to use software, not just your ability to see the source.

[–] [email protected] 1 points 1 year ago

No, for several reasons. First off, open source is open source (code), as opposed to peeking at the compiled machine code/bytecode/whatever, or actively reverse engineering it. At that point it's no longer the source. Depending on tech and compilers, code could be very hard to read once compiled. In many cases, any descriptive names and comments are history. Some people try to make it actively harder to figure out (obfuscation, DRM) on top of that.

After that, a lot of the principial difference comes from licensing and such, "open source" is usually differentiated from "source available" but where you can't really "legally" do anything with it other than look.