line of code

50
• Line of Code https://store.theartofservice.com/the-line-of-code- toolkit.html

Upload: vivian-york

Post on 12-Jan-2016

219 views

Category:

Documents


5 download

TRANSCRIPT

Page 1: Line of Code

• Line of Code

https://store.theartofservice.com/the-line-of-code-toolkit.html

Page 2: Line of Code

Burroughs large systems Stack architecture

1 Multitasking is also very efficient on B5000 machines. There is one specific instruction to

perform process switches – MVST (move stack). Each stack represents a process (task

or thread) and tasks can become blocked waiting on resource requests (which includes waiting for a processor to run on if the task

has been interrupted because of preemptive multitasking). User programs cannot issue an

MVST, and there is only one line of code in the operating system where this is done.

https://store.theartofservice.com/the-line-of-code-toolkit.html

Page 3: Line of Code

C syntax Pointers

1 In declarations the asterisk modifier (*) specifies a pointer type. For example, where the specifier int

would refer to the integer type, the specifier int* refers to the type

"pointer to integer". Pointer values associate two pieces of information: a memory address and a data type. The following line of code declares a pointer-to-integer variable called ptr:

https://store.theartofservice.com/the-line-of-code-toolkit.html

Page 4: Line of Code

C Sharp (programming language) "Hello world" example

1 The above line of code tells the compiler to use System as a

candidate prefix for types used in the source code

https://store.theartofservice.com/the-line-of-code-toolkit.html

Page 5: Line of Code

Ruby (programming language) - Syntax

1 As invocation of these methods does not require the use of parentheses, it

is trivial to change an instance variable into a full function, without modifying a single line of code or

having to do any refactoring achieving similar functionality to C#

and VB.NET property members.

https://store.theartofservice.com/the-line-of-code-toolkit.html

Page 6: Line of Code

Lisp (programming language) - Evaluation and the read–eval–print loop

1 To implement a Lisp REPL, it is necessary only to implement these three functions and an infinite-loop

function. (Naturally, the implementation of eval will be complicated, since it must also

implement all special operators like if or lambda.) This done, a basic REPL

itself is but a single line of code: (loop (print (eval (read)))).

https://store.theartofservice.com/the-line-of-code-toolkit.html

Page 7: Line of Code

MINIX 3 - Cage the bugs

1 In monolithic operating systems, device drivers reside in the kernel.

This means that when a new peripheral is installed, unknown, untrusted code is inserted in the

kernel. A single bad line of code in a driver can bring down the system.

https://store.theartofservice.com/the-line-of-code-toolkit.html

Page 8: Line of Code

Objective-C - Instantiation

1 These steps should be accomplished with a single line of code so that there is never an allocated object

that hasn't undergone initialization (and because it is not advisable to keep the intermediate result since -

init can return a different object than that which it is called on).

https://store.theartofservice.com/the-line-of-code-toolkit.html

Page 9: Line of Code

Computer

1 Large programs involving thousands of line of code and more require formal software

methodologies

https://store.theartofservice.com/the-line-of-code-toolkit.html

Page 10: Line of Code

Pair programming

1 Pair programming is an agile software development technique in

which two programmers work together at one workstation. One, the driver, writes code while the other, the observer or navigator, reviews each line of code as it is typed in. The two programmers

switch roles frequently.

https://store.theartofservice.com/the-line-of-code-toolkit.html

Page 11: Line of Code

Unit testing - Unit testing limitations

1 As a result, for every line of code written, programmers often need 3 to 5 lines of test

code

https://store.theartofservice.com/the-line-of-code-toolkit.html

Page 12: Line of Code

Application security - Security testing for applications

1 Because IAST combines SAST and DAST techniques, the results are

highly actionable, can be linked to the specific line of code, and can be

recorded for replay later for developers.

https://store.theartofservice.com/the-line-of-code-toolkit.html

Page 13: Line of Code

SQL injection - Incorrectly filtered escape characters

1 The following line of code illustrates this

vulnerability:

