Author Archives: Angus Cheng

Code Smells

Hello everyone and welcome back to my blog. This week I wanted to go more in depth about code smells because having smelly code can lead to issues in the long run. Code smells are not bugs or errors. Instead, they go against the fundamentals of developing software that decrease the quality of code. A code smell is a surface indication that usually corresponds to a deeper problem in the system. Code smells are typically easy to spot. Just by giving the code a quick glance, you can usually see if there is a large issue. 

A frequent type of code smell is called a bloater. It is code that is being added over time and then turns into a huge chunk of code, like a big block of code. Examples of this are long methods and method bodies as well as long parameter lists. A “God Line” is a term used when you write an excessively long line of code. Another smell you can have in your code is having too many comment lines. Sometimes comments are necessary, but having too many comments may confuse yourself or others later on. Sometimes you may also accidentally write duplicate code that does the same thing you already coded before. You should practice DRY or do not repeat yourself in order to not have that code smell. 

There is also dispensable code. This is code that does not get used when the code gets executed. Since they are not used when the code gets executed, there is no reason to include them in your code. Duplicated code is an example of this. But you should also know that code smells do not always mean there is a problem in your code. Sometimes, you do need long methods or long bodies of code in order for you code to function correctly. If it does not function, then you just need to look deeper in the code to find the problem. 

Code smells are just an indicator of the problem rather than the problem themselves. To get rid of a code smell, developers usually try to do refactoring to the code. Refactoring is when a developer changes the inside of the code but on the outside, the code still does the same function. Code smells can be present even in code written by experienced programmers. It can reduce the lifetime of the software and make it difficult to maintain. Expanding the software functionalities also gets difficult when smelly codes are present. Code smells can go undetected a lot of times. Programmers should avoid and fix code smells to make their code cleaner and maintain functionality.

https://deepsource.io/glossary/code-smell/

 

From the blog Comfy Blog by Angus Cheng and used with permission of the author. All other rights reserved by the author.

Code Smells

Hello everyone and welcome back to my blog. This week I wanted to go more in depth about code smells because having smelly code can lead to issues in the long run. Code smells are not bugs or errors. Instead, they go against the fundamentals of developing software that decrease the quality of code. A code smell is a surface indication that usually corresponds to a deeper problem in the system. Code smells are typically easy to spot. Just by giving the code a quick glance, you can usually see if there is a large issue. 

A frequent type of code smell is called a bloater. It is code that is being added over time and then turns into a huge chunk of code, like a big block of code. Examples of this are long methods and method bodies as well as long parameter lists. A “God Line” is a term used when you write an excessively long line of code. Another smell you can have in your code is having too many comment lines. Sometimes comments are necessary, but having too many comments may confuse yourself or others later on. Sometimes you may also accidentally write duplicate code that does the same thing you already coded before. You should practice DRY or do not repeat yourself in order to not have that code smell. 

There is also dispensable code. This is code that does not get used when the code gets executed. Since they are not used when the code gets executed, there is no reason to include them in your code. Duplicated code is an example of this. But you should also know that code smells do not always mean there is a problem in your code. Sometimes, you do need long methods or long bodies of code in order for you code to function correctly. If it does not function, then you just need to look deeper in the code to find the problem. 

Code smells are just an indicator of the problem rather than the problem themselves. To get rid of a code smell, developers usually try to do refactoring to the code. Refactoring is when a developer changes the inside of the code but on the outside, the code still does the same function. Code smells can be present even in code written by experienced programmers. It can reduce the lifetime of the software and make it difficult to maintain. Expanding the software functionalities also gets difficult when smelly codes are present. Code smells can go undetected a lot of times. Programmers should avoid and fix code smells to make their code cleaner and maintain functionality.

https://deepsource.io/glossary/code-smell/

 

From the blog Comfy Blog by Angus Cheng and used with permission of the author. All other rights reserved by the author.

APIs and REST APIs

