Computer Hope

Software => Computer programming => Topic started by: Mikky004 on May 19, 2017, 06:09:39 AM

Title: What is most complicated language?
Post by: Mikky004 on May 19, 2017, 06:09:39 AM
Hi Guys,
I have one important question and need prompt and detailed answered please.
What is most complicated language?
Thanks in advance.
Title: Re: What is most complicated language?
Post by: Computer Hope Admin on May 19, 2017, 06:39:07 AM
Your question really all depends on the programmer. One of my favorite languages is Perl (https://www.computerhope.com/jargon/p/perl.htm) that many people consider a very complicated language. However, after programming in Perl for 10+ years I find it quite enjoyable. However, to answer your question I'd believe that for most people a language like assembly (https://www.computerhope.com/jargon/a/al.htm) would be the most complicated language because you're giving the computer low-level machine instructions instead of easy to remember commands or functions like "print."
Title: Re: What is most complicated language?
Post by: BC_Programmer on May 19, 2017, 07:44:30 AM
Do you mean the most complicated programming language or the programming language that is the most complicated to program in?

For example, Assembly as a language is simple. Programming in Assembly is complicated.
Title: Re: What is most complicated language?
Post by: Geek-9pm on May 19, 2017, 09:21:31 AM
...For example, Assembly as a language is simple. Programming in Assembly is complicated.
I wanted to say that.  :)
Title: Re: What is most complicated language?
Post by: DaveLembke on May 19, 2017, 10:08:54 AM
As far as programming languages go and complicated vs easy. I feel the other factor to consider is, have you ever programmed before to know how to structure a program and reuse of objects etc if object oriented programming, and flow charts to write down how you want your program to function and then be able to then code the logic etc.

Is there a certain program or game that you want to make that one language might be better than another should also be considered in addition to complexity! I got into C++ back in college 20 years ago because I was told it was the language to be in on if you want to make video games. Very quickly I learned how extremely hard it is to make cool games in C++ and even calling to bitmap image files takes considerable work in C++ for gaming which i thought would have been the easy way out of having to generate every pixel to have predetermined screens for each case and then screen transition for each possible combination of a game play to make something that looked good since I could make something really graphically pretty with Adobe Photoshop etc and save it as bitmap images etc which C++ had support for. I aborted that project, and instead went to HTML and Javascript for the game to be pretty and run through a browser vs run in its own window. Then Flash Games came along and HTML & Javascript games were meh and stopped making games with HTML & Javascript to be played for free online and never got into Adobe Flash game creation.  :-\

My dream out of college was to be a Game Programmer / Developer... but it didnt come to be because I gave up on it when hitting that painful wall with C++ trying to make graphically appealing Video Games and instead said well what else can I do... well I can use my skills for System Admin MIS/IT and I am very good at making programs to test and automate stuff and generate reports etc so went that route.


Also with programming .... What is easy to me might be hard for you and vice versa etc, so this is to be considered in reading this.

Computer Hope Admin stated:
Quote
One of my favorite languages is Perl that many people consider a very complicated language. However, after programming in Perl for 10+ years I find it quite enjoyable.

I learned Perl about 12 years ago through Virtual University online and I found it not difficult and actually liked its structure as well as cross platform compatible ease ( Windows/Linux ) as well as it has some very powerful features to it that can be coded up with a few lines of code that in other languages would take far more lines of code. Perl is one of my favorites for something I want that is quick and down and dirty console ( DOS Shell type execution area ) based programming. Perl also is handled through an interpreter as a scripting language so no time wasted compiling, as its compiled when executed as a scripting language by interpreter. As long as the system your on has Perl support ( a Perl interpreter ) it will run that Perl program with the .pl extension etc.

Python is a language that I have been messing around with more and more. It also supports cross platform.

Languages & Scripting Languages I have learned & used over the last 30 years are: Basic, QBasic, Visual Basic ( back in the days of VB6 years ago ), C, C++, C#, Perl, PHP, JaveScript, and more recently Python. Of all of these I would say C++ has given me the most difficulty; yet I have a liking to that language and use it a lot.

