Use what you want. Use what makes sense for what you are doing now.
While I'm mostly a command line guy (I use the GUI only to get a graphical representation of revision graph), I've trouble to understand why you think using the command line gives you a better understanding of what happens behind the hood (well excepted for GIT :)), usually there is a clear mapping between the two even if CL may give you access to some little used features.
Now in my opinion, automating what can be automated in the process is part of the job and for that, CL is mandatory.
"Single Entry, Single Exit" was written when most programming was done in assembly language, FORTRAN, or COBOL. It has been widely misinterpreted, because modern languages do not support the practices Dijkstra was warning against.
"Single Entry" meant "do not create alternate entry points for functions". In assembly language, of course, it is possible to enter a function at any instruction. FORTRAN supported multiple entries to functions with the ENTRY
statement:
SUBROUTINE S(X, Y)
R = SQRT(X*X + Y*Y)
C ALTERNATE ENTRY USED WHEN R IS ALREADY KNOWN
ENTRY S2(R)
...
RETURN
END
C USAGE
CALL S(3,4)
C ALTERNATE USAGE
CALL S2(5)
"Single Exit" meant that a function should only return to one place: the statement immediately following the call. It did not mean that a function should only return from one place. When Structured Programming was written, it was common practice for a function to indicate an error by returning to an alternate location. FORTRAN supported this via "alternate return":
C SUBROUTINE WITH ALTERNATE RETURN. THE '*' IS A PLACE HOLDER FOR THE ERROR RETURN
SUBROUTINE QSOLVE(A, B, C, X1, X2, *)
DISCR = B*B - 4*A*C
C NO SOLUTIONS, RETURN TO ERROR HANDLING LOCATION
IF DISCR .LT. 0 RETURN 1
SD = SQRT(DISCR)
DENOM = 2*A
X1 = (-B + SD) / DENOM
X2 = (-B - SD) / DENOM
RETURN
END
C USE OF ALTERNATE RETURN
CALL QSOLVE(1, 0, 1, X1, X2, *99)
C SOLUTION FOUND
...
C QSOLVE RETURNS HERE IF NO SOLUTIONS
99 PRINT 'NO SOLUTIONS'
Both these techniques were highly error prone. Use of alternate entries often left some variable uninitialized. Use of alternate returns had all the problems of a GOTO statement, with the additional complication that the branch condition was not adjacent to the branch, but somewhere in the subroutine.
Thanks to Alexey Romanov for finding the original paper. See http://www.cs.utexas.edu/users/EWD/ewd02xx/EWD249.PDF, page 28 (printed page number is 24). Not limited to functions.
Best Answer
While the other answers note that
argv
comes from C, where did C get the idea to call an array a "vector"?Directly, it came from BCPL. Though
argv
refers to the vector of (string) arguments, BCPL did have strings stored in vectors, but they were string literals and they worked like Pascal strings. The vector had two elements: the length atliteral!0
and the characters atliteral!1
. According to Clive Feather, strings were manipulated by "unpacking" them into character arrays, transforming the array then "repacking" them into strings: compare this with C where strings are character arrays.So yes, C used v for vector because something else had done so before. Now, did anything before BCPL use vector in this way? BCPL was itself a simplification of the "Cambridge[or Combined] Programming Language": this used
vector
as a synonym for a 1-dimensional array andmatrix
as a synonym for a 2-dimensional array. This is consistent with the notation in mathematics of vectors and matrices, though in CPL they're just handy mnemonics and don't have any of the properties associated with the mathematical structures.Can we push back further in time regarding computing languages? One potential branch of our trail runs cold. CPL was heavily influenced by Algol 60 (the 1963 update). Now ALGOL 68 had types that were described as "packed vectors", such as
bits
andbytes
: but these weren't in earlier releases of Algol which just hadARRAY
referring to array. As BCPL comes from 1966, CPL must have been before that (but after 1963): ALGOL 68 (standardised in 1968 and 1973) cannot have been a direct influence.On the other hand, Main Features of CPL also makes reference to McCarthy's LISP system. While this doesn't use vector to refer to a data structure in the system itself, those being S-expressions, M-expressions and L-expressions (L-expressions are strings, so any association between vector and string has disappeared), it does use vector in another sense to represent the "values of a number of variables" representing "the state of the machine at any time". So we have evidence for an assumption made in the comments: that use of the word 'vector' to mean 'array' in computing comes from application of the similar term in mathematics.