The structure of data is something which is crucial in today’s world of programming. Constructs such as lists, graphs and trees are most commonly used to store data. In coming up with a design for a software, one needs to be good at choosing the right structure to store the given data in.
To figure this out, one approach could be to think about how the data appears in the real world while also thinking of how the data is going to be used or changed to solve the given problem.
For example, to design a program for a dictionary, one can think of how a real world dictionary is written. All the words are sorted alphabetically. So, when looking up a word, one can flip to the page containing words near to the one we are looking for. In computer science, a trie is a tree which allows for a prefix based look up. This could be an option to choose when designing a dictionary.
When developing software, one of the crucial tasks is to find potential problems in advance and fix them. In doing so, a developer needs to find ways to conceptually break the system. This is a useful way to make sure one’s code is robust and can withstand issues in the real world. This is a way to hunt for bugs and avoid major issues in the future
One can look at a software project and be dismayed at the number of problems it may have. Code quality is difficult to quantify but in general, readability, ease of maintainability and few basic bugs could be some of the things which indicate code quality.
One way to begin improve code quality is by beginning to clean up the code. One approach could be to employ the boy scout principle as a programming practice:
The Boy Scouts have a rule: “Always leave the campground cleaner than you found it.” If you find a mess on the ground, you clean it up regardless of who might have made the mess. You intentionally improve the environment for the next group of campers.
In programming, an algorithm is a way to codify a pattern which someone has recognized in solving a problem or a number of problems. In solving problems using mathematical tools, one comes up with theorems and rules. In computer programming, one comes up with algorithms.
The value of automated tests are no more evident than when one realizes that as the software keeps changing, things which were fixed previously remain fixed.
It is important to test individual features as part of development. One can use tools to find out code coverage to ensure that the tests cover as much of the code as possible. Also, all the condition/decision branches need to be covered.
Along with this, as bugs are discovered in the system, it pays to add automated tests to test the fixes for these bugs.
Some good ways to improve coding style include:
- Coding more
- Reading other people’s code
- Reading books and articles on good coding practice
It appears that the best work is always produced by those who care enough about it. This principle applies to programming as it does to any other type of work.
In my opinion, caring does not mean being zealous about it. As I see it, an attitude of dispassionate pride about the work is a good indicator of caring.
There is a common perception that if architects of buildings produced the same quality of work as some of the software out there, buildings would be horribly lopsided and flimsy.
To change this perception certainly requires a cultural shift focused on quality.
Starting off as a programmer several years ago, I was not very good at what I did. Now that I think about it, I feel like I did not have a clue as to what I was doing, especially during my graduate studies when working or taking courses.
It seems I learned a lot more after starting work in the industry. This was when a sort of discipline and rigor came to be part of the work. Such education is an ongoing process and never ends.
Of course, when it comes to learning soft skills, which are crucial in today’s world, it is still an ongoing learning process.
Overall, it is a long road, but the hope is one gets better as time passes.
When it comes to making changes to a software program, it helps greatly to have an automated test suite which has sufficient coverage of the code.
The advantage provided by having such a suite is that many fundamental errors are caught at an early stage. Also, when it comes down to the nitty gritty of any code change, a test suite acts like a good quality-inspector.
This way, users do not run into basic starting problems.
Many programming problems can appear very complex, but it helps a lot to break the problem down to smaller chunks, which can be understood more easily.
Upon breaking down the problem, the solutions to each component piece appear relatively simple.
Remember that all this is happening at a conceptual level. It is crucial to conceptually break down the problems and find solutions before actually going ahead and implementing anything.
Then one needs to conceptually put the smaller solutions back together and grasp the solution to the whole problem.
Thus, many problems can be solved with looking at it as simple sub-problems with simple sub-solutions.
It is a way of applying first principles to programming.
Then the fun of implementation begins…