0% found this document useful (0 votes)
99 views4 pages

FUNCTIONING PROGRAMMING, ALGORITHMS, CODE EDITORS & Amp OPERATING SYSTEMS

Functional programming removes interdependencies between programs by using pure functions and immutable state. Pure functions always return the same output for the same inputs without side effects. Functional programming relies on immutable data structures and pure calculations rather than shared, mutable state. Some advantages of functional programming include more concise and predictable code that is easier to test due to lack of side effects. However, functional programming has a steeper learning curve and I/O operations are challenging due to reliance on side effects. Algorithms provide instructions for solving problems and should be clear, practical, and interpretable in any language. Common algorithms include binary search and sorting methods. Code editors help simplify writing code through features like syntax highlighting and autocomplete. The command line and operating

Uploaded by

Baye
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
99 views4 pages

FUNCTIONING PROGRAMMING, ALGORITHMS, CODE EDITORS & Amp OPERATING SYSTEMS

Functional programming removes interdependencies between programs by using pure functions and immutable state. Pure functions always return the same output for the same inputs without side effects. Functional programming relies on immutable data structures and pure calculations rather than shared, mutable state. Some advantages of functional programming include more concise and predictable code that is easier to test due to lack of side effects. However, functional programming has a steeper learning curve and I/O operations are challenging due to reliance on side effects. Algorithms provide instructions for solving problems and should be clear, practical, and interpretable in any language. Common algorithms include binary search and sorting methods. Code editors help simplify writing code through features like syntax highlighting and autocomplete. The command line and operating

Uploaded by

Baye
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 4

FUNCTIONING PROGRAMMING, ALGORITHMS, CODE EDITORS & amp; OPERATING SYSTEMS

Functional programming concept removes the interdependencies between progras by replacing


procedures with pure functions, which requires the use of shared and immutable state. E.g. are Lisp,
Erlang, Haskell, Clojure.

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:

- Modifying any external variable or object property.

- writing to the screen.

- 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.

Advantages of Functional Programming

- 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.

Disadvantages of Functional Programming

- Steel learning curve.

- 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:

- Clear and unambiguous.

- Inputs and input types should be clear.

It should be practical, i.e. should be applicable and easy to be created.

- It should be interpretable in any language.

For instance, to write an algorithm to find the average of two numbers and print the result.

Step 1: Declare 3 variables as a, b, sum as integers.

Step 2: Get inputs a and b from the user.

Step 3: sum = (a + b)/2

Step 4: Print sum.

Some popular algorithms we'll be needing:

- 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)

- Also, you should try to write your own algorithms.

- Master data structures.

- Spaced repetition; repeat what you write and try to be better.

- 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.

Operating System (OS)

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.

Help on the internet can be gotten from different sources including:

- Stack Overflow

- Mozilla Documentation Network

- FreeCodeCamp forums

- Stack Exchange

- Reddit channels (r/programming, r/webdev, r/learnprogramming etc).

You might also like