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!

  • fubo@lemmy.world
    link
    fedilink
    arrow-up
    95
    arrow-down
    1
    ·
    edit-2
    2 years ago

    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.

      • losttourist@kbin.social
        link
        fedilink
        arrow-up
        11
        ·
        2 years ago

        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.

        • TheLemming@feddit.de
          link
          fedilink
          arrow-up
          1
          ·
          2 years 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

    • JTskulk@lemmy.world
      link
      fedilink
      arrow-up
      2
      arrow-down
      1
      ·
      2 years ago

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

      • fubo@lemmy.world
        link
        fedilink
        arrow-up
        2
        ·
        2 years ago

        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.

        • JTskulk@lemmy.world
          link
          fedilink
          English
          arrow-up
          1
          ·
          2 years ago

          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.

          • fubo@lemmy.world
            link
            fedilink
            arrow-up
            1
            ·
            2 years ago

            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.)

  • CombatWombatEsq@lemmy.world
    link
    fedilink
    arrow-up
    31
    ·
    2 years 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.

    • dual_sport_dork 🐧🗡️@lemmy.world
      link
      fedilink
      arrow-up
      15
      ·
      2 years ago

      The other thing is that on modern platforms, decomplied code can and will be ludicrously complex and probably rely on several levels’ worth of abstraction layers, external libraries, API’s, and sandboxes provided by the OS or whatever other platform it’s meant to run on. Outside of microcontrollers and some embedded applications, the days are long gone where you just have relatively simple machine code running directly on the bare metal of the computer’s processor and unprotected memory.

  • donuts@kbin.social
    link
    fedilink
    arrow-up
    10
    ·
    edit-2
    2 years 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.

      • donuts@kbin.social
        link
        fedilink
        arrow-up
        6
        ·
        edit-2
        2 years ago

        Some programs are distributed as “scripts” (in a scripting language like BASIC, BASH, Python, JavaScript, Lua, etc) which are stored on your computer in human-readable form and only converted into CPU machine code when you run the program, through an “interpreter” program.

        Of course, everything boils down to binary machine code in the end, because those CPU instructions are the only language that your CPU actually works with.

      • BlameThePeacock@lemmy.ca
        link
        fedilink
        arrow-up
        3
        ·
        2 years ago

        There are some programs (especially on Linux) where they don’t distribute compiled binaries and you just download and compile the source code yourself to be able to use the software. This can be because of legal reasons, technological reasons, or even just because a developer wants to be very transparent in what’s being run on your machine.

        This is especially common with software alphas (either for new software, or for testing updates to existing software) where they just don’t bother compiling it for every type of system when it’s really just for use by a handful of developers while they’re actively working on or testing the code.

  • amio@kbin.social
    link
    fedilink
    arrow-up
    8
    ·
    2 years 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.

  • Blaze (he/him)@sopuli.xyz
    link
    fedilink
    arrow-up
    7
    arrow-down
    1
    ·
    2 years ago

    Try to inspect the code of any Microsoft program you have installed. You cannot, because you only have the executable, not the source code itself.

  • grue@lemmy.world
    link
    fedilink
    arrow-up
    6
    ·
    2 years ago

    Take a look at the definition of “Free Software”:

    A program is free software if the program’s users have the four essential freedoms:

    • The freedom to run the program as you wish, for any purpose (freedom 0).
    • The freedom to study how the program works, and change it so it does your computing as you wish (freedom 1). Access to the source code is a precondition for this.
    • The freedom to redistribute copies so you can help others (freedom 2).
    • The freedom to distribute copies of your modified versions to others (freedom 3). By doing this you can give the whole community a chance to benefit from your changes. Access to the source code is a precondition for this.

    The term “open source” has a more corporate-friendly connotation, but the freedoms it entails are the same.

  • JackbyDev@programming.dev
    link
    fedilink
    arrow-up
    6
    ·
    2 years 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.

  • rickdgray@lemmy.world
    link
    fedilink
    arrow-up
    5
    ·
    2 years ago

    Imagine getting a can of purple paint and trying to figure out exactly how much red and blue dye was used to make that exact purple. Now imagine doing that every few lines of code in a code base of say 10k lines. That’s basically how decompilation goes. It’s extremely hard and even if you’re able to figure it all out, it’s still impossible to ever know what was actually originally written.

    What you’re describing though does have done truth to it. There was a time when you could get a program from a magazine, type it all in to your commodore 64, and then it would run a pacman clone. These, line python today, are not compiled. So to have the program means to have the code too.

  • jbrains@sh.itjust.works
    link
    fedilink
    arrow-up
    4
    ·
    2 years ago

    Although it’s possible to inspect the code of an installed application, that’s not the kind of code you’re probably thinking of. In many cases, the code that you can inspect is code that’s very hard to understand. You can learn about the difference between “machine code” and “high-level programming languages” to understand why you probably won’t be able to do anything of value with the code that you can inspect.

    Even if you can inspect it, you can’t change it. (You could, but it would be very very difficult.)

    Even if you can change it, that doesn’t make it Open Source, for reasons that others have already described.

    One place where you can often inspect the source code is in a web browser. That’s still not Open Source, but it’s closer to source code and largely available to inspect.

    Best wishes with your interest in learning to program!

  • SubArcticTundra@lemmy.ml
    link
    fedilink
    arrow-up
    2
    ·
    2 years ago

    Web pages are one of the easiest things to inspect the code of. If you press Ctrl+U or F12 you can see the web page’s code directly. Some pages’ code is purposefully scrambled to keep you from doing this though.

  • fidodo@lemmy.world
    link
    fedilink
    arrow-up
    2
    ·
    edit-2
    2 years ago

    Source code is called source because it’s the original verbose code that gets transformed through a compiler. The compiler output can be machine code which are special numbers the computer can interpret as instructions or minified code so the file size is smaller or even a totally different language through transcompilation. In all cases the source code is what was maintained by a human and is the original source of truth, while compiled code is transformed by a computer and it’s either condensed which makes it hard to read and loses informational context, or it’s transformed automatically which may not be as clean or idiomatic. Source code can have multiple compile targets so if you were to modify compiled code to change its behavior it would be very hard to collaborate or distribute those changes since it would only apply to one target. The source code is important because it’s easier to understand and it’s more organized and it’s a common source of truth that multiple developers can collaborate on.

  • Kissaki@feddit.de
    link
    fedilink
    English
    arrow-up
    1
    ·
    edit-2
    2 years ago

    Executable code inspection is not reading source.

    If you read Javascript Code, it’s readable as Text. But even then, it may have been transformed from a readable source with speaking names and structure to an obfuscated mess that works the same, may be more performant, but is not human readable. It’s not the source, so it can’t reasonably be called open source.

    If it’s not transformed it is though.

    Different languages have different transformations. Most programs you install are compiled to transformed data. The text source is readable. The transformed result is not. Tooling may help inspecting or seeing parts, or trying to recreate the source, but it’s not the source.

    • GustavoM@lemmy.world
      link
      fedilink
      arrow-up
      2
      ·
      2 years ago

      Don’t know why folks are downvoting you… but you aren’t wrong.

      Then again, its not like reverse engineering is a easy feat in a way even your mom can do it.