https://store.theartofservice.com/the-line-of-code-toolkit.html

Page 14: Line of Code

Software versioning - Change significance

1 However, since version numbers are human-generated, not computer-generated, there is nothing that prevents arbitrary changes that

violate such guidelines: for example, the first sequence could be

incremented between versions that differ by not even a single line of

code, to give the (false) impression that very significant changes were

made.https://store.theartofservice.com/the-line-of-code-toolkit.html

Page 15: Line of Code

Development Testing - Development Testing and Static Analysis

1 The term "Development Testing" has occasionally been used to describe the

application of static analysis tools. Numerous industry leaders have taken issue with this

conflation because static analysis is not technically testing; even static analysis that "covers" every line of code is incapable of

validating that the code does what it is supposed to do—or of exposing certain types of defects or security vulnerabilities that manifest

themselves only as software is dynamically executed.

https://store.theartofservice.com/the-line-of-code-toolkit.html

Page 16: Line of Code

Program animation

1 The programmer may examine the state of the program, machine, and

related data before and after execution of a particular line of code

https://store.theartofservice.com/the-line-of-code-toolkit.html

Page 17: Line of Code

Best coding practices - Code Building

1 Best coding evolves from following proper coding standards and

guidelines. Appropriate Comments for each and every line of code

makes code maintainability much easier. A best code should have

reusable components.A brief description of the aforementioned

points is given below.

https://store.theartofservice.com/the-line-of-code-toolkit.html

Page 18: Line of Code

Categorical list of programming languages - Curly-bracket languages

1 There is dispute among programmers who use these languages about the placement of opening braces. Some put them on the lines of code which determine whether the contents of the braces are executed (e.g.

the if or while condition) in order to reduce the number of lines and make more code visible at once. Others put every brace on a new line of code, in order to make brace

nesting clearer. See Indent style.

https://store.theartofservice.com/the-line-of-code-toolkit.html

Page 19: Line of Code

Bill Gates - BASIC

1 During Microsoft's early years, all employees had broad responsibility for the company's business. Gates oversaw the business details, but continued to write code as well. In

the first five years, Gates personally reviewed every line of code the

company shipped, and often rewrote parts of it as he saw fit.

https://store.theartofservice.com/the-line-of-code-toolkit.html

Page 20: Line of Code

Code Lyoko - Merchandise

1 Several Code Lyoko products have been released, including DVDs, a

series of cine-manga by Tokyopop, a series of four novels by Italian

publisher Atlantyca, apparel and other accessories. In 2006, Marvel Toys released a line of Code Lyoko toys and action figures. A series of

four chapter books was released and distributed in Italy and other

countries.https://store.theartofservice.com/the-line-of-code-toolkit.html

Page 21: Line of Code

Codenomicon - Products

1 The product line of Codenomicon consists of a suite of 200+

independent network protocol testing solutions called DEFENSICS. Each protocol fuzzer can be licensed

separately, or as a suite of protocols related to a specific technology such as IPTV, VoIP, Routing, Bluetooth, and

several other communication domains.

https://store.theartofservice.com/the-line-of-code-toolkit.html

Page 22: Line of Code

Xmonad

1 In addition to obviating the need for the mouse, the xmonad developers make

heavy use of semi-formal methods and program derivation for improving

reliability and enabling a total Source lines of code|line of code count less than 1200, as of version 0.7; window manager

properties (such as the behavior of window focus) are checked through use

of QuickCheck

https://store.theartofservice.com/the-line-of-code-toolkit.html

Page 23: Line of Code

Unit tests - Unit testing limitations

1 As a result, for every line of code written, programmers often need 3 to 5 lines of test

code

https://store.theartofservice.com/the-line-of-code-toolkit.html

Page 24: Line of Code

Internet Explorer 6 - Criticism

1 The user could crash the browser with a single line of code in the address bar, causing a pointer

overflow.

https://store.theartofservice.com/the-line-of-code-toolkit.html

Page 25: Line of Code

