Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

Sorry, you do not have permission to ask a question, You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please type your username.

Please type your E-Mail.

Please choose an appropriate title for the post.

Please choose the appropriate section so your post can be easily searched.

Please choose suitable Keywords Ex: post, video.

Browse

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise Logo Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise Logo

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise Navigation

  • Home
  • About Us
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • About Us
  • Contact Us
Home/ Questions/Q 6942

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise Latest Questions

Author
  • 60k
Author
Asked: November 27, 20242024-11-27T11:13:07+00:00 2024-11-27T11:13:07+00:00

Getting started in Software development: A Path to a rewarding career (Part 3E, Functional Programming and OOP)

  • 60k

Hello and welcome

Thanks for stopping by.

Table of Content

Full table of content for the entire series is here

Today, we will continue the following

  • Getting started (cont'd)
    • Learn Programming concepts (cont'd)

Programming Concepts

Today we will round up the section on programming concepts with brief descriptions of Functional Programming and Object-Oriented Programming (OOP).

Fair warning, these concepts are a bit involved so just go through them for the sake of getting introduced to them. Do not be under pressure to understand them completely for now. We are only addressing them here because it is good to have this basic exposure now before we go in deeper in future sessions

Lets goooo!!!

Yeeeeeaaaah

Functional Programming

Functional programming (or FP) is a software development paradigm where functions (Pure functions to be specific) are the building blocks of the computations to be done in the application.

Another aspect to it is that it seeks to avoid concepts of shared state and mutable data. Now lets zoom in to some of the key aspects of FP. Yes, the ones in bold.

Pure functions

They are the basis of functional programming. They are functions like the ones we have addressed in the previous session (used for bundling behaviour to be reused) but with some specific behaviours:

  • They take input parameters and return an output without modifying any external state or data. So, if your function affects anything outside its scope, it produces a side effect and that makes it impure.

Being an impure function is not a crime but it no longer fits the FP paradigm and you have to watch for the pitfalls that make pure functions desirable. It will only be wrong to have those if FP is what you are aiming for.

  • Same inputs to pure functions return same outputs all the time. Like a function to add 2 numbers; no matter how many times you try the function with the same parameters, you can be sure the output will be the same.
function add(a,b) {    return a+b } 
Enter fullscreen mode Exit fullscreen mode

This add function is pure. It does not impact/modify anything else and it will always return the same output given the same inputs.

This behaviour of pure functions makes them easy to work with because they are predictable and easily testable.

Shared state and Data Immutability

In functional programming, once data is created, it is not changed. Instead, new versions or copies are created when required. This reduces the issues that can arise from mutating (changing) data that can lead to side effect which can be hard to track, test and manage in programming.

FP is not as common as it used to be because it was replaced/overtaken by OOP but there are still a few cases where it holds a lot of value and knowing and applying it as much as is convenient in your programming career might come in handy.

Object Oriented Programming

This is a paradigm that organizes your application code into structures called objects.

The way it works is that everything in your code is an object. Whether you are building a social media app, a ride hailing app or a to-do list app, everything is an object. The database connection is an object, the user is an object, authentication is an object etc. Literally everything in the world can be modeled in your application as an object.

Objects are built from Classes and a Class is simply a template or blueprint that defines the properties (attributes/features) and behaviors (methods/abilities) that objects of that class will have.

oop human

In the image above, you create a class called Human and from that Human class you can build any number of ‘Human’ objects in your application as needed using that blueprint or template.

Inside the Human class like every other class, you will specify 2 sets of things

  1. Attributes like gender, name, email address, account number and any other attributes that are relevant to your application use case for the Human’s objects.

  2. Methods or function or actions that represent what the Humans in your application can do

Do not make the mistake I made earlier while learning by specifying everything you can think of for a human, only the attributes relevant to the app. If the application does not use the date of birth of the human then it is not relevant. Seems like a given but is worth mentioning.

There are the 4 main concepts in OOP namely Inheritance, Polymorphism, Abstraction and Encapsulation. Do not worry too much what they mean for now, we will go in deeper when we get to the OOP section in our journey

In my opinion, OOP is a super power once you grasp it but it takes some time and effort to truly get it right.

This is it for today and for this section on basic programming concepts.

In the next one, we will get into the real meat of the matter and start writing code.

Until then stay frosty and remember, we are here to help

Iron legion

Previous post is here

Next post is here

beginnerscareertutorialwebdev
  • 0 0 Answers
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

Sidebar

Ask A Question

Stats

  • Questions 4k
  • Answers 0
  • Best Answers 0
  • Users 2k
  • Popular
  • Answers
  • Author

    ES6 - A beginners guide - Template Literals

    • 0 Answers
  • Author

    Understanding Higher Order Functions in JavaScript.

    • 0 Answers
  • Author

    Build a custom video chat app with Daily and Vue.js

    • 0 Answers

Top Members

Samantha Carter

Samantha Carter

  • 0 Questions
  • 20 Points
Begginer
Ella Lewis

Ella Lewis

  • 0 Questions
  • 20 Points
Begginer
Isaac Anderson

Isaac Anderson

  • 0 Questions
  • 20 Points
Begginer

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help

Footer

Querify Question Shop: Explore Expert Solutions and Unique Q&A Merchandise

Querify Question Shop: Explore, ask, and connect. Join our vibrant Q&A community today!

About Us

  • About Us
  • Contact Us
  • All Users

Legal Stuff

  • Terms of Use
  • Privacy Policy
  • Cookie Policy

Help

  • Knowledge Base
  • Support

Follow

© 2022 Querify Question. All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.