Pretty much if I want something that I will compile as an exe to run on a number of systems I will use C++. If I just want to program something up very fast down and dirty I then use Perl to run it on a system that has Active Perl community edition installed on it. https://www.activestate.com/activeperl?gclid=CJn8lt-l_NMCFY-PswoddxUH6w   Perl can be used for server side program execution such as on a web server to serve up dynamic info, but I use it mainly for workstation use within console window. Additionally it supports system calls the same as C++ and so instead of reinventing the wheel, i can perform system calls to other programs etc and have a Rube Goldberg program that works perfect, but instead of having to create the code to perform certain functions, I can perform calls in DOS from within the program to do something and then the program then able to use that info generated from the system call which called for another program to perform instruction with switches etc, and then pick back up in the Perl program where it left off similar to how Batch is, but with far fewer restrictions of Batch alone etc.

Years ago I played with x86 Assembly about 20 years ago and lost interest in it and went back to C and C++ since I didnt need to create my own boot loaders etc. If I needed an OS to bundle with code, Linux was free so why reinvent the wheel etc. It was easier programming for systems that already had operating systems etc, so I lost interest in it.  https://en.wikibooks.org/wiki/X86_Assembly/Introduction

Lastly 99.9% of my programs are for myself. They dont need to be pretty, they just need to work, so I tend to blend a mix and match of stuff together that gets the job done many times and avoid reinventing wheels when i can borrow use of someone elses wheel and not waste time coding up my own when I legally have access to this other one that is built into Windows OS for example etc. I would rate myself as intermediate programmer but not a master of any one language. I still make plenty of mistakes and learn from them.  ;D
Title: Re: What is most complicated language?
Post by: BC_Programmer on May 19, 2017, 10:53:36 AM
Actually, I just realized, I actually have an entire series of blog posts comparing  the same algorithm implemented in various programming languages. While it is not a perfect comparison- obviously I'm not going to have come up with a perfect implementation in most (if any) of the languages, it could serve at least as a good metric by which to consider which languages are easier to read, more expressive, and/or more powerful. (There isn't an Assembly implementation, though....)

The Program to be made is an anagram listing program. Taking a list of words (I used the Linux dict file, "D:\dict.txt") it shows a list of all anagrams. This is done by sorting the letters of each word and putting the word into a bucket for each sorted arrangement.