Hello everyone and welcome back to my blog. Last week we talked about APIs in Activity 12 and I want to go more in depth about APIs and what a REST API is since I don’t really know what they are. API stands for Application Programming Interface and it is a set of definitions that allows two applications to talk to each other. Almost every application uses an API to communicate data from your device to a server. The server has its own APIs to receive that data and interpret it, and then send it back to your device. Then the application translates that data into a readable format for you. You do not have to know how they are implemented into your application, which can simplify the application development and save a lot of time. 

APIs can also give security by only allowing certain data through and not all the data. For example, when you buy an item on an online store, you tell the store what items you want to buy and the store tells you what you need to pay. No other information from either your device or the website’s databases is transferred over. What I find interesting about APIs is how they work in video games. There can be multiple APIs in a game that each do something different, such as managing a game’s sound, rendering, and graphics, while others manage AI tasks such as path-finding. Pokemon is one of the most popular video game series out there and there is an API called “Poke API” that has every single Pokemon listing with moves, types, and weaknesses as well as every item in the games. A Pokemon website can use that API to easily get the latest updated information about Pokemon and the games.

REST API or RESTful API stands for Representational State Transfer API. It usually takes advantage of HTTP when used for Web APIs. This means that developers do not need to install libraries or additional software in order to take advantage of a REST API design. However, not all APIs can be REST APIs. In order for an API to be RESTful, it has to follow certain criteria. The client and the server should be separate from each other and allowed to evolve individually and independently, meaning making changes to the database won’t affect the clients. Stateless client-server communication, meaning no client information is stored between get requests and each request is separate and unconnected. Cacheable data that streamlines client-server interactions. A uniform interface which lets the client talk to the server in a single language, standardized means of communicating between the client and the server. A layered system that organizes each type of server. And lastly, Code-on-demand, which is the ability to send executable code from the server to the client when requested. All of these define what REST APIs do.

https://www.redhat.com/en/topics/api/what-is-a-rest-api

From the blog Comfy Blog by Angus Cheng and used with permission of the author. All other rights reserved by the author.

APIs and REST APIs

Hello everyone and welcome back to my blog. Last week we talked about APIs in Activity 12 and I want to go more in depth about APIs and what a REST API is since I don’t really know what they are. API stands for Application Programming Interface and it is a set of definitions that allows two applications to talk to each other. Almost every application uses an API to communicate data from your device to a server. The server has its own APIs to receive that data and interpret it, and then send it back to your device. Then the application translates that data into a readable format for you. You do not have to know how they are implemented into your application, which can simplify the application development and save a lot of time. 

APIs can also give security by only allowing certain data through and not all the data. For example, when you buy an item on an online store, you tell the store what items you want to buy and the store tells you what you need to pay. No other information from either your device or the website’s databases is transferred over. What I find interesting about APIs is how they work in video games. There can be multiple APIs in a game that each do something different, such as managing a game’s sound, rendering, and graphics, while others manage AI tasks such as path-finding. Pokemon is one of the most popular video game series out there and there is an API called “Poke API” that has every single Pokemon listing with moves, types, and weaknesses as well as every item in the games. A Pokemon website can use that API to easily get the latest updated information about Pokemon and the games.

REST API or RESTful API stands for Representational State Transfer API. It usually takes advantage of HTTP when used for Web APIs. This means that developers do not need to install libraries or additional software in order to take advantage of a REST API design. However, not all APIs can be REST APIs. In order for an API to be RESTful, it has to follow certain criteria. The client and the server should be separate from each other and allowed to evolve individually and independently, meaning making changes to the database won’t affect the clients. Stateless client-server communication, meaning no client information is stored between get requests and each request is separate and unconnected. Cacheable data that streamlines client-server interactions. A uniform interface which lets the client talk to the server in a single language, standardized means of communicating between the client and the server. A layered system that organizes each type of server. And lastly, Code-on-demand, which is the ability to send executable code from the server to the client when requested. All of these define what REST APIs do.

https://www.redhat.com/en/topics/api/what-is-a-rest-api

From the blog Comfy Blog by Angus Cheng and used with permission of the author. All other rights reserved by the author.

APIs and REST APIs

