4.6.2.1 Classification of programming languages

Programming languages can be divided into 4 main generations

  1. First generation machine code
  2. Second generation assembly code
  3. Third generation "imperitive" language code
  4. Fourth level "declarative" language code

First Generation

# x86 Compliant "Hello World" program # (Ctrl+Click to follow link) # https://codegolf.stackexchange.com/a/5741

7F 45 4C 46 01 01 01 00 00 00 00 00 00 00 00 00 02 00 03 00 01 00 00 00 35 40 B3 04 2C 00 00 00 00 00 00 00 00 00 00 00 34 00 20 00 01 00 00 00 00 00 00 00 00 40 B3 04 B2 0C EB 1C 62 00 00 00 62 00 00 00 05 00 00 00 00 10 00 00 48 65 6C 6C 6F 20 77 6F 72 6C 64 0A B9 4C 40 B3 04 93 CD 80 EB FB

Second Generation

# x86 Compliant "Hello World" program # (Ctrl+Click to follow link) # https://codegolf.stackexchange.com/a/5741
        org     0x04B34000
        db      0x7F, "ELF", 1, 1, 1, 0 ; e_ident
        dd      0, 0
        dw      2                       ; e_type
        dw      3                       ; e_machine
        dd      1                       ; e_version
        dd      _start                  ; e_entry
        dd      phdr - $$               ; e_phoff
        dd      0                       ; e_shoff
        dd      0                       ; e_flags
        dw      0x34                    ; e_ehsize
        dw      0x20                    ; e_phentsize

phdr: dd 1 ; ephnum ; ptype ; eshentsize dd 0 ; eshnum ; poffset ; eshstrndx db 0 ; pvaddr _start: inc eax mov bl, 4 mov dl, 12 ; ppaddr jmp short part2 dd filesize ; pfilesz dd filesize ; pmemsz dd 5 ; pflags dd 0x1000 ; palign str: db 'Hello world', 10 part2: mov ecx, str again: xchg eax, ebx int 0x80 jmp short again filesize equ $ - $$

Third Generation

// Some random Java. // https://github.com/comp500/mkwii-presence-java

package link.infra.mkwiipresence;

import java.awt.EventQueue;

import javax.swing.JOptionPane; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException;

import link.infra.mkwiipresence.WiimmMessages.WiimmMessage; import link.infra.mkwiipresence.WiimmMessages.WiimmRoom;

public class MKWiiPresence { public PresenceSettings currentSettings = new PresenceSettings(); public MKWiiPresenceGUI guiInstance; public PresenceUpdater presenceUpdater;
public static void main(String[] args) { System.out.println("hi"); new MKWiiPresence(); }
public MKWiiPresence() { // is this a bad idea? MKWiiPresence reference = this; EventQueue.invokeLater(new Runnable() { public void run() { try { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) { e.printStackTrace(); } presenceUpdater = new PresenceUpdater(); guiInstance = new MKWiiPresenceGUI(reference); } catch (Exception e) { e.printStackTrace(); } } }); }
public void showError(Exception e) { e.printStackTrace(); JOptionPane.showMessageDialog(null, "Exception thrown: \n" + e.getMessage(), "There was a problem.", JOptionPane.ERRORMESSAGE); }
public boolean processResponse(String json) { WiimmMessage[] messages = WiimmMessages.deserialize(json); boolean wasUpdated = false; for (int i = 0; i < messages.length; i++) { System.out.println(messages[i].messageType); if (messages[i] instanceof WiimmRoom) { presenceUpdater.update(new PresenceMessage((WiimmRoom) messages[i], currentSettings)); wasUpdated = true; } } if (!wasUpdated) { // Update presence with previous (cached) info // TODO remove testing code //presenceUpdater.update(null); } return wasUpdated; }
public void setCurrentSettings(PresenceSettings settings) { this.currentSettings = settings; }
public void requestNewPresence() { if (currentSettings.friendCode != null && currentSettings.friendCode.length() == 14) { String friendCodeNumbers = currentSettings.friendCode.replace("-", ""); int playerId; try { long friendCode = Long.parseLong(friendCodeNumbers); playerId = WiimmRequester.convertFriendCodeToPID(friendCode); } catch (Exception e) { JOptionPane.showMessageDialog(null, "Invalid friend code", "There was a problem.", JOptionPane.ERROR
MESSAGE); return; } System.out.println(playerId); try { String json = WiimmRequester.requestRoomInfo(playerId); if (processResponse(json)) { // Set status to done } else { // Set status depending on whether cache was used/available } } catch (Exception e) { showError(e); } } else { JOptionPane.showMessageDialog(null, "Invalid friend code", "There was a problem.", JOptionPane.ERROR_MESSAGE); } } }

Fourth Generation

<html> <head> <title>My excellent website</title> </head> <body> <h1>My excellent website</h1> <p>I am the best person to ever live. Like ever.</p> </body> </html>