Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • October 22, 2017, 08:57 AM
  • Proudly celebrating 10 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Your First Programming Language vs Now  (Read 2260 times)

wraith808

  • Supporting Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 8,945
    • View Profile
    • Donate to Member
Your First Programming Language vs Now
« on: June 12, 2017, 10:09 PM »
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.

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 [Select]
  1. 10 PRINT CHR(21): DIM CARDS(52),CHECK(52)
  2. 20 SUIT$ = "CDHS"
  3. 30 N$ = IA23456789TJQK"
  4. 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: NEXT
  5. 45 TEXT: HOME : NORMAL
  6. 50 FOR X = 1 TO 52
  7. 55 XX = X - 1: VTAB 1 + XX - INT (XX / 13) * 13: HTAB 1 + 10 * INT (XX / 13)
  8. 60 PRINT SPC( X < 10);X;I:";
  9. 70 N = INT ( RND (1) * 52) + 1
  10. 80 IF CHECK(N) THEN 70
  11. 90 CHECK(N) = 1
  12. 100 INVERSE: PRINT CARD$(N);
  13. 105 NORMAL: PRINT SPC( 5)
  14. 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# [Select]
  1. "\n".Dump();
  2. string[] cards = new string[52];
  3. int[] check = new int[52];
  4. const string SUIT = "CDHS";
  5. string N = "IA23456789TJQK";
  6. Random rnd = new Random();
  7.  
  8. for (int S = 0; S  < 3; S ++)
  9. {
  10.         for (int C = 1; C < 13; C++)
  11.         {
  12.                 cards[C + S * 13] = Microsoft.VisualBasic.Strings.Mid (N,C,1) + Microsoft.VisualBasic.Strings.Mid (SUIT,S + 1,1);
  13.         }
  14. }
  15.  
  16. for (int X = 1; X < 52; X++)
  17. {
  18.         check[X] = 0;
  19. }
  20.  
  21. for (int X = 1; X < 52; X++)
  22. {
  23.         int cardPos;
  24.         while (1==1)
  25.         {
  26.                 cardPos = rnd.Next(52);
  27.                 if (check[cardPos] == 0)
  28.                 {
  29.                         check[cardPos] = 1;
  30.                         cards[cardPos].Dump();
  31.                         break;
  32.                 }
  33.         }
  34. }

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

  • Supporting Member
  • Joined in 2012
  • **
  • Posts: 103
    • View Profile
    • Donate to Member
Re: Your First Programming Language vs Now
« Reply #1 on: June 13, 2017, 12:07 AM »
    How would you rewrite that snippet in your current language?
[…]
    Yes
O_o?

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 37,495
    • View Profile
    • Donate to Member
Re: Your First Programming Language vs Now
« Reply #2 on: June 13, 2017, 01:40 AM »
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.c...-David/dp/0894800523
Screenshot - 7_17_2017 , 1_55_06 PM.png
« Last Edit: July 17, 2017, 01:52 PM by mouser »

anandcoral

  • Honorary Member
  • Joined in 2009
  • **
  • Posts: 473
    • View Profile
    • Donate to Member
Re: Your First Programming Language vs Now
« Reply #3 on: June 13, 2017, 02:11 AM »
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

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 701
    • View Profile
    • Donate to Member
Re: Your First Programming Language vs Now
« Reply #4 on: June 13, 2017, 05:42 AM »
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.

wraith808

  • Supporting Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 8,945
    • View Profile
    • Donate to Member
Re: Your First Programming Language vs Now
« Reply #5 on: June 13, 2017, 07:53 AM »
    How would you rewrite that snippet in your current language?
[…]
    Yes
O_o?

I would think that since the rest of the post is the actual doing of that, one could overlook that word's inclusion.  :P

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,525
    • View Profile
    • Donate to Member
Re: Your First Programming Language vs Now
« Reply #6 on: June 13, 2017, 11:28 AM »
My first programs were written in GWBasic.  The first one that was actually useful was just a console program with a menu to calculate how much of each ingredient to put in the mix to conjure up this hot glue we had to mix for test batches at the research lab where I worked.  You could put in the weight of any ingredient or the total weight you wanted to produce of the glue.  We were doing it using a calculator.  Fortunately the PC in work also had a 5 1/4" floppy so I could run my program.  It was just faster and more convenient to hit a menu number then type in an amount.  Since the ratios never changed I never had to update the code.