Hello everyone and welcome back to my blog. Last week we talked about APIs in Activity 12 and I want to go more in depth about APIs and what a REST API is since I don’t really know what they are. API stands for Application Programming Interface and it is a set of definitions that allows two applications to talk to each other. Almost every application uses an API to communicate data from your device to a server. The server has its own APIs to receive that data and interpret it, and then send it back to your device. Then the application translates that data into a readable format for you. You do not have to know how they are implemented into your application, which can simplify the application development and save a lot of time. 

APIs can also give security by only allowing certain data through and not all the data. For example, when you buy an item on an online store, you tell the store what items you want to buy and the store tells you what you need to pay. No other information from either your device or the website’s databases is transferred over. What I find interesting about APIs is how they work in video games. There can be multiple APIs in a game that each do something different, such as managing a game’s sound, rendering, and graphics, while others manage AI tasks such as path-finding. Pokemon is one of the most popular video game series out there and there is an API called “Poke API” that has every single Pokemon listing with moves, types, and weaknesses as well as every item in the games. A Pokemon website can use that API to easily get the latest updated information about Pokemon and the games.

REST API or RESTful API stands for Representational State Transfer API. It usually takes advantage of HTTP when used for Web APIs. This means that developers do not need to install libraries or additional software in order to take advantage of a REST API design. However, not all APIs can be REST APIs. In order for an API to be RESTful, it has to follow certain criteria. The client and the server should be separate from each other and allowed to evolve individually and independently, meaning making changes to the database won’t affect the clients. Stateless client-server communication, meaning no client information is stored between get requests and each request is separate and unconnected. Cacheable data that streamlines client-server interactions. A uniform interface which lets the client talk to the server in a single language, standardized means of communicating between the client and the server. A layered system that organizes each type of server. And lastly, Code-on-demand, which is the ability to send executable code from the server to the client when requested. All of these define what REST APIs do.

https://www.redhat.com/en/topics/api/what-is-a-rest-api

From the blog Comfy Blog by Angus Cheng and used with permission of the author. All other rights reserved by the author.

APIs and REST APIs

Hello everyone and welcome back to my blog. Last week we talked about APIs in Activity 12 and I want to go more in depth about APIs and what a REST API is since I don’t really know what they are. API stands for Application Programming Interface and it is a set of definitions that allows two applications to talk to each other. Almost every application uses an API to communicate data from your device to a server. The server has its own APIs to receive that data and interpret it, and then send it back to your device. Then the application translates that data into a readable format for you. You do not have to know how they are implemented into your application, which can simplify the application development and save a lot of time. 

APIs can also give security by only allowing certain data through and not all the data. For example, when you buy an item on an online store, you tell the store what items you want to buy and the store tells you what you need to pay. No other information from either your device or the website’s databases is transferred over. What I find interesting about APIs is how they work in video games. There can be multiple APIs in a game that each do something different, such as managing a game’s sound, rendering, and graphics, while others manage AI tasks such as path-finding. Pokemon is one of the most popular video game series out there and there is an API called “Poke API” that has every single Pokemon listing with moves, types, and weaknesses as well as every item in the games. A Pokemon website can use that API to easily get the latest updated information about Pokemon and the games.

REST API or RESTful API stands for Representational State Transfer API. It usually takes advantage of HTTP when used for Web APIs. This means that developers do not need to install libraries or additional software in order to take advantage of a REST API design. However, not all APIs can be REST APIs. In order for an API to be RESTful, it has to follow certain criteria. The client and the server should be separate from each other and allowed to evolve individually and independently, meaning making changes to the database won’t affect the clients. Stateless client-server communication, meaning no client information is stored between get requests and each request is separate and unconnected. Cacheable data that streamlines client-server interactions. A uniform interface which lets the client talk to the server in a single language, standardized means of communicating between the client and the server. A layered system that organizes each type of server. And lastly, Code-on-demand, which is the ability to send executable code from the server to the client when requested. All of these define what REST APIs do.

https://www.redhat.com/en/topics/api/what-is-a-rest-api

From the blog Comfy Blog by Angus Cheng and used with permission of the author. All other rights reserved by the author.

APIs and REST APIs

