Author Topic: Programming Megathread  (Read 106217 times)

Welcome to this Programming Megathread!

WHAT IS PROGRAMMING?

Programming is one of the most important aspects of a Computer, because without Programming, Computers cant do much! By itself, Programming is a digitally written set of instructions that instructs the computer to do what the code tells the computer to do.

WHAT IS A COMPUTER?
A computer is in its base form is a calculator of instructions that perform an output based upon the Input and what happens to the input to become Output. Please refer to the Personal Computer Megathread for more! http://forum.blockland.us/index.php?topic=218177.0

GENERATIONS OF PROGRAMMING LANGUAGES
Programming Generations are simply a way to classify programming languages by complexity

Generation I: Machine Code. This code is very complex and is executed directly by the CPU to produce the specified output. Very hard to read and write with, but simple for a CPU to process

Generation II: Assembly Languages are low level languages more complex but requires a assembler to be useful. Each language is specific to an individual system.

Generation III: These languages are high level ones. Whereas Generation IIs are machine dependent, Generation IIIs are more programmer friendly and easier to write with. Examples are COBOL, Fortran, and more popular ones like Java, C++, BASIC, and Pascal.

Generation IV: These languages have narrower uses but are still common, like Database accessing. These languages are closer to human lanaguages than Generation IIIs.

Generation V: These languages are mostly used for Neural Networking and AI.

LIST OF COMMON LANGAUGES:
ASSEMBLY

BASIC
Code: [Select]
10 Cls
20 Print "Hello, world!"
30 Sleep
40 End

Bash (example code is a basic Bash Hello World script)
[code]
  #!/bin/bash          
          echo Hello World    
Batch / .BAT (example code shows a Hello World Script in a BAT file)
Code: [Select]
@ECHO off
ECHO Hello World!
PAUSE
C (Example code is a Hello World script)
Code: [Select]
//C hello world example
#include <stdio.h>
 
int main()
{
  printf("Hello world\n");
  return 0;
}
C++ (Again a Hello World Script)
Code: [Select]
// my first program in C++
#include <iostream>

int main()
{
  std::cout << "Hello World!";
}

C#
Code: [Select]
// Hello1.cs
public class Hello1
{
   public static void Main()
   {
      System.Console.WriteLine("Hello, World!");
   }
}
Clojure
Code: [Select]
(def hello (fn [] "Hello world"))
-> #'user/hello
(hello)
-> "Hello world"
COBOL
Code: [Select]
Identification Division.
   Program-ID. sampleCOBOL.

   Data Division.

   Procedure Division.
   Main-Paragraph.
       Display "Hello World!"
       Stop Run.

Java
Code: [Select]
public class HelloWorld {

    public static void main(String[] args) {
        // Prints "Hello, World" to the terminal window.
        System.out.println("Hello, World");
    }

}
Lua
Code: [Select]
   print("Hello World")
Javascript
Code: [Select]
console.log("Hello World!");
Perl
Code: [Select]
 #!/usr/bin/perl
  #
  # The traditional first program.

  # Strict and warnings are recommended.
  use strict;
  use warnings;

  # Print a message.
  print "Hello, World!\n";
PHP
Code: [Select]
<html>
 <head>
  <title>PHP Test</title>
 </head>
 <body>
 <?php echo '<p>Hello World</p>'?>
 </body>
</html>
Python
Code: [Select]
print('Hello world!')

Ruby
Code: [Select]
puts "Hello World"

SQL
Code: [Select]
SELECT * FROM Customers;
Code: (Haskell) [Select]
main = putStrLn "Hello World!"

Here's a quick implementation of quick sort just for fun:
Code: (Haskell) [Select]
quickSort :: (Ord a, Eq a) => [a] -> [a]
quickSort [] = []
quickSort (x:xs) = smallerList ++ [x] ++ largerList
     where smallerList = quickSort $ filter (<=x) xs
              largerList = quickSort $ filter (>x) xs
[/quote]

More to be added on request

Just what can programming do?
All sorts of things, from simple database querys to massive websites like Facebook to sattelite behaviour.
And as seen here, even functional Prototype AIs!
    https://youtu.be/UIWWLg4wLEY
CONTRIBUTIONS
Have something to add to the topic? Please post or PM me the content you want to add and Ill try and add to this post

Thanks for stopping by![/code]
« Last Edit: May 11, 2017, 08:11:23 PM by Becquerel »




https://youtu.be/UIWWLg4wLEY
Thats actually kinda cool!
Adding to OP under new category "Just what can programming do?"

Why do we need a megathread? Has there been so many programming discussions in Off Topic that you feel we need to combine them all here?

Why do we need a megathread? Has there been so many programming discussions in Off Topic that you feel we need to combine them all here?
i dont remember seeing any other programming threads

I prefer this kind of style

function helloWorld () {
    console.log('UGH');
}


to the examples you have in the OP
but it does depend on the language. in C or C++ I probably wouldn't stick the space between the function name and the (empty) argument list
however. I would NEVER put a space there in a function call because that is the most hideous thing in the entire planet earth

also your python example is python 2 (vomit)
replace it with this pls

print('Hello world!')

Thats actually kinda cool!
Adding to OP under new category "Just what can programming do?"

did you saw the part where the AI said it was going to put every human in a "human zoo"?


also your python example is python 2 (vomit)
replace it with this pls

print('Hello world!')
Will do

function helloWorld () {
    console.log('UGH');
}

I would NEVER put a space there in a function call because that is the most hideous thing in the entire planet earth
imo not having the open brace on its own line is hideous. I hate it so much; inhibits my ability to quickly scan code.

will C# code compile without a "using System;" at the beginning?

alsooo HTML isn't a programming language
imo not having the open brace on its own line is hideous. I hate it so much; inhibits my ability to quickly scan code.
I don't like it that way at all. idk why not ¯\_(ツ)_/¯

will C# code compile without a "using System;" at the beginning?
Yeah, all that does is prevent you from needing to qualify everything with "System."

alsooo HTML isn't a programming language
Damn, mustve studied the wrong stuff
Sorry about that, fixing now