GoConqr hat ein neues Design! Sag uns, wie es dir gefällt.

Karteikarten

212

Jarl Jackson Englisch 54 Karten

Karten in diesem Stapel (54)

  1. 1ConstantsSomething.FEMALE
    (Type Safe)
  2. 2EnumerationsSomething.Gender.Female
    (Strongly Typed)
  3. 3For EachFor Each
    for (int i : myArray) { System.out.println(i); }
    For Each with Enumerations
    for (Gender g : Gender.values()) { System.out.println(g);
  4. 4Parameter PassingThe Actual Parameter (The Value)
    The formal parameter (The Variable)
    Java is pass by value
  5. 5InheritanceInheritance provides a mechanism to promote reuse and extensibility
    Some classes can be inherit from, derived from or extend another
    It is transative
  6. 6Inheritance TermsBase class, super class, parent class
    (Extends Keyword)
  7. 7Method OverridingUsed to change the behaviour by replacing a method in the superclass
  8. 8Method OverloadingThis means we can have more than one method with the same, in the same class… as long as they have different parameter lists
  9. 9PolymorphismAny instance of a class which inherits (Extends) from another can also be treated as an instance of that class
  10. 10Polymorphism ConstraintsClass can extend one other class no more
  11. 11InterfacesAbstract Specification of zero or more methods
    Cant contain any instance variables
    Cant contain any methods
    A Class can implement any number of interfaces
  12. 12Interfaces With PolyPolymorphism in Java is also applied to interfaces. As we can definitively say a class has the capabilities defined in an interface, we can apply polymorphism without compromising type safety.
  13. 13Object ClassMother of all classes (Provides core functionality)
  14. 14GenericsRuns purely at compile time, and use type free syntax and only when an instance of a class is created is it bound to specific types
  15. 15Generics DefinedTypes are defined as classes or interfaces (Identifier in <> brackets) Benefits extensibility with compile time type safety
  16. 16RecursionAlternative method to create loops, a finite nested model of itself
    Infinite loops are just as problematic in recursion as with iteration
  17. 17Avoiding Infinite Recursive LoopsEnsure terminating case, ensure its monotonic across a state space, ensure all parts of a definition eventually lead to the terminating case
  18. 18Types of recursionHead Recursion - The first statement in a method is recursive
    Middle / Multi Recursion - One or more arbitrary statements in a method is recursive
    Tail Recursion - The final statement in a method is recursive.
  19. 19Encapsulationprovides more coherent classes, data structure code is now independent of application code, application code is not cluttered with data structure detail
  20. 20ReflectionAbility of a program to introspect, and reason about its own structure
    The CLASS class implements this functionality
  21. 21The CLASS classRepresents a single class, newInstance() creates an instance of that class
  22. 22CLASS class and reflectionEnable runtime extensibility
  23. 23MutabilityAccessors - Write only if you want the variable to be visible outside the class.
    Mutators - Write only if you want the variable to be mutable
    Mutability is the characteristics of a type that is permitted to change value during its lifetime
    Key principle in safe OO design
  24. 24Functional ProgrammingA programming paradigm that treats
    computation as the evaluation of mathematical
    functions and avoids state and mutable data.
  25. 25Console.Log();Write to console (Output)
  26. 26Console.Error();Write to error stream
  27. 27setInterval();Execute function at set time
  28. 28setTimeout();Execute function after a delay
  29. 29LetVariable that are mutable
  30. 30Constimmutable variable
  31. 31**Exponent
  32. 32.indexOf();Finds the index of matched item
  33. 33.push();Pushes an element to end of the array
  34. 34.shift();Pops an element from the front of the array
  35. 35.lengthcurrent length of an array
  36. 36.concat();Concatenates one array onto the end of another and returns a new array
  37. 37Object.keys();Returns an array of all the keys in the object
  38. 38Object.values();Return an array of all the values
  39. 39JSON.stringify();Produces a 'safe' JSON data object, without any functions!
  40. 40JSON.parse();Does the reverse of 'JSON.stringify()'
  41. 41Function JSfunction test() {
    console.log("TEST);
    }
    test();
  42. 42Variable functionslet test = function() { console.log( “Just a test!” ); }
    let b = test; b()
  43. 43functions with parameterslet f = function( x ) { return x + 1; };
    f(3)
  44. 44Passing functions a functionlet f = function( x ) { ... };
    function g( handler ) { return handler( 4 ); }
    g( f );
  45. 45LambdasThere are three major technical uses for lambda use: •Searching •Sorting •Currying
  46. 46Lambdas Filtering[1,2,3,4,5].filter( a => a > 3 );
  47. 47Lambdas Sorting[1,5,3,6,-4].sort( (a,b) => a - b );
  48. 48Lambdas Curryingconst f = x => y => x * y;
  49. 49CurryingPros: Partial Evaluation
    Load distribution
    Cons: Can be very easily misunderstood
  50. 50Pass by referencelet mutableData = { a: 1, b: 2 };
    function alterStuff( data ) { data.a = 4; data.b--; }
    alterStuff( mutableData ); console.log( mutableData );
  51. 51On hookEach call takes an event to match against, and a function to execute when this event occurs.
  52. 52JS ClassExcept this minor change - in JavaScript, unlike Java, the constructor is declared simply as 'constructor' for a given class.
  53. 53MapOrdering doesn't matter
  54. 54Reduce• accumulator - a value shared between function runs, which 'accumulates' the single result • element and index - The current element and element index to process • initialValue - What to set the accumulator to at the start

Informationen

Beschreibung
Karteikarten am 212, erstellt von Jarl Jackson am 15/05/2019.
Erstellt von
Jarl Jackson
Aufrufe
2
Bewertung

Feedback

Worum geht es?

Wie gefällt dir das neue Design?

Dein Eindruck