Hello everyone and welcome back to my blog. Last week we talked about APIs in Activity 12 and I want to go more in depth about APIs and what a REST API is since I don’t really know what they are. API stands for Application Programming Interface and it is a set of definitions that allows two applications to talk to each other. Almost every application uses an API to communicate data from your device to a server. The server has its own APIs to receive that data and interpret it, and then send it back to your device. Then the application translates that data into a readable format for you. You do not have to know how they are implemented into your application, which can simplify the application development and save a lot of time. 

APIs can also give security by only allowing certain data through and not all the data. For example, when you buy an item on an online store, you tell the store what items you want to buy and the store tells you what you need to pay. No other information from either your device or the website’s databases is transferred over. What I find interesting about APIs is how they work in video games. There can be multiple APIs in a game that each do something different, such as managing a game’s sound, rendering, and graphics, while others manage AI tasks such as path-finding. Pokemon is one of the most popular video game series out there and there is an API called “Poke API” that has every single Pokemon listing with moves, types, and weaknesses as well as every item in the games. A Pokemon website can use that API to easily get the latest updated information about Pokemon and the games.

REST API or RESTful API stands for Representational State Transfer API. It usually takes advantage of HTTP when used for Web APIs. This means that developers do not need to install libraries or additional software in order to take advantage of a REST API design. However, not all APIs can be REST APIs. In order for an API to be RESTful, it has to follow certain criteria. The client and the server should be separate from each other and allowed to evolve individually and independently, meaning making changes to the database won’t affect the clients. Stateless client-server communication, meaning no client information is stored between get requests and each request is separate and unconnected. Cacheable data that streamlines client-server interactions. A uniform interface which lets the client talk to the server in a single language, standardized means of communicating between the client and the server. A layered system that organizes each type of server. And lastly, Code-on-demand, which is the ability to send executable code from the server to the client when requested. All of these define what REST APIs do.

https://www.redhat.com/en/topics/api/what-is-a-rest-api

From the blog Comfy Blog by Angus Cheng and used with permission of the author. All other rights reserved by the author.

APIs and REST APIs

Hello everyone and welcome back to my blog. Last week we talked about APIs in Activity 12 and I want to go more in depth about APIs and what a REST API is since I don’t really know what they are. API stands for Application Programming Interface and it is a set of definitions that allows two applications to talk to each other. Almost every application uses an API to communicate data from your device to a server. The server has its own APIs to receive that data and interpret it, and then send it back to your device. Then the application translates that data into a readable format for you. You do not have to know how they are implemented into your application, which can simplify the application development and save a lot of time. 

APIs can also give security by only allowing certain data through and not all the data. For example, when you buy an item on an online store, you tell the store what items you want to buy and the store tells you what you need to pay. No other information from either your device or the website’s databases is transferred over. What I find interesting about APIs is how they work in video games. There can be multiple APIs in a game that each do something different, such as managing a game’s sound, rendering, and graphics, while others manage AI tasks such as path-finding. Pokemon is one of the most popular video game series out there and there is an API called “Poke API” that has every single Pokemon listing with moves, types, and weaknesses as well as every item in the games. A Pokemon website can use that API to easily get the latest updated information about Pokemon and the games.

REST API or RESTful API stands for Representational State Transfer API. It usually takes advantage of HTTP when used for Web APIs. This means that developers do not need to install libraries or additional software in order to take advantage of a REST API design. However, not all APIs can be REST APIs. In order for an API to be RESTful, it has to follow certain criteria. The client and the server should be separate from each other and allowed to evolve individually and independently, meaning making changes to the database won’t affect the clients. Stateless client-server communication, meaning no client information is stored between get requests and each request is separate and unconnected. Cacheable data that streamlines client-server interactions. A uniform interface which lets the client talk to the server in a single language, standardized means of communicating between the client and the server. A layered system that organizes each type of server. And lastly, Code-on-demand, which is the ability to send executable code from the server to the client when requested. All of these define what REST APIs do.

https://www.redhat.com/en/topics/api/what-is-a-rest-api

From the blog Comfy Blog by Angus Cheng and used with permission of the author. All other rights reserved by the author.

APIs and REST APIs

