+ 12

How can i choose the best code, between comparing two codes?????

6th May 2020, 2:00 PM
Pavithra Kanmanirajah
Pavithra Kanmanirajah - avatar
9 Réponses
+ 6
There are a lot of factors you could compare them for. Performance would be one. Readability. Efficiency. Maintainability. Safety. Quickwritability (I made that one up.) Countless books have been written about it. You probably have to decide that on a case-by-case basis, comparing two specific programs, and even then it would be a long discussion with differing opinions.
6th May 2020, 3:32 PM
HonFu
HonFu - avatar
+ 5
You can compare them on the basis of time and space complexities of the programs.
6th May 2020, 2:06 PM
Arsenic
Arsenic - avatar
+ 4
Thank u
7th May 2020, 6:01 AM
Pavithra Kanmanirajah
Pavithra Kanmanirajah - avatar
+ 2
U have to consider the time , style and your soul's favouracy
7th May 2020, 10:30 AM
Zakaria Hasan 🇧🇩
Zakaria Hasan 🇧🇩 - avatar
0
The best answer would be on two cases. 1. Based on whether the code has flexibility or not. What I mean is, if you want to edit or other wants to access it later, will it be easier for them to access it ? And if yes, then go for that. 2. This is important as your code should be DRY principle based. Meaning: Don't repeat yourself. So the choice you made must be short and non-repeating. Thanks.
7th May 2020, 12:10 AM
Suraj K Thapa
Suraj K Thapa - avatar
0
It depends on the outcome you expect in my view. Do you want fast, easy-to-read code or high quality? And so on.. There are many factors, and each code has its advantages and disadvantages, and it has something that distinguishes it from other codes. So, before you do the comparison essentially, you have to choose the feature you want and make it a basis for comparison :)
7th May 2020, 8:57 PM
Mohammed Abu Shqear
Mohammed Abu Shqear - avatar
0
The best code for any problem statement is - DRY Don't Repeat Yourself. Voila ! Yr code is a masterpiece.
8th May 2020, 7:38 AM
Rahul Singh
Rahul Singh - avatar
- 2
You can compare them on the basis of time and space complexities of the programs.
7th May 2020, 9:58 AM
Mohammed Khamis
Mohammed Khamis - avatar
- 7
Mohammad Yahya Azhar Please do not copy paste existing answers.
6th May 2020, 6:30 PM
Mohammad Yahya Azhar
Mohammad Yahya Azhar - avatar