Programming paradigms and best practice Flashcards

1
Q

What is a programming paradigm?

A

a style or way of programming

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is POP?

A

Procedural orientated programming

  1. Top down approach
  2. A list of instructions that tell the computer what to do step by step. It relies on procedures or routines
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is OOP?

A

About encapsulating data and behaviours into objects

Based upon classes, methods and objects

a. Class- ‘blueprint’ for an object and its associated attributes
b. Methods- functions that define behaviour
c. Objects- instances of a class

Classes may inherit attributes and methods from other classes and a class may have another class as an attribute

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are the advantages of using a OOP paradigm?

A
  1. Can reuse code
  2. Easier to maintain
  3. As the code is modular, parts of the system can be changed or updated easily
  4. Faster development as you can reuse code
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is functional programming?

A

a. Programming with function calls that avoid any global state
b. Functions are treated as data
c. Data is immutable
d. Functions take data as input and return an output dependent on the input

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are the 10 principles for programming best practice?

A
  1. Commenting and documentation
  2. Consistent indentation
  3. Avoid obvious comments
  4. Consistent naming system
    a. camelCase
    b. Underscores
  5. Write DRY code
  6. Avoid deep nesting
  7. Limit line length ~80 characters
  8. Consistent temporary names- for k,v…
  9. Capitalize SQL special words
  10. Use version control
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is PPP?

A

Pseudocode Programming Process

Pseudocode refers to an informal, natural language-like notation for describing how an algorithm or a programme will work

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is version control?

A

Process of managing changes to documents or programs
a. E.g. Github

Enables traceability of any changes that occur to a document and allows the user to compare, restore and in some cases merge files

Changes are labelled using informative commit messages

Required by Whiffin et al’s 2017 NGS pipeline best practice

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are the benefits of using version control?

A
  1. Important for accountability, traceability, QA and audit
  2. Allows developers to keep track of where they are in the development process
  3. Facilitate collaborative working
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are the 6 steps in a the github version control workflow?

A
  1. Raise an issue
  2. Fork the code and create a development branch
  3. Make changes and commit
    a. Commits should contain informative messages
  4. Send pull request
  5. Other developer will review pull request
  6. If changes are accepted, these are merged to the master branch
How well did you know this?
1
Not at all
2
3
4
5
Perfectly