SEC S20W5|| Sharing resources and OOP using PHP Part -3

steemit-engagement-challenge-cover.jpeg

Greetings Steemit friends

Object Oriented Programming: Explain in detail what Object Oriented Programming is, what they are used for, and some of their use cases.

Object-oriented programming (OOP) is the structuring of code in blocks called objects and classes. The presence of OOP in a project takes away the normal functions and direct logic. The coming of OOP is to help developers relate backend cod to real-world objects. For example, a house, which has rooms, and the properties inside is a real-world object. A house has properties, which programmers will call attributes. The behavior of these properties is called functions or methods. OOP is all about making use of Class, Object, Inheritance, Encapsulation Abstraction, etc.

Class is used to create an object, which holds the attributes (properties) and methods (functions) of an object. An example is Staff, which will have an attribute like name, position, department, etc, and methods like staffInformation(), changePossition(), etc.

An Object is an instance of a class and is used to create unique data that can be applied to functions in a class. Objects can be seen as variables in a class. Objects help to organize and separate data used in a class. Objects are the core of OOP, as it is easy data management.

Inheritance gives the possibility of a subclass(child) to be able to inherit properties/ attributes of another class(upper-class/Parent). Inheritance helps in the aspect of reusing code, in which a programmer can create a unique class while making use of attributes of the parent class.

Encapsulation is used to manipulate data by applying a different level of data security. It helps to protect data while specifying who is authorized to make use of the data. It helps to organize and give some flexibility within the class without touching code.

Abstraction in classes helps to cover complex information, making it simple as you do not have to border yourself about irrelevant details.

Benefits of OOP

  • Reusability: OOP gives programmers the reuse of code across the application.
  • Scalability: OOP makes it easy to create new classes without tampering with existing code. The concept of inheritance helps to create specified classes.
  • Security: OOP makes it easy to manipulate sensitive data by using the concept of encapsulation to control access.
  • Flexibility: OOP makes it easy to work around the different classes within the application, without necessarily touching the code.

Use cases.

  • Web development
  • Machine Learning
  • Banking System
  • Game Development

Application Programming Interface: Write intensively on what you understand by API, Give five different examples and their use cases.

API is an application that permits two applications to communicate with each other. It is a set of rules defined by a request and a response of data between two applications. APIs are known as intermediaries, mostly called third-party applications used to give an additional service or functionality to a system. API is broken into 4 main components, which are :

Request: sent from the client side to request data
Endpoint: Where the API is expected to request/ collect the data needed on the client side
Respond: The data that was requested
Authentication: to give access to the application sending the request.

APIs application from the component I mentioned above, works on two sides. That is the client site and the server server side. The client-side is responsible for sending the request, while the server-side processes the request which will then send back the response to the client. There are a good number of API, A few examples:

  • Database APIs communicate between an application and the database.
  • Library APIs help developers add new functionality when developing applications.
  • REST APIs which allow communication between a client device and a server.

Popular API

Google Maps API: To add a map to an application
Twitter API: To add Twitter (x) content to an application
Facebook API: To add Facebook content to an application
OpenWeather API: To get weather data:
Twilio API: To send and receive SMS and two-factor authentication

Web Hosting Vs Local Host: Explain What you understand about the local host? What do you understand about web hosting? Give five Advantages and five disadvantages of web hosting and local hosting.

Web hosting is a service that provides the means for websites or applications to be published on the Internet. This gives the possibility to access the website or application from anywhere in the world. Web hosting services run on servers, providing storage ability to hold files. There are two main types: Shared hosting and Dedicated hosting.

Shared hosting: The service provider partitions a single storage to more than one website/application. In this case, all websites/applications made use of a single IP address. All resources under the shared hosting are used by all the applications in the package.

Dedicated hosting: The service provider offers a unique IP address to a single website/application. By doing so, the strategy provided is occupied by a single website/application. This has an advantage over shared, as resources are not shared.

AdvantagesDisadvantages
Website can be accessed anywhere in the worldBe ready to incur a monthly or annual fee
you have technical support, and do not have to border about severe management problemsLess access to control server configurations
Easy to acquire more resources for a websiteSecurity threats such as malware and DDoS attacks.
you have automatic backupDowntime can limit access to the website.

Local hosting is a server environment running on a local computer. It is used for development purposes, testing, and debugging. The application can only be accessed on the computer running the server. Examples of local server environment software are XAMPP, WAMP, and MAMP depending on the computer OS. XAMPP can run on both Windows and Linux OS.

AdvantagesDisadvantages
No cost on hostingOnly the developer can access from the local computer
Fast response timeNot a real-world environment
Highly secure environmentNo backup solution
You have full control over your server configuration managementConfiguration might be challenging due to updates in dependencies and extensions.
You do need the internet to run and test applicationsPossible limitations in resources like CPU, memory, etc.

Local hosting is good for testing environment before deploying to a web host that will be accessible to anyone.

cUrl: Why do developers use curl, list, and explain all the use cases of curl

cURL, which is the acronym for Client URL. It is a command-line tool used to transfer data between servers using protocols. cURLs support several protocols such as HTTP, HTTPS, FTP, SFTP, SMTP, etc. A cURL is a universal tool for web developers as is available on all OS (Linux, macOS, Windows, etc). It can support different protocols, making it easy for developers to automate data transfer. Lastly, curl is used for API testing without running the whole application.

Use cases of curl

  • API testing: Developers use curl to test and debug APIs. It is a medium to interact with REST and SOAP APIs by making HTTP requests(GET, POST, PUT, DELETE), and receiving responses.
  • File Transfer: cUrl is used for file transfer via different protocols. A web developer can use it to download a WordPress directly from the website and upload it to a new server using the FTP protocol.
  • Sending and receiving files via HTTP/ HTTPS protocols.
  • cUrl is used in checking the SSL certificate information of a website.
  • cUrl can be used to handle proxy requests to bypass geo-restrictions on the internet.

Host your sign-up page, login page, and the page we created last week on a hosting site. ( Note: Infinityfree or 000webhost host pages for free but you are free to use any site you wish )

Here, I will upload a video and will do a light explanation. For me to host the signup pages, I need a registered domain and a host provider. I get the IP address and configure the DNS record by adding the A records. You can visit my project Signup

To move the file, I will need an FTP protocol to transfer the files from my computer to the host. In the video, I did a demo on the local server, before transferring to the host.

Get news data from a News API of your choice, and post the news on your web page.

I will pick https://mediastack.com/,

Started by creating an account
Then you have access to the API key, which will give authentication for the request.

Screenshot 2024-10-08 191014.jpg

Screenshot 2024-10-08 195618.jpg

Screenshot 2024-10-08 191153.jpg

Screenshot 2024-10-08 191329.jpg

Most APIs have documentation to help depending on the language you are coding.



Cheers
Thanks for dropping by
@fombae

Sort:  
Loading...
Loading...

This post has been upvoted/supported by Team 5 via @httr4life. Our team supports content that adds to the community.

image.png

Desain tanpa judul.gif

Hi sir @fombae, congratulations your program is running well, I have logged in there.
Good luck to you sir, best wishes.

Coin Marketplace

STEEM 0.18
TRX 0.16
JST 0.030
BTC 63017.22
ETH 2457.38
USDT 1.00
SBD 2.61