1. Introduction
Computers are awesome. The human race has seen more advancements in the last 50 yearsthan in the entire 10,000 years of human history. Technology has transformed the way welive our daily lives, how we interact with each other, and has changed the course of ourhistory. Today, everyone carries smart phones which have more computational power thansupercomputers from even 20 years ago.
Computing has become ubiquitous, the “internetof things” will soon become a reality in which every device will become interconnectedand data will be collected and available even about the smallest of minutiae.However, computers are also dumb. Despite the most fantastical of depictions in sciencefiction and and hopes of Artificial Intelligence, computers can only do what they are toldto do. The fundamental art of Computer Science is problem solving.
Computers arenot good at problem solving; you are the problem solver. It is still up to you, the user,to approach a complex problem, study it, understand it, and develop a solution to it.Computers are only good at automating solutions once you have solved the problem.Computational sciences have become a fundamental tool of almost every discipline.Scholars have used textual analysis and data mining techniques to analyze classicalliterature and historic texts, providing new insights and opening new areas of study.Astrophysicists have used computational analysis to detect dozens of new exoplanets.Complex visualizations and models can predict astronomical collisions on a galactic scale.Physicists have used big data analytics to push the boundaries of our understanding ofmatter in the search for the Higgs boson and study of elementary particles.
Chemistssimulate the interaction of millions of combinations of compounds without the need forexpensive and time consuming physical experiments. Biologists use massively distributedcomputing models to simulate protein folding and other complex processes. Meteorologistscan predict weather and climactic changes with ever greater accuracy.
Technology and data analytics have changed how political campaigns are run, howproducts are marketed and even delivered. Social networks can be data mined to trackand predict the spread of flu epidemics. Computing and automation will only continueto grow. The time is soon coming where basic computational thinking and the abilityto develop software will be considered a basic skill necessary to every discipline, arequirement for many jobs and an essential skill akin to arithmetic.Computer Science is not programming. Programming is a necessary skill, but it is onlythe beginning. This book is intended to get you started on your journey.
1.1. Problem Solving
At its heart, Computer Science is about problem solving. That is not to say that onlyComputer Science is about problem solving. It would be hubris to think that ComputerScience holds a monopoly on “problem solving.” Indeed, it would be hard to find anydiscipline in which solving problems was not a substantial aspect or motivation if notintegral. Instead, Computer Science is the study of computers and computation. Itinvolves studying and understanding computational processes and the development ofalgorithms and techniques and how they apply to problems.
Problem solving skills are not something that can be distilled down into a single stepby-step process. Each area and each problem comes with its own unique challenges andconsiderations. General problem solving techniques can be identified, studied and taught,but problem solving skills are something that come with experience, hard work, and mostimportantly, failure. Problem solving is part and parcel of the human experience.
That doesn’t mean we can’t identify techniques and strategies for approaching problems,in particular problems that lend themselves to computational solutions. A prerequisiteto solving a problem is understanding it. What is the problem? Who or what entitiesare involved in the problem? How do those entities interact with each other? What arethe problems or deficiencies that need to be addressed? Answering these questions, weget an idea of where we are.
Ultimately, what is desired in a solution? What are the objectives that need to beachieved? What would an ideal solution look like or what would it do? Who would usethe solution and how would they use it? By answering these questions, we get an idea ofwhere we want to be. Once we know where we are and where we want to be, the problemsolving process can begin: how do we get from point A to point B?
One of the first things a good engineer asks is: does a solution already exist? If a solutionalready exists, then the problem is already solved! Ideally the solution is an “off-the-shelf”solution: something that already exists and which may have been designed for a differentpurpose but that can be repurposed for our problem. However, there may be exceptionsto this. The existing solution may be infeasible: it may be too resource intensive orexpensive. It may be too difficult or too expensive to adapt to our problem. It may solvemost of our problem, but may not work in some corner cases. It may need to be heavilymodified in order to work. Still, this basic question may save a lot of time and effort inmany cases.In a very broad sense, the problem solving process is one that involves
1. Design
2. Implementation
3. Testing
4. Refinement
After one has a good understanding of a problem, they can start designing a solution. Adesign is simply a plan on the construction of a solution. A design “on paper” allowsyou to see what the potential solution would look like before investing the resources inbuilding it. It also allows you to identify possible impediments or problems that werenot readily apparent.
A design allows you to an opportunity to think through possiblealternative solutions and weigh the advantages and disadvantages of each. Designing asolution also allows you to understand the problem better. Design can involve gatheringrequirements and developing use cases. How would an individual use the proposedsolution? What features would they need or want?
Implementations can involve building prototype solutions to test the feasibility of thedesign. It can involve building individual components and integrating them together.
Testing involves finding, designing, and developing test cases: actual instances of theproblem that can be used to test your solution. Ideally, the a test case instance involvesnot only the “input” of the problem, but also the “output” of the problem: a feasible oroptimal solution that is known to be correct via other means. Test cases allow us to testour solution to see if it gives correct and perhaps optimal solutions.
Refinement is a process by which we can redesign, reimplement and retest our solution.We may want to make the solution more efficient, cheaper, simpler or more elegant. Wemay find there are components that are redundant or unnecessary and try to eliminatethem. We may find errors or bugs in our solution that fail to solve the problem for someor many instances. We may have misinterpreted requirements or there may have beenmiscommunication, misunderstanding or differing expectations in the solution betweenthe designers and stakeholders. Situations may change or requirements may have beenmodified or new requirements created and the solution needs to be adapted. Each ofthese steps may need to be repeated many times until an ideal solution, or at leastacceptable, solution is achieved.
Yet another phase of problem solving is maintenance. The solution we create may needto be maintained in order to remain functional and stay relevant. Design flaws or bugsmay become apparent that were missed in previous phases. The solution may need to beupdated to adapt to new technology or requirements.
In software design there are two general techniques for problem solving; top-down andbottom-up design.
A top-down design strategy approaches a problem by breaking itdown into smaller and smaller problems until either a solution is obvious or trivial or apreexisting solution (the aforementioned “off-the-shelf” solution) exists. The solutions tothe subproblems are combined and interact to solve the overall problem.A bottom-up strategy attempts to first completely define the smallest components or
entities that make up a system first. Once these have been defined and implemented,they are combined and interactions between them are defined to produce a more complexsystem.
0 Comments