FUNCTIONING PROGRAMMING, ALGORITHMS, CODE EDITORS & Amp OPERATING SYSTEMS
FUNCTIONING PROGRAMMING, ALGORITHMS, CODE EDITORS & Amp OPERATING SYSTEMS
Pure Function:
It's a function in which given the same inputs, always returns the same output and has no side effects.
Doesn't change the global variable, hence it has no side effects. A side effect is any application state
change that is observable outside the called function other than its return value. Dude effects can
include:
- Writing to a file.
Shared State:
This is a variable that can be assessed from more than one function. Note that unlike in OOP
programming where objects are shared between programs and functions, functional programming relies
on immutable data structures and pure calculations to derive new data from existing data.
A common problem associated with shared state is that changing the order in which functions are called
can cause a cascade of failures because functions which act on shared state are timing dependent.
Immutability:
An immutable object is an object that can't be modified after it is created. Conversely, a mutable object
is one that can be modified after it's created. Immutability is an essential concept in functional
programming because without it data flow from your program can be lost and strange bugs can creep
into your software.
- Functional codes tend to be more concise, more predictable, and easier to test than imperative or
object oriented codes.
- Use of pure functions always produce the same output and have no external values affecting the end
result.
- Use of static variables prevents the user from Modifying the variables once it has been initiated. Hence,
it is secure.
- There is a powerful level of abstraction. If we write a bunch of pure functions, we get to leverage
referential transparency to abstract away and hide complexity.
- I/O operations rely on side effects, hence they are almost non-functional in functional programming.
- Recursion, which is quite popular with functional programming is memory intensive and this can affect
speed.
ALGORITHMS
An algorithm is a set of instructions for solving a problem or accomplishing a task. A good algorithm
should have some features:
For instance, to write an algorithm to find the average of two numbers and print the result.
- Binary Search:
Let's illustrate this with an example. Let's say you want to search for a friend Sam who is 5 feet tall and is
in a long line of people arranged from left to right, shortest to tallest. The steps to use include :
- select the person in the middle of the line and measure the height. If he's say 6ft tall, then you know
Sam is definitely to among people to his left.
- now, select the middle person again. If this person is say 3ft, then you've reduced your problem into
half again be ruling out that person and everyone to his left.
- after about 5 or 6 of such splits, you'll easily be able to find Sam by following the binary search
algorithm.
NOTE: Algorithms and data structure are very important aspects that one must really have a good grasp
of in order to be a good software engineer. To be able to master the science of algorithms, you can:
- Study popular algorithms such as the search algorithms (linear and binary search algorithms) and also
the sorting algorithms (Merge sort, Quick sort)
- Practice.
Code Editor:
It's a text editor that is specialised for writing software. A source code editor may be a stand-alone
program or part of an integrated development environment (IDE). Source code editors have
characteristics designed to simplify and speed up writing of source code such as syntax, highlighting,
indentation, autocomplete and grace matching functionality. An IDE is a text editor, a code editor, a
debugger, compiler and more all under a single tool belt.
Some notable code Editors are Atom, Brackets, Emacs, Notepad++, Sublime Text, TextMate, UltraEdit,
Visual Studio Code etc.
Command Line
This is a quick, powerful, text-based interface which developers use to more effectively and efficiently
communicate with computers to accomplish a wider set of tasks. Anything that can be done on the GUI
can also be done on the command line and it's even faster. Command line usually comes with the OS but
third party ones which usually come with more functionality can also be downloaded. There are several
command line apps, and for Windows we have Mintty, Git Bash; for MacOS we have zsh, powershell,
iTerm; for Linux we have zsh, powershell.
Some command line commands used to accomplish different tasks include Is, cd, mv, touch, create file,
mkdir, sudo, clear, etc.
OS is the most important software that runs on a computer. It manages the computer's memory and
processes, as well as all of its software and hardware. It also allows you to communicate with the
computer without knowing how to speak the computer's language. The famous OS are Windows, Mac,
Linux.
Linux is a family of open-source OS, meaning they can be modified and distributed by anyone around
the world. This is different from proprietary softwares like Windows which can only be modified by the
company that owns it. Advantages of Linux as an open-source OS is that it is free, also, there are many
different versions you can choose from. StatCounter Global Stats states that Linux users account for less
than 2% of global OS. However, most servers run Linux because it is relatively easy to customise. Some
OS under the Linux family are Ubuntu, Kununtu, Debian, Kali, Rufus, Mint.
There are also OS in mobile devices, and some of them the iOS used in Apple devices, Android OS used
on Android devices.
- Stack Overflow
- FreeCodeCamp forums
- Stack Exchange