This story is a part of — My CS Notebook
Functional Programming
Pure Functions
o Given the same input will always return the same output
Recursion
o Must have a base criterion – a condition in which when met, closes the recursion and returns a resulto Must actively move toward the base criteriono Often a function will call itself carrying the latest value to the next call via method signature or parameters until the base criterion is met
Referential Transparency (Substitution Principle)
o States that you can replace a value in an expression without changing its behavioro Templating Syntax or Interpolation would fall under this category
Functions are First Class & Can Be Higher Order
This means that functions come first over other structure principles, for example in Java classes come first and methods / functions are encapsulated by classes.
Higher Order Function is defined as meeting one of the following- Takes in functions as arguments- Returns a function
CS Stuff
Model View Controller (MVC)
o Model: Structures data in a reliable wayo View: Displays data in an easy to understand formato Controller: Takes in commands to the model for data updates and send instructions to the view to updateo Support modularity and reusability
Namespaces
o “named” program regions used to limit the scope of variable, functions, or classes within a programo Help avoid conflict with existing definitionso Help support encapsulation
Interpreter
o Translate program one line at a timeo Increased analysis efficiencyo Decreased execution efficiencyo Require less Space Complexityo JavaScript, Python, and Ruby use interpreters
Compiler
o Translate Entire Programo Decreased analysis efficiencyo Increased execution efficiencyo Require more Space Complexityo C, C++, and Java use compilerso Umbrella term to describe when the code of one program is processes into another languageo Example: In C using gcc “compiles” C source code into machine language
Transpiler
o Translate Entire Programo Similar to a compiler in that it takes one source code and processes it into anothero Almost a subset of a compilero The output of a transpiler still has to go through a Compiler or Interpretero Example:- Babel: Transpiles ES6 JavaScript to ES5 JavaScript- Emscripten: Transpiles C/C++ to JavaScript
Runtime Environment
o When a program is executed it is in a “runtime state”o In this state, the program communicates with the hardware and accomplishes tasks
Call Stack
o Mechanism for an interpreter to keep track of its place within a script that call multiple functionso FILO, stack implemented in a runtime environmento Data structure that records place of current executiono Similar to Heap but varies:- Stack data structure (linear)- Fast access- Only supports local variable- Limit on memory allocation- Immutable- Memory allocated contiguously
Assembly Language
o Low-level programming languageo Indented to directly communicate with computer hardwareo Differs from machine language in that it is designed to be human readableo In general, assembly languages acts as a bridge between software and hardware
Machine Language
o Low-level programming languageo Indented to directly communicate with computer hardwareo Consists of binary and hexadecimal character
Runtimes
o Synchronous--Blocks next operation until current operation is completeo Asynchronous--Can execute another task before the current task is complete
Scoping
Dynamic Scope§ Not very common: Mathematica, Lisp, LuaLexical / Static Scope§ Common to most programming languages§ Set the range of functionality of a variable to that it can only be referenced from within the block of code in which it is defined§ Scope can be broken into Built-in, Global, Enclosed, and Local§ Closure is when a block or function closes it attributes to only to modifiers that are within the block of code itself§ Pretty much every modern language uses Lexical Scoping
Memory Heap
o Can be used in parity with a Call Stack in a runtime environmento Similar to a Call Stack but varies:- Heap data structure (hierarchical)- Slower access- Often supports global variables whereas a call stack only holds the local scope of the current executions- No limit on memory allocations- Mutable- Memory allocated randomly
Concurrency & Parallelism
o Concurrency is executing multiple tasks at the same time, but not simultaneously.- Two or more tasks work in overlapping time periods
Threading & Processes
o Threads -> sequence of code execution which are independent of one anothero Process -> the instance of a running program. A program can be multiprocessoro If you want to use more than more than one core in a CPU you will want to use multiprocessing- By default Java and C do this- Python has a Global Interpreter Lock (GIL) built in to prevent more than one thread from interpreting Python. This however can be overridden with Python’s built-in multiprocessing moduleo Single Threaded LanguageLimits runtime environment to 1 call stack and 1 memory heap
Big Data
Systems
- Centralized — Old school UPS logistics but with computers
- Decentralized — Two or more centralized systems that can communicate
- Distributed — Web of systems, think current Amazon.com logistics
MapReduce
- A big part of how queries work on scaled data infrastructure that lives on distributed systems.
o Processing large data sets in a distributed fashion over several machineso Mapping dataset into a collection of <key, value> pairs, and then reducing over all pairs with the same keyo A map reduce is split into two scripts- A mapping script- A reduce scripto A map reduce execution utilize the divide and conquer methodology over a distributed computing structure.
Hadoop (Popular Data Platform)
Framework for Big Data§ Contains two modules- MapReduce- Hadoop Distributed File System (HDFS)Uses Sub-Projects§ Hive -- SQL like scripts to preform MapReduce Functions§ Sqoop -- Import Export data to and from HDFS and (Relational Database Management System) RDBMS§ Pig -- procedural language to develop scripts for MapReduce Operations
What is it that makes Hadoop so valuable for Big Data?
- A traditional database like MySQL has similar components to Hadoop. There is a query language, that query language directs the database architecture to find the data (I/O) and the metadata (Model) attached to it.
- Hadoop is special because it separates the metadata layer from the data (increasing the abstraction of the design) and utilizes AWS S3’s existing distributed computing structure.
Languages / Tools
GoLang
Aim to replace C++ and Java by:§ Increasing compilation efficiency§ Increasing execution efficiency§ Increase / Support readability§ Increasing consistency§ Allow development in multiple languages§ Allowing easier maintenance of dependenciesSpecial Sauce:§ Multithreading & Concurrency· GoLang aims to keep pace with hardware changes that allow for more threading and concurrent efficiency§ Compilation Efficiency- Go is a compiled language like C/C++- It also does garbage collection and object removal like Java§ Unmatched Simplicity- No Templates- Single Executable – No Runtime Engine Needed- No Built in Libraries§ Built-in Testing Framework and Profiling§ Easy Learning Curve
Scala
o Mis of OOP and Functional Programmingo Can be used for Machine Learning to Web Apps
C/C++
- Synchronous / Multithreaded / Semi-OOP
- Low-level, used everywhere:
Linux, Mac, Word, Everything, PHP, Perl, Video Games, BLoomber, MySQL, Microsoft OS
.NET / C# / F# / Visual Basic
- Video that explains it all: https://www.youtube.com/watch?v=bEfBfBQq7EE&t=624s
Java
- Synchronous / Multithreaded / OOP
Use cases: Applets, Applications, Server Suites, Open Source, Apache, Mobile apps, etc.
JavaScript
- single-threaded, non-blocking, and concurrent
o Async is possible because under the hood, JavaScript engines use multithreaded languages like C++ (Chrome) & Rust (Firefox)o JavaScript is a interpreted language and requires an engine to convert it into machine code.o V8 and engine / interpreter (used in Node and Chrome) does this.Contains: a memory heap, Call Stack, Event loop, Callback queue
PHP
o Hypertext Preprocessoro Useful for web developmento WordPresso Lamp Stack (Linux, Apache, MySQL, PHP)o Laravel is a PHP framework (for Web Artisans!)
HTML/CSS (Web-centric)
Hypertext Markup Language
Cascading Style Sheets
Python
- Synchronous / Single-Threaded / Semi-OOP
Elm
o Language designed to transpiled into JavaScripto It is impossible to leave a problem unhandledo Immutableo Maintainableo Highly readable
Ruby On Rails
- MVC framework
- Used by Twitter
- Check out: https://www.netguru.com/blog/what-is-ruby-on-rails-used-for
XML / JSON
Same§ Self-Describing§ Hierarchical§ Can be used by a large amount of languages§ Can be fetched with an HttpRequestDifferent§ JSON doesn’t use tags§ JSON is shorter§ JSON is quicker to read and write§ JSON can use arrays
This story is a part of — My CS Notebook
Enjoy the read?
Leave a clap or comment
Share with friends or on your favorite social platform