# Coding and Bullshit
**How can one get better at logic in programming?**
I feel like it’s my major setback as a self-learner. Udemy courses and YouTube videos can’t teach you this skill. Is it even a skill that can be learned or is it a natural talent?
programming is a 100% skill.
You are quire right that you cannot learn it from watching others via videos or courses. I can offer some insight.
Learning logic is just like learning mathematics. It’s a skill that you have to develop by doing. This could be by direct application in programming, or it could be indirectly by doing logic puzzles. The critical parts of the skill are:
1: Understanding the formal moves you can make in your system.
2: Breaking your problem down into small pieces such that you can address each part in a simple way.
3: Understanding how to apply the moves to get where you need.
It sounds simple, but as anyone that has ever done mathematics knows, the application of simple rules can be very challenging at times. Doing some mathematics can certainly help, since the core skills are very similar. Again, the critical part being doing – actually solving problems. Or doing some formal logic problem sets would also be worthwhile in developing these skills.
The absolute critical part is learning to solve the problems for yourself. If you watch videos or copy others solutions that’s never going to get you where you need to be. Seeing solutions is helpful, but doing the solving yourself must make up the core of your practice.
**Learning to Code: How to Think Like a Programmer**
*Think Like a Programmer Book Summary*
You’ve probably heard the expression "think like a programmer." This means having the ability to see a challenge from one angle, then being able to take a step back and look at the same challenge from an alternative perspective. Do this over and over again until you find a solution.
Will this book make you a better programmer? Will it teach you to write better code, better syntax? No. However, this book will teach you what you are doing wrong in your code, how to streamline your code, and how to step back, take a breather and re-evaluate it for better or worse. Though I haven’t touched a line of C++ code in over a decade I was able to read this book (and even take some of the examples, turning them into C) and learn some of the mistakes I have made over the years. There were many times where I had been frustrated writing a program or a script, and in my frustration I turned out convoluted, obscure code that made absolutely no sense yet it ran in some twisted, duct tape and twine way. Had I read this book previously, taken a step back and utilized the steps illustrated in the book to properly evaluate what my end goal was then my end results would be the same (code runs) yet with fewer problems along the way.
This document presents some guidelines to approach the solution of a great variety of problems, particularly those presented in computer programming.
The strategy consists of five big steps:
* Read and comprehend the problem statement.
* Select theoretical concepts that may be applied.
* Qualitative description of the problem.
* Formalization of a solution strategy.
* Test and description of the solution.
Each step has attached a questionnaire, which contain questions that will lead you toward the solution of the problem or, if needed, to step back and review your work.
**Guiding-questionnaires to be used with the General Strategy for algorithm creation**
1. **Guide 1**
* Do you understand every word used within the problem statement?
* What computational elements are relevant to the problem?
* What non-computational elements are relevant to the problem: Mathematics, Physics, Geography, etc.
* Use your own words to describe the problem. If needed, make a drawing depicting the situation stating clearly relevant objects and times.
* Have you solved any similar problem? If so, take advantage of that experience and its information.
* What data or resources are provided within the statement?
* What data or results are requested within the statement?
* Check answers 6 and 7 and decide if they are consistent with your answers 2 and 3.
2. **Guide 2**
* Identify all theoretical (and empirical) concepts related with the problem.
* Select a structure able to simplify data handling: arrays, records, files, local variables, global variables, linked lists, etc.
* Identify the kind of problem(s) according with its (their) structure: sequential, selection, iterative.
* Identify available algorithmic elements and select: what you need: well-defined instructions, already known algorithms, etc.
* Is it possible to simplify the problem by dividing it into simpler cases and selecting a different approach for each one? Is it possible eliminate redundant or unnecessary data?
3. **Guide 3**
* Do you know any hand-written way to solve the problem? If so, propose several examples and solve them "by hand", then attempt to create a generalization. In order to do that, carefully think on each step performed and watch what actions are common to every example.
* Make a list of variable elements, specifying their magnitude and measurement units. Associate them proper symbols or names but take care of avoid their repetition
* Which principles or relationships apply to the problem?
* Write down the selected relationships but using your own variables (symbols or names). If needed, describe equations with words.
* Are all variables in use? Are there as many relationships as unknown variables?
* Are you using all the information available in the problem statement? If not, select just the important.
4. **Guide 4**
* Describe your solution qualitatively (you can start by making a narration.)
* Make some predictions regarding the expected result based only upon the description you made. Do not assume anything that is not in your description.
* Make the required relationships and check that the result comes from the selected variables. (Keep in mind the measurement units.)
* Substitute values (with their corresponding signs and units) at the end of your development of relationships.
* Transform your description into an algorithm (pseudocode or flowchart). Remember, the algorithm must ask unknown values, show main results and store (in variables) the results of relationships and formulas.
5. **Guide 5**
* Manually compute the result (i.e. perform a hand-trace.) If needed, draw plots that describe the behavior of the variables.
* Follow strictly each step of the algorithm and look at the results. (Someone else can perform this step.)
* Are all your predictions from 4.2 accomplished? Measurement units are preserved?
* Do the units make sense?
* Is reasonable the order of magnitude of results?
* Does it work for boundary values?
* Do every variable has an initial value?
* Interpret the result to write down an explanation of it (how it was produced) and assign units.
**How to Learn Programming**
```
Master: “Ah Grasshopper. Learning to program is like eating an elephant.”
Grasshopper: “But master, how is it like eating an elephant?”
Master: “You start at any point and just begin eating. Eventually you will have eaten the whole elephant.”
```
Each of the steps in this article discusses a "coding essential" – something that I believe is critical to at least know that it exists at the start of your coding journey.
One final note before listing the steps in the roadmap: of course reading this article will not make you an expert programmer. It isn't meant to. The purpose of this article is to make you aware that each one of these topics exists, and hopefully give you a basic idea of how each one works so you can build on it intelligently going forward.
1. **Choose a language with purpose**
Whether you're learning code for the first time or furthering your education, you should know what you want to learn and why.
Are you interested in web development or game development? How about data science? Different programming languages have different applications, so you'll want to have a goal in mind before choosing one. If you're interested and engaged in a subject, you'll grasp the material better and move along at a much quicker pace.
2. **Start with the basics**
[yaha se padh lo](https://www.freecodecamp.org/news/the-python-guide-for-beginners/)
3. **Practice**
[With basics clear, Atleast try to solve introductory problems within week.](https://cses.fi/problemset/)
4. **Build something**
[Too hard ?? 🥵😂](https://jeffknupp.com/blog/2014/09/01/what-is-a-nosql-database-learn-by-writing-one-in-python/)
[Something practical ig 🤡](https://colab.research.google.com/github/norvig/pytudes/blob/main/ipynb/Sudoku.ipynb)
# Algorithms and Data Structures
Coming Soon!