Hello everyone and welcome back to my blog. Last week we talked about APIs in Activity 12 and I want to go more in depth about APIs and what a REST API is since I don’t really know what they are. API stands for Application Programming Interface and it is a set of definitions that allows two applications to talk to each other. Almost every application uses an API to communicate data from your device to a server. The server has its own APIs to receive that data and interpret it, and then send it back to your device. Then the application translates that data into a readable format for you. You do not have to know how they are implemented into your application, which can simplify the application development and save a lot of time. 

APIs can also give security by only allowing certain data through and not all the data. For example, when you buy an item on an online store, you tell the store what items you want to buy and the store tells you what you need to pay. No other information from either your device or the website’s databases is transferred over. What I find interesting about APIs is how they work in video games. There can be multiple APIs in a game that each do something different, such as managing a game’s sound, rendering, and graphics, while others manage AI tasks such as path-finding. Pokemon is one of the most popular video game series out there and there is an API called “Poke API” that has every single Pokemon listing with moves, types, and weaknesses as well as every item in the games. A Pokemon website can use that API to easily get the latest updated information about Pokemon and the games.

REST API or RESTful API stands for Representational State Transfer API. It usually takes advantage of HTTP when used for Web APIs. This means that developers do not need to install libraries or additional software in order to take advantage of a REST API design. However, not all APIs can be REST APIs. In order for an API to be RESTful, it has to follow certain criteria. The client and the server should be separate from each other and allowed to evolve individually and independently, meaning making changes to the database won’t affect the clients. Stateless client-server communication, meaning no client information is stored between get requests and each request is separate and unconnected. Cacheable data that streamlines client-server interactions. A uniform interface which lets the client talk to the server in a single language, standardized means of communicating between the client and the server. A layered system that organizes each type of server. And lastly, Code-on-demand, which is the ability to send executable code from the server to the client when requested. All of these define what REST APIs do.

https://www.redhat.com/en/topics/api/what-is-a-rest-api

From the blog Comfy Blog by Angus Cheng and used with permission of the author. All other rights reserved by the author.

APIs and REST APIs

Hello everyone and welcome back to my blog. Last week we talked about APIs in Activity 12 and I want to go more in depth about APIs and what a REST API is since I don’t really know what they are. API stands for Application Programming Interface and it is a set of definitions that allows two applications to talk to each other. Almost every application uses an API to communicate data from your device to a server. The server has its own APIs to receive that data and interpret it, and then send it back to your device. Then the application translates that data into a readable format for you. You do not have to know how they are implemented into your application, which can simplify the application development and save a lot of time. 

APIs can also give security by only allowing certain data through and not all the data. For example, when you buy an item on an online store, you tell the store what items you want to buy and the store tells you what you need to pay. No other information from either your device or the website’s databases is transferred over. What I find interesting about APIs is how they work in video games. There can be multiple APIs in a game that each do something different, such as managing a game’s sound, rendering, and graphics, while others manage AI tasks such as path-finding. Pokemon is one of the most popular video game series out there and there is an API called “Poke API” that has every single Pokemon listing with moves, types, and weaknesses as well as every item in the games. A Pokemon website can use that API to easily get the latest updated information about Pokemon and the games.

REST API or RESTful API stands for Representational State Transfer API. It usually takes advantage of HTTP when used for Web APIs. This means that developers do not need to install libraries or additional software in order to take advantage of a REST API design. However, not all APIs can be REST APIs. In order for an API to be RESTful, it has to follow certain criteria. The client and the server should be separate from each other and allowed to evolve individually and independently, meaning making changes to the database won’t affect the clients. Stateless client-server communication, meaning no client information is stored between get requests and each request is separate and unconnected. Cacheable data that streamlines client-server interactions. A uniform interface which lets the client talk to the server in a single language, standardized means of communicating between the client and the server. A layered system that organizes each type of server. And lastly, Code-on-demand, which is the ability to send executable code from the server to the client when requested. All of these define what REST APIs do.

https://www.redhat.com/en/topics/api/what-is-a-rest-api

From the blog Comfy Blog by Angus Cheng and used with permission of the author. All other rights reserved by the author.