Then I did the QuickBasic 3.0 compiler before moving on to Turbo Pascal, C and assembler.  Eventually C became C++.  Most small hotkey type utilities now I do in AHK and/or AutoIt3.  Now and then I try to keep my hand in with something C++ to keep up on the language changes.

Ironically I tried the freeBasic compiler for a time.  It has so many compatibility modes to let you compile code be it comma function call style or with parens.  I had a hell of a time just making basic(no pun intended) WinAPI calls as I could not seem to get my head around the external declarations.  Just too frustrating.

My older brother worked for DEC and showed me a few things in Pascal.  At the time the conventional wisdom was "structured programming."  When OOP came out at first I thought it was no biggie.  Just another wrinkle added onto structured programming.  My brother thought it was a "scam" and dismissed it.  When I got the idea of OOP I convinced him it was not just some new jargon to sell new textbooks but had a lot of power.  When I gave a few hypotheticals how polymorphism could be applied he saw the potential and got into C++.

But I was never an application programmer.  I identify more with Leo LaPorte because he went through a similar journey.  He learned several programming languages including assembler just to learn how computers worked and write his own utilities.  But he never cranked out code for a living.


Deozaan

  • Charter Member
  • Joined in 2006
  • ***
  • Points: 1
  • Posts: 8,086
    • View Profile
    • Donate to Member
Re: Your First Programming Language vs Now
« Reply #7 on: June 19, 2017, 01:03 AM »
    How would you rewrite that snippet in your current language?
[…]
    Yes
O_o?
I would think that since the rest of the post is the actual doing of that, one could overlook that word's inclusion.  :P

Programmers aren't often in the habit of overlooking semantic details. In fact, they are highly trained to seek them out. This is how you bug-hunt.  :P

kyrathaba

  • N.A.N.Y. Organizer
  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 3,123
    • View Profile
    • Donate to Member
Re: Your First Programming Language vs Now
« Reply #8 on: July 15, 2017, 07:40 PM »
Started with QBasic, then some Pascal in college. Much later, Visual Basic 6.0. Later still, C#. Though I've dabbled with PHP and AutoIt, my go-to language is C#. My current project is a command-line utility that helps me track the progress of my paid proofreading projects.

 temp2.png

robinsleica

  • Participant
  • Joined in 2017
  • *
  • default avatar
  • Posts: 3
    • View Profile
    • Donate to Member
Re: Your First Programming Language vs Now
« Reply #9 on: July 17, 2017, 10:13 AM »
1.  C++
2. yes
3. I donno yet
4. Yes?

p3lb0x

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 402
    • View Profile
    • Donate to Member
Re: Your First Programming Language vs Now
« Reply #10 on: July 17, 2017, 10:33 AM »
What was your first programming language?
I think the first programming language I really did anything in was Lua for creating mods for the game Cortex Command.
Amounting to:

Eventually moved on to PHP for programming class in high school (and hating it immensely) and Assembly for the electronics class (though I used C for the final project)
This translated well into Assembly, then C, then C++ and C# at university.

Can you remember a snippet from that language?
Not really, I do dabble every now and then in Lua for various reasons (WoW interface mods being the latest IIRC)

What's your current language of choice?
I've become really partial to C# because of the convenience of having most common things handled for you through the .NET framework. And the syntax is pleasing to me. C++ is my bae, though.

How would you rewrite that snippet in your current language?
If I had to rewrite something similar to the Brolands mod in C# I would definitely take advantage of the OOP paradigm.
Here is the single file I had for pretty much all code used. Note uneven indentation, barely any refactoring of code blocks to functions and pointer being used instead of reference as Lua has no pointers.

Tuxman

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,899
    • View Profile
    • Donate to Member
Re: Your First Programming Language vs Now
« Reply #11 on: July 17, 2017, 01:44 PM »
1. What was your first programming language?

Given that "batch files" are not really "programming", it was either QBasic or Turbo Pascal. However, my memories of QBasic are (too) long gone, so I'll stick with Turbo Pascal. If I remember correctly, my short Visual Basic experiences were after that; or were they? Ah, growing old is not for sissies.

2. Can you remember a snippet from that language?

Does "Hello World" count?  ;D (I moved my focus to Delphi not much later, which was and still is "like Pascal" but different.)

3. What's your current language of choice?
4. How would you rewrite that snippet in your current language?


The one fascinating thing with these two questions is the assumption that there is exactly one language I'd choose for anything. Does anyone here really stick to one language?

