Difference between revisions of "Computer Science Guide"
(→inheritance) |
(→classes) |
||
Line 125: | Line 125: | ||
In object-oriented programming, a class is an extensible program-code-template for creating objects, providing initial values for state (member variables) and implementations of behavior (member functions, methods).[1][2] | In object-oriented programming, a class is an extensible program-code-template for creating objects, providing initial values for state (member variables) and implementations of behavior (member functions, methods).[1][2] | ||
− | |||
=====inheritance===== | =====inheritance===== |
Revision as of 23:02, 20 September 2014
abc
forward
This is a compilation of online resources.
- resources may be cut and edited to better fit the philosophy of this text
This text is intended to:
- be simple
- help those that desire it
- expose concepts without complexity
- be accessible by print and web
- provide links to all sourced information
- be editable by those without malicious intent
It is not expected that you read this text sequentially or entirely.
- use this text in whatever way benefits you most
This is NOT a supplement for a traditional academic resource such as a textbook.
notes about text
formatting
citation
- source links are included above their quotes
note key
- (TODO: ) is used to indicate necessary changes
composition
reading guide
sources
Wikipedia is relied upon heavily. It was the fastest way to get this project going. Additional sources are welcome to be incorporated where appropriate.
code
overview
http://en.wikipedia.org/wiki/Computer_programming
Programming is a process that leads from an original formulation of a computing problem to executable programs. It involves activities such as analysis, understanding, and generically solving such problems resulting in an algorithm, verification of requirements of the algorithm including its correctness and its resource consumption, implementation (commonly referred to as coding[1][2]) of the algorithm in a target programming language. Source code is written in one or more programming languages (such as C, C++, C#, Java, Python, Smalltalk, JavaScript, etc.). The purpose of programming is to find a sequence of instructions that will automate performing a specific task or solve a given problem. The process of programming thus often requires expertise in many different subjects, including knowledge of the application domain, specialized algorithms and formal logic.
design
http://en.wikipedia.org/wiki/Software_design#Software_Design
Software design is both a process and a model. The design process is a sequence of steps that enable the designer to describe all aspects of the software to be built. It is important to note, however, that the design process is not simply a cookbook. Creative skill, past experience, a sense of what makes “good” software, and an overall commitment to quality are critical success factors for a competent design.
The design model is the equivalent of an architect’s plans for a house. It begins by representing the totality of the thing to be built (e.g., a three-dimensional rendering of the house) and slowly re?nes the thing to provide guidance for constructing each detail (e.g., the plumbing layout). Similarly, the design model that is created for software provides a variety of different views of the computer software. Basic design principles enable the software engineer to navigate the design process.
concepts
conditionals
http://en.wikipedia.org/wiki/Conditional_(computer_programming)#If-then-else_expressions
Conditional statements are features of a programming language which perform different computations or actions depending on whether a boolean condition evaluates to true or false.
if-then-else
http://en.wikipedia.org/wiki/Conditional_(computer_programming)#If-then-else_expressions
IF (boolean condition) THEN (consequent) ELSE (alternative) END IF
switch
http://en.wikipedia.org/wiki/Conditional_(computer_programming)#Case_and_switch_statements
Switch statements (in some languages, case statements) compare a given value with specified constants and take action according to the first constant to match. There is usually a provision for a default action ('else','otherwise') to be taken if no match succeeds.
switch (someCharacter) { case 'a': onA(); break; case 'x': onX(); break; case 'z': onYandZ(); break; default: onNoMatch(); }
loops
http://en.wikipedia.org/wiki/Control_flow#Loops
A loop is a sequence of statements which is specified once but which may be carried out several times in succession. The code "inside" the loop is obeyed a specified number of times, or once for each of a collection of items, or until some condition is met, or indefinitely.
for (i = 0; i < n; i++) { // code }
enumerations
http://en.wikipedia.org/wiki/Enumerated_type
An enumerated type is a data type consisting of a set of named values called enumerators. The enumerator names are usually identifiers that behave as constants. A variable that has been declared as having an enumerated type can be assigned any of the enumerators as a value. In other words, an enumerated type has values that are different from each other and that can be compared and assigned.
enum class Color {Red, Green, Blue};
structures
classes
http://en.wikipedia.org/wiki/Class_(computer_programming)
In object-oriented programming, a class is an extensible program-code-template for creating objects, providing initial values for state (member variables) and implementations of behavior (member functions, methods).[1][2]
inheritance
http://en.wikipedia.org/wiki/Class_(computer_programming)#Hierarchical
Classes can be derived from one or more existing classes, thereby establishing a hierarchical relationship between the parent classes and the child class. The relationship of the parent class to the child classes is commonly known as an is-a relationship.[18] For example, a class 'Button' could be derived from a class 'Control'. Therefore, a Button is a Control.
Structural and behavioral members of the parent classes are inherited by the child class. Derived classes can define additional structural members (data fields) and/or behavioral members (methods) in addition to those that they inherit and are therefore specializations of their superclasses. Also, child classes can override inherited methods if the language allows.
composition
http://en.wikipedia.org/wiki/Object_composition
In computer science, object composition is a way to combine simple objects or data types into more complex ones. Composite objects are usually expressed by means of references from one object to another; in other words the use of variables.