paint-brush
Difference Between a Platform and a Frameworkby@pathiknd
2,709 reads
2,709 reads

Difference Between a Platform and a Framework

by Pathik DesaiOctober 6th, 2022
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

As the Application written on a Platform grows in size and complexity, it requires Frameworks to have better Maintainability and Productivity - make changes faster with less effort.

Companies Mentioned

Mention Thumbnail
Mention Thumbnail

Coin Mentioned

Mention Thumbnail
featured image - Difference Between a Platform and a Framework
Pathik Desai HackerNoon profile picture


All software programs run on some Platform and most software applications today use some kind of Framework. We will try to understand the difference between a Platform and a Framework

What is a Platform?

We will start with a few words on Platform Business to avoid confusion with the main focus area of this write-up.


Platform Business Model

  • A Platform Business works as a platform for a network of people/participants to carry out some activity. Most platform business models are supported by a technology infrastructure. eBay, Shopify, Facebook, Uber, etc. are all examples of the Platform Business Models.


  • This is not the focus of this article.


Platform in Software Development

  • A platform is a system that allows programs to be built and run on it. The platform provides services to make it easy to write a program.


  • Operating Systems Linux, Windows, Android, etc. are platforms. They allow programs to be built and run, and they provide services for storage, memory management, network access, etc. via their APIs.


  • The platform would need an Entry Point to run the program: main method or similar mechanism. The platform calls the Entry Point and transfers the control of execution to the program. The program has control and it can do whatever it wishes using the services of the platform.



  1. When the program is run, the platform execution service will locate the Entry Point and start program execution.

  2. From Entry Point onwards the Application program has the control of execution. The platform does not enforce anything. Application may use the services of the platform.


  • A platform is an abstraction layer. It hides implementation details of common services and allows Applications built on the platform to focus on solving business problems.


  • Are Java, NodeJs, .Net, etc. also Platforms?


Yes, they are platforms. They allow other programs to be built and run on them, and they provide services to simplify Application development e.g., File I/O operations using APIs in Java or .Net are easier than using Operating System APIs directly. Most of them are now Platform-independent Platforms because they can work on any Operating System.


What is a Framework?

  • A framework gives a pre-defined structure to the Application.


  • Frameworks are also an abstraction layer. They implement common repetitive tasks and allow the Application to focus on the problems it is solving. But still, they are different from Platform. The following diagrams explain it.



Sample Code

Code is in Java and Spring Boot but it should be easy to understand as other frameworks also have a similar mechanism.



  1. The platform calls the Entry Point to start the Application.
  2. The Entry Point then loads the Framework. Frameworks are hosted within an Application only.
  3. The Framework then goes through a Discovery process to find its Plugins
    • User class is a Plugin because it is annotated with @RestController. This tells Spring Framework that this is a Plugin.
      • In some cases, the plug-in may be identified by the implementation of an interface. The interface is declared by the Framework.
    • The Spring Framework discovered that there is a Plugin User that should be called when there is an API request with HTTP GET verb and URL path matching /user/{id} pattern.
  4. When there is an API request with a URL http://localhost:8080/user/AARE2212, Spring will call the get method on an object of class User
  5. The Framework and the Application both may use Platform services.


  • Frameworks implement the Inversion of Control pattern. it is called Inversion of Control because


    • the control of execution is always with the Framework.
    • The plugin declares its intent when it would like to act so that the Framework can pass on control of execution by calling the Plugin.
    • The framework calls the Plugin when events that Plugin is interested in occurs e.g. API request HTTP GET /user/{id}. If an event that the Plugin is interested in doesn’t occur, the Framework doesn’t call the Plugin.
    • The framework takes care of common repetitive tasks and the Plugin focuses only on core Domain / Business logic.


  • As the Application written on a Platform grows in size and complexity, it requires Frameworks to have better Maintainability and Productivity - make changes faster with less effort.


  • Sometimes the concept of Framework can also be applied to the Application logic. Example:


    • We need to write an API that can be used to upload different types of CSV files. On upload of the file, data in the CSV is stored in different tables.
    • In the following sample code, FileProcessController controls the whole processing and performs common tasks during the file processing. It calls Plugins to do the actual processing of a File of a type supported by the Plugin.
    • Adding support for a new type of file requires just writing the Plugin i.e. a Class implementing interface IFileProcessor .


//Common Type for data transfer between Framework and Plugin 

public class FileProcessRequest {
  private String type;
  private String path;
}

//Plugins will implement this interface to declare they are a plugin

public interface IFileProcessor {
  FileProcessResponse process(FileProcessRequest request);
}

//A file processor implements interface and declares the File Type it supports

@SupportedFileType("SALES")
public class SalesFileProcessor implements IFileProcessor {
  @Override
  public FileProcessResponse process(Framework.FileProcessRequest request) {
     //perform some domain logic here
     return null;
  }
}
    
//Controller that controls the flow of whole workflow and performs common tasks required for all types of files. 

public class FileProcessController {

  public FileProcessResponse process(FileProcessRequest request) {

    scanFile(request);
    validateFile(request);
    IFileProcessor processor = getProcessor(request);
    if(processor != null) {
      return processor.process(request);
    } else {
      //log error and send notification
    }
    return null;
  }
}


Platform-as-a-Service (PaaS)

  • Based on what we discussed above, PaaS can be thought of as a Platform to quickly build and run Distributed Applications.


  • PaaS offerings in Cloud provide various Compute, Storage, Networking, etc. services via APIs. An Application can be built and run using these services. If we take AWS for example,

    • AWS Lambda - Compute Service to run the program
    • RDS - Store data and run Database Server
    • S3 - Storage


Hope you have found this helpful. Please share your feedback in the comments.