silverwhisper's tags:
so i picked up a book on VBA yesterday morning to work in this project. it's going OK so far although i'm about to leave what little residual knowledge i possess and the book will soon be leaving the fundamentals.

but...

1. can someone please explain to me when line numbers became unnecessary in basic--in any form? i took a class or 2 on programming back in the 80s, when everything had line numbers (i was in high school at the time). did it go the way of the dodo with the switch to the GUI, or did other advances render it moot?

2. while i understand the purpose of variables being typed based upon the kind of characters they will store (e.g., number vs string), why in the hell do we use the word "string" to describe alphanumeric variables?

ed

del.icio.us Digg reddit StumbleUpon

Comments

  • lampshade said on Jan 05, 2008....
    I think line numbers went away when text editors got better.  When I first learned basic, you didn't really do it in a text editor.  You just typed a line number followed by the code for that line and hit enter.  You could enter them in any order.  When I did QBASIC in high school we did everything in the qbasic editor and I don't believe we had to write line numbers.  You could just go back and edit any line at any time, so there really as no need for them.

    As for strings, in mathematics a string is simply any sequence of symbols.  I don't know who chose that term but it sort of makes sense to me.
  • the_infernal_optimist said on Jan 05, 2008....
    I'm only competent in Java (and pretty minimally so there, if I'm being honest) and half-decent with stuff like javascript, and I have no freaking idea on strings. I wouldn't have chosen that word.

    And line numbers...heh...I wasn't programming in the 80s, and don't really have enough of a history with programming languages to say much of import there either.

    ~Infernal
  • bloc said on Jan 05, 2008....
    what are you using to write your code? Hopefully not notepad, and it should have a way to show line numbers on the side.
  • TinSoldier said on Jan 05, 2008....
    I prefer gvim myself...

    But it's an acquired taste.
  • moonriver said on Jan 05, 2008....
    ed -- in the old interpreted basic, line numbers were crucial in determining the sequence of program execution. in the present object-oriented VB environment (of which VBA is a subset), line numbers are totally unnecessary. VB has become like C or C++, only more, well, visually-oriented and designed for quick development.

    thus, my short answer is: object-oriented programming did away with line numbers.

    why "string"? well, it all started when old BASIC programs had to manage their limited memory resources quite strictly, and the ideal was if you could limit your alphanumeric variables to just a single character code, say, "A" to represent one option, "B" to represent another option, etc. but most BASIC programs needed to handle "stringed up" characters, so to speak, to form more user-intelligible words. thus evolved the term "character string", which was later shortened to just "string".

    at the risk of being presumptuous, your project might be helped by some SQL coding built into the VBA program, especially for querying huge amounts of data across fields... just a thought :-)

    heh, gotta go. this was supposed to be just a quick peek into sc... :-)

  • bloc said on Jan 05, 2008....
    @tin
    I actually used gvim 8-10 hours a day for a while. After a while I couldn't take it anymore and started using Kate (a kde text editor) then when I switched to the mac I started using textmate and have been very happy every since. Textmate is by far the best editor I've ever used, but it's only on the mac.
  • travelr712 said on Jan 05, 2008....
    if you're writing VBA in access or any other microsoft product, the editor doesn't have line numbers. neither does the VB6 or .net editor. the way higher level programs are organized, line numbers don't usually mean much anymore anyway. like, it can say 'error on line 46', but the real problem with the code is the fact that the sub you passed the variable from had a null value in it, so it passed a null to the sub you're error was in. things like that. you're programming in an object oriented modular language now. the structure uses objects with classes and methods. it's an entirely different arcitecture than the old DOS basic.
     
    and yes, what moon said, it's a 'string of characters'.
  • bloc said on Jan 05, 2008....
    @travelr
    i haven't done much dev work with windows stuff. It doesn't give a stack trace?

    btw, I had no idea what VBA was, I thought he was talking about vb.net originally :p

    Side note, i think MS is on the right track with their CLR and integrating it into all of their products like silverlight and sql server.
  • TinSoldier said on Jan 05, 2008....
    @bloc
    Heh. I had to get used to using vi on SunOS at work several years ago, not to mention when messing around with Linux.

    Once using the commands in command mode becomes reflexive and instinctual, it becomes difficult for me not to hit escape and then command keys for navigation.

    Plus there are a lot of nice features that I've barely scratched (since I don't write enough code).

    But choice of text editors is like religion or tax policy -- everyone has their favorite and woe be to the person who tries to convert another. :D

    lampshade already answered the question about line numbers and the term string adequately, but for further information see the Wikipedia entry.

    @bloc again:
    I recently recorded a macro in Excel, which is of course converted to VBA. I had to edit the code because it wasn't generic across spreadsheets -- the editor was okay and like most current editors my insertion point was moved to where the error was located. About 30 mins of researching how to use the objects properly and I had written my first (and only!) VBA utility.
  • bloc said on Jan 05, 2008....
    some of the things that bugged me with vim is taht I couldn't have a "project" where it knew all of my files. It's code folding isn't as easy to use as a real gui editor.

    I still use it daily for quick edits of single files, but I prefer something like textmate when working on one of my coding projects (assuming I'm not using a IDE).
  • TinSoldier said on Jan 05, 2008....
    Ah. I haven't really grokked IDEs and folding and stuff yet. I still pretty much stick to single files.

    Well, even though I haven't used it, ctags sounds pretty cool.
  • travelr712 said on Jan 05, 2008....
    no stack trace in vba. if you're using vbscript, it'll give you a line error, but vbscript is done in a text editor. i prefer notepad+ for that, because it does have line numbers. vba gives you an error code that you can google, but it's pretty general, so it might and might not help you figure out the problem.
  • GracefullyGrowing said on Jan 06, 2008....
    Oooo.  A geek thread!  ;~P
     
    ~Grace~
  • silverwhisper said on Jan 07, 2008....
    lampshade: heh, you may be younger than me. :>

    infernal: [trout-smack!]

    bloc: there's a VBA editor. it's an IDE.

    TS: as a novice in this area, i don't even know what gvim is. ?

    moon: ah, much obliged! :>

    trav: yeah, i noticed that. :>

    grace: yep, and a lot of it's going over my head!

    ed
  • TinSoldier said on Jan 07, 2008....
    ed: gvim is a text editor, but it's really not for the novice or casual user. It's easy to get confused since it works quite a bit differently than other text editors. (Vim is the actual editor -- gvim is the graphical version of it as opposed to the textmode version.)

    It is based on the old Unix text editor named "vi" which stands for "Visual Interface". Which isn't the same as what we nowadays think of as a "visual interface". And before that, vi was based on "ed", your own namesake, a text editor that is so primitive that you could only edit one line at a time and where knowing the line number was absolutely essential.
  • silverwhisper said on Jan 07, 2008....
    TS: ah...i've heard of those unix text editors. :>

    i knew even of vim, but was confuzzled by the "g". :>

    ed
  • the_infernal_optimist said on Jan 07, 2008....
    Thanks for remedying my trout withdrawal. ;-) And whaaat? All I said was-- never mind. :-D

    ~Infernal
  • silverwhisper said on Jan 08, 2008....
    :D
  • kelly said on Jan 10, 2008....
    Personally, I prefer to use Textmate, vi and emacs all in the same day and interspersed so that I can be in emacs, completely forget where the heck I am, and then bang on the escape key a few times and try to run a vi editor command so that something completely bizarre and unexpected happens.  Then I can hit Ctl-x, Ctl-s while in Textmate and wonder why in the world the file isn't saving.  It's great for productivity.  You ought to try it.
  • silverwhisper said on Jan 11, 2008....
    kelly, i barely know enough to define my variables, never mind my environment!

    ed
  • humanbeing said on Feb 03, 2008....
    Line number have nothing to do with the program code in most languages (Perl, C, C++, C#, VB, VBA,  VB.NET, Java, Javascript etc).  It is entirely the function of the editor. 
     
    Most professional development tools allow you to display line numbers as an option and it is useful as many compilers refer to line numbers when issuing compilation errors and warnings.

Comment on "rant: line numbers--where are the gorrammed line numbers?!"

programming rants VBA coding variables (Click to add tags below)

(Separate tags using commas, for example: New York, dating, vegetarian)

I think fucking not!!

No, I do THINK think... though I'd much rather prefer not to. Might be much more peaceful that way...
only God would know the reason,but I'm sure he must have had a plan...............
The Boy has been playing basketball. So each Tuesday evening is practice and every Saturday afternoon is a game.

And I am ready to scream. Certain people need to learn that physically being there is NOT ENOUGH.

I admit that I ha...
Uhm, Hi Lady...remember me? I spoke to you at length on Monday afternoon, explained that I handle very little of the program that you are asking about, and would have to contact someone to get the information you needed....
Plain and simple I would make a terrible sales person, no doubt about it.

I just have such a problem making that extra step, going that extra mile for a client who just expects it. Expects it and won't take any responsibility at all.