Sunday, December 25, 2016
Declarative vs imperative programming
Declarative :
- Write code what you want but not necessarily how to get it (Declare the desired results but not the step-by-step)
- A style of building the structure and elements of computer programs—that expresses the logic of a computation without describing its control flow.
- Minimize or eliminate the side effects by describing what program should accomplish
- How is left to the problem implementation
- Only thing a function can do is calculate something and return it as a result.
Declarative languages include, SQL, React, Functional programming like haskell
Functional Prgramming
- In purely functional programming you don't tell the computer what to do as such but rather you tell it what stuff is
- if a function is called twice with the same parameters, it's guaranteed to return the same result. That's called referential transparency and not only does it allow the compiler to reason about the program's behavior, but it also allows you to easily deduce (and even prove) that a function is correct and then build more complex functions by gluing simple functions together
var results = collection.Where( num => num % 2 != 0);
Imperative : - Tell the compiler what you want to happen step by step
- Java, C, C# is imperative
- Main method of computation is assignment variable
- Implements algorithms in explicit steps.
Subscribe to:
Posts (Atom)
Labels
- Algorithms (52)
- Apache Kafka (7)
- Apache Spark (21)
- Architecture (8)
- Arrays (23)
- Big Data (98)
- Cloud services (6)
- Cognitive technologies (12)
- Data Analytics (3)
- Data Science (6)
- Design (1)
- devOps (1)
- Hadoop (26)
- Hive (11)
- Java (2)
- JavaScript (65)
- JavaScript Run-time (12)
- Machine learning (11)
- Maths (6)
- mongoDb (2)
- MySQL (1)
- Networking (3)
- No SQL (2)
- Node (20)
- Python (28)
- Security (4)
- Spark Grpahx (1)
- Spark MLlib (1)
- Spark Sql (3)
- Spark Streaming (4)
- SQL (40)
- Sqoop (2)
- ssis (3)
- Strings (13)