I don't want to blogspam so I'll copy-paste the code samples themselves, but the original Post in the series can be found here (http://bc-programming.com/blogs/2012/09/programming-language-performance-part-i-overview/) and each entry has some "discussion" and observations about each language's implementation. There are a lot of examples of different languages so I think it fits quite well here in terms of comparing programming language complexity  (regardless of what definition we aim to look at). I actually ran out of languages I make examples in- Last one I tried was rust, but didn't make much headway. (I actually wouldn't mind suggestions for other languages I could do the same, the series hasn't had a new entry in years!)

Python:

Code: [Select]
import time
#create empty Hashmap.
anag_dict = {}
#start the timer
startc = time.clock()
#iterate through all the lines in the file.
with open("D:\dict.txt", "rt") as words_fp:
    for line in words_fp:
#lowercase the word.
        word = line.lower()
#create the key by sorting the letters in the word.
        key = "".join(sorted(word))
        #if the given key is not present, initialize that key with a new empty list.
        if not key in anag_dict:
            anag_dict[key] = []
        #add this word to the appropriate list.
        anag_dict[key].append(word)
#print the execution time.
endc = time.clock()
print("time:", endc-startc)


C#

Code: [Select]
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.IO;
namespace anagramsx
{
    class Program
    {
        private static IEnumerable<String> readlines(String filename)
        {
            return new StreamReader(filename).ReadToEnd().ToLower().Split('\n');
 
        }
        static String sortchars(String sumstring)
        {
            List<char> sortme = sumstring.ToList();
            sortme.Sort((a, b) => a.CompareTo(b));
            return new string(sortme.ToArray());
 
        }
 
        static void Main(string[] args)
        {
            const string readfile = "D:\\dict.txt";
            Dictionary<String, List<String>> anagrams = new Dictionary<string, List<string>>();
            DateTime starttime = DateTime.Now;
            foreach (String line in readlines(readfile))
            {
                String sorted = sortchars(line);
                if (!anagrams.ContainsKey(sorted))
                    anagrams.Add(sorted, new List<string>());
                anagrams[sorted].Add(line);
            }
            Console.WriteLine("Time:" + (DateTime.Now-starttime).TotalSeconds.ToString() + " Seconds.");
        }
    }
}

Java (Not Javascript Dave, heh)

Code: [Select]
import java.io.*;
public class anagram {
 
public static void sortchars(char[] sortvalues)
{
for(int x = 0;x<sortvalues.length;x++){

for(int y=x+1;y<sortvalues.length;y++){
if(sortvalues[x] < sortvalues[y]){

char temp = sortvalues[x];
sortvalues[x]=sortvalues[y];
sortvalues[y] = temp;
}
}
}
}
public static String sortstring(String sortstring){
char[] stringchars = new char[sortstring.length()];
sortstring.getChars(0,sortstring.length(),stringchars,0);
sortchars(stringchars);
return new String(stringchars);
}
 
public static void main(String[] args) {
final String filename = "D:\\dict.txt";
//HashMap we use to store and sort out anagrams.
try {
    HashMap<String,List<String>> anagrams = new HashMap<String,List<String>>();

    long starttime = System.currentTimeMillis();
    Scanner sc = new Scanner(new File(filename));
    while(sc.hasNext()){
String readline = sc.nextLine();
String sorted = sortstring(readline);
if(!anagrams.containsKey(sorted))
anagrams.put(sorted, new LinkedList<String>());

List<String> addto = anagrams.get(sorted);
addto.add(readline);

    }
    long endtime = System.currentTimeMillis();
    System.out.println(endtime-starttime);
}
catch(FileNotFoundException exx){

System.out.println("File not found.");
}
}
}

Scala

Code: [Select]
import scala.collection.mutable
import java.util
//sorting implementation
def ssort(xs:List[Char]):List[Char] =
    if (xs.isEmpty) Nil
    else insert(xs.head,ssort(xs.tail))
 
def insert(x:Char,xs : List[Char]):List[Char] =
    if(xs.isEmpty || x <= xs.head) x :: xs
    else xs.head :: insert(x,xs.tail)
 
val starttime = java.lang.System.currentTimeMillis()
val dictfile = "D:\\dict.txt"
var anagrams = new scala.collection.mutable.HashMap[String,List[String]]
for(line <- Source.fromFile(dictfile).getLines())
{
    var charray = line.toCharArray().toList
    var sorted = java.lang.String.valueOf(ssort(charray).toArray)
    //map contains x checks if key exists.
    if (!(anagrams contains sorted))
    anagrams+= (sorted -> List(line));
    else
{
        var grabbed = anagrams(sorted);
        var appended = line :: grabbed
anagrams(sorted) = appended;
}
}
 
val executionspeed= java.lang.System.currentTimeMillis()-starttime;
println("Execution took " + executionspeed);

F#

Code: [Select]
open System.IO
open System.Collections.Generic
open System.Linq
let dict = "D:\\dict.txt"
let fstream = new StreamReader(new FileStream(dict,FileMode.Open))
let anagrams = new Dictionary<String,List<String>>()
 
[<EntryPoint>]
let main (args : string[]) =
 
    let start = DateTime.Now
    let grablines = fstream.ReadToEnd().Split('\n')
    for grabline in grablines do
       
        let grabchars = grabline.ToCharArray().ToList()
        grabchars.Sort()
        let sorted = new String(grabchars.ToArray())
        if not (anagrams.ContainsKey(sorted)) then
            anagrams.Add(sorted,new List<String>())
       
        anagrams.Item(sorted).Add(grabline)
       
     
       
    let totaltime = DateTime.Now - start
    Console.WriteLine("Execution time:" + totaltime.TotalSeconds.ToString() + " seconds");
    Console.ReadKey()
    0

Ruby

Code: [Select]
startt = Time.now
anagrams=Hash.new(nil)
File.foreach("D:\\dict.txt") do |word|
    if not word === "" then
sorted = word.split('').sort.join()
if anagrams[sorted]==nil
    anagrams[sorted] = [word]
else
anagrams[sorted] << word
end
end
end
result = Time.now-startt
puts result

Perl (file pumped in via standard input)
Code: [Select]
#!/usr/bin/perl -w
use strict;
use Time::HiRes;
my %words = ();

my $start = Time::HiRes::gettimeofday();

while(<>) {
chomp;

$_ = lc $_;
my $windex = pack "C*",
   sort unpack "C*", $_;
if (exists $words{$windex}) {
        next if $words{$windex} =~ /\b$_\b/;
        $words{$windex} .= " ";
    }
    $words{$windex} .= $_;
}
print Time::HiRes::gettimeofday() - $start;


Delphi

Code: [Select]

{$APPTYPE CONSOLE}
 
{$R *.res}
 
 
uses
  System.SysUtils,Generics.Collections,classes,TimeSpan;
var
  anagrams : TDictionary<String,TList<String>>;
  dictfile : TStreamReader;
  lineread : String;
  sortedword : String;
  starttime : Integer;
{Functions used for this prog}
function StringtoArray(Input:String):TList<char>;
  var
  newarray:TList<char>;
    I: Integer;
  begin
      newarray := TList<char>.Create();
      for I := 0 to length(Input) do
        begin
        newarray.Add(Input[I]);
 
        end;
        result:=newarray;
end;
 
function ArraytoString(Input :TList<char>):String;
var
newstring : String;
  I: Integer;
begin
    for I := 0 to Input.Count-1 do
    begin
      newstring := newstring + Input.Items[I];
    end;
 
    result:=newstring;
 
 
end;
function GetTickCount () : Integer; stdcall; external 'kernel32' name 'GetTickCount'  ;
 
function SortString(Input:String):String;
  var
    Charlist : TList<char>;
 
  begin
    Charlist := StringtoArray(Input);
    Charlist.Sort();
    result := ArraytoString(Charlist);
 
 
 
end;
 
begin
  try
     anagrams := TDictionary<String,TList<String>>.Create(200000);
     dictfile := TStreamReader.Create('D:\dict.txt');
 
     starttime:=GetTickCount();
     while not dictfile.EndOfStream do
     begin
         LineRead := dictfile.ReadLine();
         SortedWord := SortString(LineRead);
         if not anagrams.ContainsKey(SortedWord) then
             anagrams.Add(SortedWord,TList<String>.Create());
 
         anagrams.Items[SortedWord].Add(LineRead);
 
     end;
 
     writeln(GetTickCount()-starttime);
     readln;
    { TODO -oUser -cConsole Main : Insert code here }
  except
    on E: Exception do
      Writeln(E.ClassName, ': ', E.Message);
  end;
end.

PHP

Code: [Select]

error_reporting(-1);
 
//timing start...
$mtime = microtime();
$mtime = explode(" ",$mtime);
$mtime = $mtime[1] + $mtime[0];
$starttime = $mtime;
$anagrams = array();
$processedcount=0;
//open dictionary file...
 
$lines = file("D:\\dict.txt", FILE_IGNORE_NEW_LINES);
//iterate through each line.
foreach($lines as $line){
   $processcount++;
   $word = strtolower($line);
   //split the word into each character.
   $letters = str_split($word);
   //sort the letters...
   sort($letters);
   //implode to a new string, and use that as a index into the associative array.
   $sorted = implode('',$letters);
   //determine if this sorted item already exists.
   if($anagrams[$sorted]==null){
       $anagrams[$sorted] = array($word);
   }else{
array_push($anagrams[$sorted],$word);

   }
}
 
$mtime = microtime();
$mtime = explode(" ",$mtime);
$mtime = $mtime[1] + $mtime[0];
$endtime = $mtime;
$totaltime = ($endtime - $starttime);
echo $processedcount + " processed in ". $totaltime . "seconds\n";
echo $anagrams[50];
 

C++

Code: [Select]
#include <string>
#include <algorithm>
#include <vector>
#include <hash_map>
#include <iostream>
#include <fstream>
#include <ctime>
using namespace std;
 
//function for sorting a word.
string sortword(string word){
string sortedword = word;
sort(sortedword.begin(),sortedword.end());
return sortedword;
}
int _tmain(int argc, _TCHAR* argv[])
{
//hash_map<string, int> yeah;
hash_map<string,vector<string>> WordHash;
 
string line;
ifstream myfile;
myfile.open("D:\\dict.txt");
cout << "processing..." << endl;
clock_t startTime = clock();
while(myfile.good()){
getline(myfile,line);
string sortedword = sortword(line);
WordHash[sortedword].push_back(line);
}
cout << double( clock() - startTime ) / (double)CLOCKS_PER_SEC<< " seconds." << endl;
cout << "Finished." << endl;
cout << "processed " << WordHash.size() << " entries.";
int test;
cin >> test;
 
}

Haskell

Code: [Select]
import Control.Monad (liftM)
import Data.Function (on)
import Data.List (sort, sortBy)
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
main = do
    input <- liftM B.lines B.getContents
    let wordMap = buildMap $ map B.unpack input
    print $ listAnagrams wordMap
buildMap words = let
    entries = map (\x -> (sort x, [x])) words
    in Map.fromListWith (++) entries
listAnagrams wordMap = let
    anagrams = (Map.elems . Map.filter (\x -> length x > 1)) wordMap
    in sortBy (flip (compare `on` length)) anagrams

D

Code: [Select]
import std.stdio, std.string,std.algorithm,std.stream,std.datetime;

char[] sortstr(char[] src)
{
return src.dup.sort;
}
void main()
{
    //declare the associative array...
    string[][string] anagrams; //Associative array of string arrays indexed by a string.
    std.stream.File f = new std.stream.File();
    //Open the dictionary word file.
    f.open("D:\\dict.txt");
    int wordcount=0;
    StopWatch sw;
    sw.start();
    while(!f.eof()) {
    char[] gotline = f.readLine();
    immutable(char)[] sorted = cast(string)sortstr(gotline);
    anagrams[sorted]~=cast(string)gotline;
    wordcount++;
      }
      f.close();
    sw.stop();
        writeln("wordcount:", wordcount);
        writeln("executiontime:",cast(Duration)(sw.peek()));
}

VB.NET

Code: [Select]
Option Strict On
Option Explicit On
Imports System.IO
Imports System.Text
Imports System.Collections.Generic

Module anagrams

    'Anagrams Application
    'entry into Anagrams Performance/language comparisons.
 Private Function readlines(Filename As String) As IEnumerable(Of String)
        Dim nl As Char = CChar(Environment.NewLine)
        Return New StreamReader(Filename).ReadToEnd().ToLower().Split(nl)
    End Function
    Public Function SortChars(sumString As String) As String
        Dim sortme = sumString.ToList()
        sortme.Sort(Function(ca, cb) ca.CompareTo(cb))
        Return New String(sortme.ToArray())
    End Function
    Sub Main(Args As String())

        Dim Anagrams As New Dictionary(Of String, List(Of String))
        Dim usefilename As String = "D:\dict.txt"
        Dim StartTime = Now

        For Each LineRead In readlines(usefilename)
            'get sorted version.
            Dim SortedVersion = SortChars(LineRead)
            If Not Anagrams.ContainsKey(SortedVersion) Then
                Anagrams.Add(SortedVersion, New List(Of String))
            End If
            Anagrams(SortedVersion).Add(LineRead)

        Next
        Dim Duration = Now - StartTime


        Console.WriteLine("Calculation Time:" & Duration.ToString())
        Console.ReadKey()
    End Sub

End Module

These all effectively accomplish the same task. Some are easier to read, some are longer, some are shorter, etc. I think the ruby implementation is the easiest to make sense of, myself; It's very short and largely straightforward. Scala and Haskell can be tricky for somebody familiar with Imperative programming to make sense of. It is also hard for somebody who wrote it 5 years ago to have any clue whatsoever as to how it works or what it is doing at a glance, despite it being quite short.
Title: Re: What is most complicated language?
Post by: DaveLembke on May 19, 2017, 01:28:58 PM
Quote
Java (Not Javascript Dave, heh)
  ;D
Title: Re: What is most complicated language?
Post by: Geek-9pm on May 19, 2017, 02:11:48 PM
Perhaps the OP is looking into becoming a Computer Specialist, and the question is just one step toward a career goal.
Here is a relevant t quote for anybody going into serious computer study:

Quote
The Unix philosophy

Computer scientists should be comfortable with and practiced in the Unix philosophy of computing.

The Unix philosophy (as opposed to Unix itself) is one that emphasizes linguistic abstraction and composition in order to effect computation.

In practice, this means becoming comfortable with the notion of command-line computing, text-file configuration and IDE-less software development.
Source:
http://matt.might.net/articles/what-cs-majors-should-know/
Title: Re: What is most complicated language?
Post by: josephdfox5 on April 04, 2019, 11:14:14 AM
Mandarin Chinese
Interestingly, the hardest language to learn is also the most widely spoken native language in the world. Mandarin Chinese is challenging for a number of reasons. First and foremost, the writing system is extremely difficult for English speakers (and anyone else) accustomed to the Latin alphabet.
Title: Re: What is most complicated language?
Post by: Salmon Trout on April 04, 2019, 12:03:58 PM
I think APL is complicated. You need either a special keyboard or little labels.

(https://images2.imgbox.com/96/53/O59FcexU_o.jpg)

Title: Re: What is most complicated language?
Post by: Geek-9pm on April 04, 2019, 01:20:37 PM
...
For example, Assembly as a language is simple. Programming in Assembly is complicated.
I wanted to say that.  ;D

My first real job was in 8080 assembly on a Intel workstation. It took hours   just do do a little bit of something that should be simple.

But there was less than 100 instructions you might need to memorize in 8080 code.
Title: Re: What is most complicated language?
Post by: Salmon Trout on April 04, 2019, 01:40:09 PM
the same algorithm implemented in various programming languages.

I think Rosetta Code is quite interesting.

Quote
Rosetta Code is a programming chrestomathy site. The idea is to present solutions to the same task in as many different languages as possible, to demonstrate how languages are similar and different, and to aid a person with a grounding in one approach to a problem in learning another. Rosetta Code currently has 931 tasks, 224 draft tasks, and is aware of 722 languages, though we do not (and cannot) have solutions to every task in every language.

http://www.rosettacode.org/wiki/Rosetta_Code

Quote
chrestomathy
NOUN
formal
A selection of passages from an author or authors, designed to help in learning a language.

Title: Re: What is most complicated language?
Post by: Geek-9pm on November 09, 2019, 05:17:35 PM
This is an old post.
But, for what it is worth...
The Worst and Hardest Programming Languages to Avoid Like the Plague (https://www.makeuseof.com/tag/worst-programming-languages/)
Quote
Some languages are easier for beginners to learn. Others are most useful for the future. And others are most likely to help you land a programming job.
In this article, we’ll approach it from the opposite end: Which programming languages should you avoid?
Put another way, if it gives you a good income, don't cal it bad.
Two are well know:
  PHP
  JavaScript


Then he goes on to say...
Quote
For a beginner, any programming language is hard, and you should spend time learning the fundamentals of programming before worrying too much about what language to choose.
True.  :)





Title: Re: What is most complicated language?
Post by: mukunad on April 24, 2020, 12:42:07 PM
I started with C and that time it was like Alien language to me. But i got good with time. For me programming in Assembly language is tough.