Python is an interpreted high-level general-purpose programming language. Its design philosophy emphasizes code readability with its use of significant indentation. Its language constructs as well as its object-oriented approach aim to help programmers write clear, logical code for small and large-scale projects.
Python is dynamically-typed and garbage-collected. It supports multiple programming paradigms, including structured, object-oriented and functional programming. It is often described as a "batteries included" language due to its comprehensive standard library. Python is a programming language that is pretty close to a natural language.
Python is a very popular programming language,so it can be used in many different fields of computer science. Accordingly with the python.org website, Python can be used for:
- Web development
- Data science
- Artificial Intelligence
- GUI development
- Systems admnistration
- Advanced math
- Mobile development
In this article, I will focus in web development and data analysis, because these are two fields that dialogue with IoT. Usually you will need to develop a web server to receive the topics that will be published by the devices (web development), and this web server will need to process the brute data received, organize it and generate an output pointing out the flaws, possible improvements, insights (data analysis).
To build web servers, you can use Python native libraries, but you can also use the web frameworks, with them, you will be able to write stronger, more resilient systems with fewer lines of code. The main python frameworks for web development are: Flask, Django and FastAPI, and we'll talk a little bit about them today.
Flask is a micro web framework written in Python. A micro web framework is a web development framework with an easy setup and can be used in developing minimalistic web applications. Flask comes with options like template engines such as ORM, caching, and authentication.
It was created to build web apps with the Python programming language. It was designed to be easy, fast, and to scale up complex applications and microservices. If combined with ORMs and data analysis libraries, Flask becomes a very powerful tool.
Django is a free and open-source Python web development framework used in building websites. It was created by Adrian Holovaty and Simon Willison in 2003 and used the Model-Template-View pattern.
It is popular for its robust and straightforward nature. It’s one of the most popular frameworks globally and is used by Tech giants like Instagram, Youtube, etc. Django is also popular because it encourages reusable code.
FastAPI is a modern, fast, and robust framework that helps build APIs with python 3.6+ versions. It is considered to be one of the fastest Python frameworks. It’s a framework that is quick to code. FastAPI is not so popular as Django and Flask, so the community will be smaller, but is the best option if you need performance and scalability.
Big techs like Netflix and Uber use this framework which fully supports asynchronous programming and can work with WSGI (Web Server Gateway Interface) and ASGI (Asynchronous Server Gateway Interface). Flask and Django, until the time of publication of this post, still do not fully support asynchronous programming.
Data analysis is defined as a process of cleaning, transforming, and modeling data to generate insights and information that will be used in the decision-making process. The purpose of Data Analysis is to extract useful information from data and taking the decision based upon the data analysis.
Data analysis is a branch of computer science, highly valued by companies, because with good data analysis, it is easier to make the right business decisions. And this branch is part of IoT, because the sensors/microcontrollers send the data in its "brute state", so as an IoT developer, we must be capable of modeling it, transform the data collected into structured information.
Python, because it is an "easy" and popular language, has many libraries and tools to handle data analysis and statistics. These libraries turn the work easier, because they have lots of builtin functions to receive data as parameter, and then returns structured information as output. But is very important to learn the algorithms and the math behind these data analysis tools.
NumPy is a fundamental package for scientific computing in Python. It is a Python library that provides lots of functions to deal with datasets, multidimensional arrays, predictions, math, logic, shape manipulation, sorting, selecting, basic linear algebra, basic statistical operations.
Pandas is a Python package providing fast, flexible, and expressive data structures designed to make working with "relational" or "labeled" data both easy and intuitive. It aims to be the fundamental high-level building block for doing practical, real-world data analysis in Python.
It is a symbolic math library that uses dataflow and differentiable programming to perform various tasks focused on training and inference of deep neural networks. It allows developers to create machine learning applications using various tools, libraries, and community resources.
Frontend is the "visible" part of a website, is where the user interacts with directly. It is also referred to as the "client side" of the application. It includes everything that users experience directly: text colors and styles, images, graphs and tables, buttons, colors, and navigation menu.
Vue is a progressive framework for building user interfaces. Unlike other monolithic frameworks, Vue is designed from the ground up to be incrementally adoptable. The core library is focused on the view layer only, and is easy to pick up and integrate with other libraries or existing projects. On the other hand, Vue is also perfectly capable of powering sophisticated Single-Page Applications when used in combination with modern tooling and supporting libraries.
Backend is where the business rules are located, it handles all the data, logic, services. It is also referred to as the "server side" of the application. It includes databases, microsservices, messaging systems, queues, data analysis tools and all these stuff that are closer to the server than to the browser.
NestJS is a framework for building efficient, scalable Node.js server-side applications. Is built with and fully supports TypeScript and combines elements of OOP (Object Oriented Programming), FP (Functional Programming), and FRP (Functional Reactive Programming).
Under the hood, Nest makes use of robust HTTP Server frameworks like Express (the default) and optionally can be configured to use Fastify as well.
Express is a minimal and flexible Node.js web application framework that provides a robust set of features for web and mobile applications. It is an open source framework developed and maintained by the Node.js foundation.
AdonisJs is a Node.js web framework inspired by Laravel. It has the Model View Controller (MVC) structure, well-written documentation, and support from maintainers. Adonis isn't a minimal framework like Express, it is more similar to NestJS, because it is a complete framework, with lots of builtin functionalities and ORM integrated.
When do you have a large community around some tech, becomes a lot easier to learn, because you can learn together, you can ask and share knowledge. Also exist specific communities, for a single library, or framework, and this helps you to precisely find the right people.
We have reached the end of our article, this was a very long post. Know JS and Python is essential to be a good IoT developer, because you will be able to work with web development, data analysis, mobile, machine learning and more.
Obviously this post doesn't contain everything you need to know, because it's a very dense subject, but I tried to summarize as best I could, to make the information clear and allow you to go deeper into the subject.