Not counting my paid day job (which involves Java and C#), I write

  • web applications in C, C++, Python, Common Lisp, or (if I'm in a hurry or I need to maintain existing code) PHP
  • recurring server tasks in Perl, POSIX shell script, or Common Lisp
  • desktop applications in C or Delphi (I stopped caring for Electron), still maintaining older C++ applications though
  • other browser things in JavaScript because they force me to.

Next up (if I'll find some time in the next decade or so): x86 ASM and (more) COBOL.

Do you really need a "Hello World" in all these languages?  :huh:

Ath

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 3,039
    • View Profile
    • Donate to Member
Re: Your First Programming Language vs Now
« Reply #12 on: July 18, 2017, 02:44 AM »
Next up (if I'll find some time in the next decade or so): x86 ASM and (more) COBOL.
x86 ASM I can relate to, but Cobol... remember wat Edsger W. Dijkstra said about that: "The use of COBOL cripples the mind; its teaching should, therefore, be regarded as a criminal offense." (ref)
(And Yes, I do know how to program in Cobol and can confirm/confess that Edsger's quote is true)

Tuxman

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,899
    • View Profile
    • Donate to Member
Re: Your First Programming Language vs Now
« Reply #13 on: July 18, 2017, 02:49 AM »
COBOL is awesome for trolling people.  Assume a web application with bells and whistles and people want to see the source and it's all caps.  ;D

wraith808

  • Supporting Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 8,945
    • View Profile
    • Donate to Member
Re: Your First Programming Language vs Now
« Reply #14 on: July 18, 2017, 04:03 AM »
Next up (if I'll find some time in the next decade or so): x86 ASM and (more) COBOL.
x86 ASM I can relate to, but Cobol... remember wat Edsger W. Dijkstra said about that: "The use of COBOL cripples the mind; its teaching should, therefore, be regarded as a criminal offense." (ref)
(And Yes, I do know how to program in Cobol and can confirm/confess that Edsger's quote is true)

I also know how to program in COBOL.  It's not something I enjoyed or would do, but there are several people that don't feel the same way.  That statement is pure hyperbole, IMO.

app103

  • That scary taskbar girl
  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 5,720
    • View Profile
    • Donate to Member
Re: Your First Programming Language vs Now
« Reply #15 on: July 20, 2017, 02:06 PM »
1. Multi-user BASIC
2. I try very hard not to. It really gets in the way of learning and using other languages when your brain defaults to thinking in MuBASIC. I think the whole experience gave me a sort of brain damage that I am still trying to get over.
3. Object Pascal for desktop apps, a combo of things for web
4. I wouldn't. Most of what I did in that language was writing stuff to solve my algebra homework (high school CS teacher was also my algebra teacher, and she accepted the programs as a homework solution, and as extra credit in CS class, because you have to know how to solve the problems yourself, to be able to write programs that solve them). The only really useful thing I ever wrote in MuBASIC was a user friendly program for inexperienced, computer phobic teachers to use, to average student grades. If I were to do something like that today, it would be entirely different, and a much bigger project than it was back then.

Tuxman

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,899
    • View Profile
    • Donate to Member
Re: Your First Programming Language vs Now
« Reply #16 on: August 30, 2017, 08:45 AM »
Node.js is not even a language.

Ath

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 3,039
    • View Profile
    • Donate to Member
Re: Your First Programming Language vs Now
« Reply #17 on: August 30, 2017, 01:22 PM »
Node.js is not even a language.
And the jury still hasn't decided on the js part...

wraith808

  • Supporting Member
  • Joined in 2006
  • **
  • default avatar
  • Posts: 8,945
    • View Profile
    • Donate to Member
Re: Your First Programming Language vs Now
« Reply #18 on: August 30, 2017, 01:28 PM »
Node.js is not even a language.
And the jury still hasn't decided on the js part...

Can we be a little nicer on new member contributions?

hwtan

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 73
    • View Profile
    • Donate to Member
Re: Your First Programming Language vs Now
« Reply #19 on: September 28, 2017, 07:23 AM »
  • What was your first programming language?
BASIC running off the ROM of an IBM PC
  • Can you remember a snippet from that language?

10 PRINT "Hello World"
20 GOTO 10
  • What's your current language of choice?
Whatever gets the job done the quickest.

  • How would you rewrite that snippet in your current language?

while(1) printf("Hello World\n");


mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 37,495
    • View Profile
    • Donate to Member
Re: Your First Programming Language vs Now
« Reply #20 on: September 28, 2017, 09:25 AM »
Hi hwtan!!! Long time no see.  How have you been?