Atari BASIC - Program editing

1 This can make catching syntax errors on the Atari much easier than on other editors; most BASICs will not display the errors until the program is

executed.The Sinclair Research#Home computers|Sinclair ZX family of machines also adopts the approach of checking each line as it

was entered, although it differs by not even allowing the line to be entered until it is

syntactically correct, which can be a hindrance to the programmer when writing a line of code but wanting to look up something elsewhere in the

program.

https://store.theartofservice.com/the-line-of-code-toolkit.html

Page 26: Line of Code

B5000 - Stack architecture

1 User programs cannot issue an MVST, and there is only one line of

code in the operating system where this is done.

https://store.theartofservice.com/the-line-of-code-toolkit.html

Page 27: Line of Code

Visual Composer

1 Starting with a blank canvas, the Visual Composer user draws the application in Visual Composer

Storyboard (workspace), without writing a single line of code. Since no

traditional programming skills are needed, business process experts can prototype, design and produce

entire applications.

https://store.theartofservice.com/the-line-of-code-toolkit.html

Page 28: Line of Code

Applesoft BASIC - Sample code

1 Multiple commands could be included on the same line of code if separated by a colon (:).

The ? can be used in Applesoft BASIC (and almost all versions of Microsoft BASIC) as a

shortcut for PRINT, though spelling out the word is not only acceptable but

canonicalmdash;Applesoft converted ? in entered programs to the same token as PRINT (thus no memory is actually saved by using ?),

thus either would appear as PRINT when a program was listed. The program above would

appear in a LIST command as:

https://store.theartofservice.com/the-line-of-code-toolkit.html

Page 29: Line of Code

Color BASIC - Background

1 Like most implementations of BASIC, each line of code starts with a line

number and consists of one or more statements with variables and

operators

https://store.theartofservice.com/the-line-of-code-toolkit.html

Page 30: Line of Code

Code Metrics - Common software measurements

1 * Software bug|Bugs per line of code

https://store.theartofservice.com/the-line-of-code-toolkit.html

Page 31: Line of Code

Generics in Java - Motivation

1 Although the code compiles without error, it throws a runtime exception

(java.lang.ClassCastException) when executing the third line of code. This type of problem can be avoided by using generics and is the primary

motivation for using generics.

https://store.theartofservice.com/the-line-of-code-toolkit.html

Page 32: Line of Code

Perl language structure - Basic syntax

1 The hash mark character introduces a comment (computer

programming)|comment in Perl, which runs up to the end of the line

of code and is ignored by the compiler (except on Windows)

https://store.theartofservice.com/the-line-of-code-toolkit.html

Page 33: Line of Code

APL (programming language) - Design

1 APL is well known for its use of a set of non-ASCII symbols, which are an extension of

traditional arithmetic and algebraic notation. Having single character names for SIMD

vector functions is one way that APL enables compact formulation of algorithms for data

transformation such as computing Conway's Game of Life in one line of code. In nearly all versions of APL, it is theoretically possible to

express any computable function in one expression, that is, in one line of code.

https://store.theartofservice.com/the-line-of-code-toolkit.html

Page 34: Line of Code

Goto

1 It performs a 'one-way transfer' of control to another line of code; in contrast a Subroutine|function call

normally returns control

https://store.theartofservice.com/the-line-of-code-toolkit.html

Page 35: Line of Code

DTrace - Description

1 A typical probe might fire when a certain file is opened, or a process is started, or a certain line of code is

executed

https://store.theartofservice.com/the-line-of-code-toolkit.html

Page 36: Line of Code

Source lines of code - Advantages

1 # Scope for Automation of Counting: Since Line of Code is a physical

entity; manual counting effort can be easily eliminated by automating the counting process. Small utilities may be developed for counting the LOC in a program. However, a code counting

utility developed for a specific language cannot be used for other

languages due to the syntactical and structural differences among

languages.

https://store.theartofservice.com/the-line-of-code-toolkit.html

Page 37: Line of Code

Source lines of code - Advantages

