ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Other Software > Developer's Corner

Your First Programming Language vs Now

(1/5) > >>

wraith808:
In the thread Syntax in Different Programming Languages, I quoted this:

One of my best classes in college was a class called The Organization of Programming Languages.  It was taught by someone who was giving back time as a professional in the industry, rather than a professor.  Many years later, it is one of the only ones that sticks in my mind and that I use.  I've gone from and to many different languages - Pascal to VB to C to C++ to Delphi to C# (and I currently dabble in a few others).  The syntax has never been the problem.  You can always find syntax.  It's the data structures and memory management and such that are always the sticking point.  If you can get those, you can rapidly move from one language to another with a minimum of difficulty.
-wraith808 (March 03, 2015, 07:19 PM)
--- End quote ---

I came across that thread recently, and equated it to a thread on a different board, and figured I'd pose an exercise here.


* What was your first programming language? 
* Can you remember a snippet from that language? 
* What's your current language of choice? 
* How would you rewrite that snippet in your current language?
My Answers are:


* AppleBasic
* Yes
* C#
* Yes

--- Code: Visual Basic ---10 PRINT CHR(21): DIM CARDS(52),CHECK(52)20 SUIT$ = "CDHS"30 N$ = IA23456789TJQK"40 FOR S = 0 TO 3: FOR C = 1 TO 13:CARD(C + S * 13) = MID$ (N$,C,1) + MID$ (SUIT$,S + 1,1): NEXT: NEXT45 TEXT: HOME : NORMAL50 FOR X = 1 TO 5255 XX = X - 1: VTAB 1 + XX - INT (XX / 13) * 13: HTAB 1 + 10 * INT (XX / 13)60 PRINT SPC( X < 10);X;I:";70 N = INT ( RND (1) * 52) + 180 IF CHECK(N) THEN 7090 CHECK(N) = 1100 INVERSE: PRINT CARD$(N);105 NORMAL: PRINT SPC( 5)110 NEXT X
One of the interesting things about AppleBASIC is that you can have multiple commands on the same line.  Trying to put this into c# wasn't as easy as I thought.  There's still a bug somewhere in my code, and I know it looks messy, but I didn't want to put too much time into this.


--- Code: C# ---"\n".Dump();string[] cards = new string[52];int[] check = new int[52];const string SUIT = "CDHS";string N = "IA23456789TJQK";Random rnd = new Random(); for (int S = 0; S  < 3; S ++){        for (int C = 1; C < 13; C++)        {                cards[C + S * 13] = Microsoft.VisualBasic.Strings.Mid (N,C,1) + Microsoft.VisualBasic.Strings.Mid (SUIT,S + 1,1);        }} for (int X = 1; X < 52; X++){        check[X] = 0;} for (int X = 1; X < 52; X++){        int cardPos;        while (1==1)        {                cardPos = rnd.Next(52);                if (check[cardPos] == 0)                {                        check[cardPos] = 1;                        cards[cardPos].Dump();                        break;                }        }}
It runs, and pulls the shuffled cards- but there are nulls in there for some reason.  I also skipped over the formatting code, as I wasn't going to try to do that in the console.

Anyone else want to take a stab?

ConstanceJill:
    How would you rewrite that snippet in your current language?
[…]
    Yes
-wraith808 (June 12, 2017, 10:09 PM)
--- End quote ---
O_o?

mouser:
My first language was BASIC, learned from some wonderful books and coded on a Cromemco Z-2D in the late 1970s.
The biggest shift for me was moving from non object-oriented programming language to an object-oriented programming (OOP) language... I feel like OOP was such a revolution in terms of changing the way I think of code and organization of ideas, that it has had broad ramification in my entire thinking pattern outside of programming..

This is the computer game programming book that really motivated me:
https://www.amazon.com/BASIC-Computer-Games-Microcomputer-David/dp/0894800523

anandcoral:
I too started in Basic, i.e. Basic in MS Dos 2.0. Got BASICA in Dos 3.0 then GWBasic and so on. For job I had to learn dBase III but I used the logic of Basic to create my first program in dBase III.

Now working in Xbase++, upgraded from FoxPro, my mind still works in Basic and converts the codes in required language :)

Regards,

Anand

x16wda:
Basic was pretty universal as a learning language back in the day. My first PC was a Timex Sinclair ZX81 which was cool but limiting - and I think the whole language was snippets. :P Upgraded to an Atari 400 and started playing with 6502 coding, then an Atari ST and 68000. By then I was a systems programmer on a mainframe so I started doing some assembly on that beast (IEFBR14, anyone?) but mostly building user interface stuff for ISPF in Clist and Rexx  :Thmbsup:. These days 95% of what I write is utilities in Rexx, since it runs everywhere. And trying to pick up a little Powershell because it does some really cool stuff too.

Navigation

[0] Message Index

[#] Next page

Go to full version