Abstract
data types are essential for programmers because it helps write code that is
organized, shorter, understandable, and translatable into other languages. They
are a great tool for solving multiple problems with one solution. Employers
want programmers that not only write correctly, but in a smart and efficient
way.
One of
the benefits of brainstorming abstractly is to write organized code. This is a
tricky skill to develop because there isn't always just one right way to solve
a problem and sometimes the lazy approach is to solve it using the first
solution we come up with. This may not always be the best option though,
because execution speed and readability matter. A method to organizing code
that I found helpful is when given multiple problems, I breakdown each problem
in the language I am most familiar in (English) and write every necessary step to
arrive at a solution. Then I find the steps that are common to all or most
problems and I try to create a basic block that each problem can include in
their solution to solve their specific problem.
For
example, when asked to write code for many similar problems in the language Python,
it’s often the steps common to all problems are solved in the general class. We
can then write a specific class for each of the problems we were assigned that
are subclasses of the general class. Each specific class only worries about what
it has to add onto the general class, and it doesn’t have to worry about how
the general class does its job. This saves us from having to rewrite repetitive
code and makes the code easier to understand. When designing specific classes, we should
have a similar mindset and only worry about the specific problem at hand and
trust every other class to do its job.
By
solving the problem in a language we are most comfortable in, it makes
translating it into another language easier because we already have a blueprint
of how we would solve it. It is much easier to translate words into code than
translating code in one programming language into code from another programming
language.
No comments:
Post a Comment