1 # An Intuitive Metric: Line of Code serves as an intuitive metric for measuring the size of

software because it can be seen and the effect of it can be visualized. Function

points are said to be more of an objective metric which cannot be imagined as being a physical entity, it exists only in the logical space. This way, LOC comes in handy to

express the size of software among programmers with low levels of experience.

https://store.theartofservice.com/the-line-of-code-toolkit.html

Page 38: Line of Code

Source lines of code - Disadvantages

1 This results in variation between languages; the same task that can

be done in a single line of code (or no code at all) in one language may require several lines of code in

another.

https://store.theartofservice.com/the-line-of-code-toolkit.html

Page 39: Line of Code

Source lines of code - Disadvantages

1 # Lack of Counting Standards: There is no standard definition of what a line of code is. Do comments count? Are data declarations

included? What happens if a statement extends over several lines? – These are the

questions that often arise. Though organizations like SEI and IEEE have published some guidelines in an attempt to standardize

counting, it is difficult to put these into practice especially in the face of newer and

newer languages being introduced every year.

https://store.theartofservice.com/the-line-of-code-toolkit.html

Page 40: Line of Code

Function composition (computer science) - Composing function calls

1 The second implementation requires only one line of code and is

colloquially referred to as a highly composed form

https://store.theartofservice.com/the-line-of-code-toolkit.html

Page 41: Line of Code

Read-eval-print loop - Implementation

1 To implement a Lisp REPL, it is necessary only to implement these three functions and an infinite loop|infinite-loop function. (Naturally, the

implementation of eval will be complicated, since it must also

implement all the primitive functions like car (function)|car and + and

special operators like if.) This done, a basic REPL itself is but a single line of

code: (loop (print (eval (read))))https://store.theartofservice.com/the-line-of-code-toolkit.html

Page 42: Line of Code

Type-in program - Description

1 They would take a line of code as it was entered and immediately

produce a checksum which could be compared to the printed listing

https://store.theartofservice.com/the-line-of-code-toolkit.html

Page 43: Line of Code

COBOL programming language - COBOL-85

1 Other responses were detailed analyses of the effect COBOL-80

would have on their systems; conversion costs were predicted to

be at least 50 cents per line of code. Fewer than a dozen of the responses

were in favor of the proposed standard.

https://store.theartofservice.com/the-line-of-code-toolkit.html

Page 44: Line of Code

Magic (cryptography) - PURPLE

1 PURPLE, like Enigma, began its communications with the same line

of code but then became an unfathomable jumble

https://store.theartofservice.com/the-line-of-code-toolkit.html

Page 45: Line of Code

Pilot (operating system)

1 It could take 60-120 seconds to run just one line of code in the inferior

operating system environment

https://store.theartofservice.com/the-line-of-code-toolkit.html

Page 46: Line of Code

Cookie stuffing - Frames and Iframes

1 Iframes are a way of embedding a page within a page. A webmaster

embeds a web page with one simple line of code. The affiliate embeds an I-Frame onto their page that loads

their affiliate URL. HTML element#Frames|Frames work in a

similar fashion.

https://store.theartofservice.com/the-line-of-code-toolkit.html

Page 47: Line of Code

Clipper (programming language) - History

1 Compiling dBASE code changes it from interpreted code, which must be interpreter (computing)|interpreted

every time each line of code is executed, to p-code machine|p-code,

which uses a Virtual Machine to process the compiled p-code

https://store.theartofservice.com/the-line-of-code-toolkit.html

Page 48: Line of Code

Selenium (software) - Selenium Remote Control

1 The benefits included the ability to drive remote browsers, and the

reduced need to port every line of code to an increasingly growing set

of languages

https://store.theartofservice.com/the-line-of-code-toolkit.html

Page 49: Line of Code

SimCity (2013 video game) - Post-release

1 Shortly afterwards, it was discovered that A line of code could be

commented out, allowing the game to be played offline indefinitely

https://store.theartofservice.com/the-line-of-code-toolkit.html