- Development
- 2020-02-12
Correct Programming Principles
By: Hexa
Correct Programming Principles:
Several concepts and methods that exist are named Principles of Programming. They aim to help you write the code in a certain way and to divide its various parts through correct scientific and practical methods that contribute to gaining the advantages of these correct principles.
Using standardized code writing achieves the objective of writing an easily-read code and maintaining and understanding it.
Correct Programming Principles:
Several concepts and method that exist are named Principles of programming. They aim to help you write the code in a certain way and to divide its various parts through correct scientific and parcitical methods that contribute to gaining the advantages of these correct principles.
- 1. Abstraction
It is the process of eliminating the nonnessential features from the target to be abstracted and preserving the essential features related to this target. It also aims at generalization, not specialization.
Abstraction in programming holds the same concept as mentioned above as it aims at dividing large systems into smaller ones with defined
functions. so, instead of the system being one program with several user monitors, reports and data, it is better to divide it into layers such as a layer dealing with the user, to be named the user interface, another layer to receive and implement user requests, and another layer for data storage. Each layer will be fixed to a separate server when the system is large one.
Programs can also be divided into more specialized units from the functional perspective.For example, an account, cheques and storage system can be divided into units with each function having a separate program or programming unit that could be developed independently. There could also be a type of abstraction at the level of processes and code writing. So, instead of writing a long and complicated process, this process can be divided into several simple primary processes, each aiming at achieving a general function and allowing its re-use.
- 2. Code re-Usability
Re-using codes is a corect programming principle in program engineering. It reduces the amount of time needed to develop and maintain programs and reduces cost. It also facilitates and simplifies complicated programs and reduces cost. It also facilitates and simplies programs and allows their continued development and increased capabilities.
- 3. Simplicity
Among the main principles of correct programming is simplicity. Program development has become more complicated than the past and the modern direction is towards more simplicity by creating simpler languages, systems and database engines.
Simplicity in program development includes the selection of the simplest tool to achieve the work. Otherwise, that tool would become a new constraint beginning by learning it, providing the environment it needs to perform its basic work, and ending with providing programmers to work on it and providing them with the time needed to study and perfect it. Simplicity also involves the system’design regarding its various parts and methods of connection between them and the operational and developmental environment needed to implement the project.
- 4. Single Responsibility
The idea of this principle is simply that writing a unit or code has one objective such as reading data from a relational database. It can be named as an access unit or if concerned with a user interface, it can be named a presentation unit. It could be in the form of a file, a class or even a complete layer according to the division system used and the size of the specialized unit. This allows us to assign one reason for change to each unit. For example, if the task is to change the user interface, this will not affect the method of reading information from the database and makes the code easier to amend.
- 5. Hiding Implementatin Details
The aim of hiding implementation details is to reduce the connection between programs that rely on a certain part of the code such as a unit, library or group. This reduction is carried out by disallowing the beneficiaries of these units from accessing the unit’s details such as variables and internal processes. Otherwise, if a change takes place to these variables or internal processes, all benefitting units must be changed. Therefore, we should prevent access to these data and processes and allow access through one point only or a small number of points such as using one funation only named as the programming interface.
- 6. Open Closed Principle
This is a correct programming principle which is concerned with allowing an increase to the capabilities of a programming part, and adding to and using it without amending it. The aim of this method is re-using it without affecting the basic code.
- 7. Cohesion
Cohesion refers to the relationship between processes and data in one group or unit. The stronger the relationship between processes, the btter the cohesion is.However, if no or a weak relationship is present, this shall be named weak cohesion.
Among the benefits of cohesion is the easy understanding and, therefore, the maintenance and development of a unit. This allows re-use and easy testting and when change is made to it, this does not affect the remaining units.
- 8. Decoupling
Decoupling refers to a connection between two units or two processes in a way that does not allow use of one process, unit or group without the use of the other. It also implies that one unit’s work affects the other and that the programming units are not autonomous and incoherent. this is regarded as incorrect program designing as it makes decoupled units non-reusable and difficult to develop. Also, discovering errors and performing tests become more difficult.
- 9. Standardization of code
It refers to the use of the standard method of code writing, whether regarding the programming language used or the types of programs to be developed.
Using standardized code writing achieves the objective of writing an easily-read code and maintaining and understanding it. Each programming language can have standard method of code writing and each programming institution may have a standard custom and defined approach of writing and designing programs. Following this custom helps to manage programming projects and helps to maintain them easily.
Tags
Programming Principles
Code re-Usability
Java
HTML5
CSS
Jquery
PHP Laravel
How to write the code