What programming language should I use


Ewww, somehow I ended up posting, repeatedly, in a thread about programming with a bunch of programmers. What was I thinking. :p
 
It is great to see that so many people went with assembly early on. 6502 is one of the options I would look at after c, but @spud42 mentioned 8088, and I have a machine I want to give more love, so that would be an option, or, more practically in the mainstream modern world, ARM, depending on what is going on with the Pyra (or it successor), and the community, or smartphones.
Assembly! I don't know 6502 assembly well, but I learned it enough to write simple programs in it, it helped me when making C64 cartridges. Assembly is mostly forgotten and removed from most IT teaching programs in may universities. If any is taught, it's ARM assembler, generally professors avoid Intel or older architectures, it's better to learn it with old books, codes and experiments than courses.

Reading about esoteric languages reminded me my SBF. I think that every computer geek thinks or was thinking about making an esolang. I made one about 15-20 years ago when we used Sun in a high school and we had access only to Pascal compiler there, with its poor string handling. These times I was thinking much about programs which can generate language-like text and I made a compiler to make such generators "easily". I probably have some notes somewhere, but for now I only remember that the code was like SQL mixed with COBOL (yet more, more divisions of different types), it had probabilistic jumps, probabilistic pointers (more ways to crash a program!), "workflow" type called FACILITY, and a magic SOURCE OF operator which was a memory-eating functional equivalent of COMEFROM instruction. And at least these "rats": -o>, =o> and ~o> for handling normal, probabilistic and optimizing pointers.
 
I'll put this githut link here. Interactive chart of active GIT repositories per language.

At the moment I recommend Laravel/PHP (similar to RubyOnRails framework) dogslow compared to Phalcon... but so easy and convenient to use...
 
Just break out QBasic/QuickBasic... In fact, wasn't there a modern rebuild of QBasic which used SDL and a C compiler? I'm sure there's a port for the Pandora too :)

Python bugs me by it's horrible use of indentation as code blocks.
 
Just break out QBasic/QuickBasic... In fact, wasn't there a modern rebuild of QBasic which used SDL and a C compiler? I'm sure there's a port for the Pandora too :)

Python bugs me by it's horrible use of indentation as code blocks.

Yep. I have ported a few games: http://repo.openpandora.org/?page=detail&app=remakes_qb_ptitseb and have explained how to use it on the Pandora

(And I agree with the indentation that is part of the language for python, I just hate that).
 
I'm rather a fan of indentation indicating code blocks: if I have to indent my code in C++ to make it readable, it's better in Python that I can do that and lose having to type all of those curly braces. It does seem a little messy in multiline strings (triple quoting) where you have to stop indenting for the middle lines else end up with spaces in your string, but I usually end up concatenating single line strings each on its own line to avoid that.
 
@levi: What about editors that automatically put the curly braces?
 
I'm rather a fan of indentation indicating code blocks: if I have to indent my code in C++ to make it readable, it's better in Python that I can do that and lose having to type all of those curly braces. It does seem a little messy in multiline strings (triple quoting) where you have to stop indenting for the middle lines else end up with spaces in your string, but I usually end up concatenating single line strings each on its own line to avoid that.
At least the braces are visible. There's been a few times where I've been working on source code, everything looks fine and nicely formatted, then I push to GitHub or something then see that some lines are indented with tabs and others spaces. It might seem odd, but I do use multiple computers, and sometimes I forget to configure the editor correctly.

I indent between braces anyway, so it'd look the same as python except for two extra lines with the braces, it's just I'm not reliant on those indents to say where my code block starts and ends.

I find it annoying that most Raspberry Pi libraries are Python based, as I don't think you can call Python libs from C
 
it's better in Python that I can do that and lose having to type all of those curly braces
the sole reason i learned python: no damn braces. that stuff drove me crazy during school (learning java). since i wanted to continue programming, but without that crap, i literally searched for "programming language without those godforsaken shit braces". have been a happy python user since :D i'm miffed everytime i need a switch case though (people recognize state machines easier when they're not huge if elses).
at work we use unreal engine 4's c++ (yuck, but engine recompiles are great for spontaneous company breakfasts! :p), at university i code in c# (yay, unity! no compile time breaks though), and on my pandora, i use python with pygame (old af, still got it though).

What about editors that automatically put the curly braces?
visual studio tends to put the things everywhere but where i want them. in some cases my cursor ends up in weird places too (although i'm not sure if that one's caused by one of our obscure plugins, or the fact that ue4 specific code is just weirding out all the automatic features).
 
Yes, editors that put in the braces could be a life saver, but then you have to understand all of the bracket conventions so you can pick the right one. Braces wars is another reason to avoid them if possible - having worked at a place that demanded whitesmiths style braces, skipping braces entirely by moving to python was a definite good thing.

Regarding state machines, you could also do it using objects if you like:
Code:
class StateOne(object):
    def transition(self):
        print("Transitioning from state one")
        return StateTwo()

class StateTwo(object):
    def transition(self):
        print("Transitioning from state two")
        return None

c=StateOne()
while c:
    c=c.transition()

I've not actually tested the above, but I think it should work in python 3 (if using python 2 you'll need to import print_statement from __future__ I think). It's probably a bit more verbose than doing it with if statements, but it keeps the cases nicely encapsulated if you want. Might get a bit messy if you need a lot of state variables or inputs it needs to check to transition though. You'd want a parent class for all of the states which takes a reference to all of the inputs, so you don't need to write the same constructor for every state class, and then whenever you return a new state copy the references from internal class storage into the new state object.
 
Last edited:
That should be print_function not print_statement. Print is a statement in python 2 and a function from python 3 onwards.
Code:
from __future__ import print_function
 
They're genuine actual programming languages, but definitely more on the academic programming theory side of things than anything that will actually get you a paying wage. If you're already getting paid for coding in something procedural, then learning the functional side of things can make your coding better, but I wouldn't start with it to be honest.
 
I've dipped my foot into C# and there is a big overlap with PowerShell. You see, they both inherit from .NET so many functions are from the same pool.
PowerShell got a big upgrade and with Windows Nano Servers (GUI-less) all you can do is connect through PowerShell (there is no Remote Desktop) or just add the server to a Management Console on another server that has a GUI.

note: It takes a while to understand the While/foreach loops in PowerShell, as they are not at all the same as Bash (normal Unix shells) because of Object Orientedness.

If you want to dip your toes into C, but do not want to compile, I recommend TCC (which compiles jit/on the fly. https://en.wikipedia.org/wiki/Tiny_C_Compiler)

Look at that nice hash-bang: Run from bash as if you would run a perl script:
Code:
#!/usr/bin/tcc -run

#include <stdio.h>

int increase(int num) {
    return num +1;
}

int main() {
  int var2 = 2;
  var2 = increase(var2);
  printf("%i\n", var2);
  return 0;
}
 
Back
Top