Variables are a way of storing values so that we can use them again (and again) throughout our program or change them, if necessary.
Values can be a number or a piece of text.
Variables are a way of saving a piece of info with a specific name. We can reuse a value over and over again, when we give that value a name.
For example, we can pick a variable my_locker_number, and store a value into it.
That way, we can reuse that value over and over again in our code, without having to type out my_locker_number and the value, every single time.
my_locker_number = 223625 my_locker_number / 3 my_locker_number * 5
Two important reasons why we need variables in our code:
- To easily reuse values in different parts of our code – more efficient, avoid repetition, no hardcoding
- To change the values of our variables – more flexible, with multiple options (for example, drop downs)
Hardcoding: When you use a value without assigning it to a variable.
To declare a variable, we give the variable a name and set it equal to a value.
For example, name of variable: my_locker_number and value: 223625 becomes:
my_locker_number = '223625'
Video: What Makes an Effective Programmer?
Notes from the video:
1. Myth (programming is about how much you code) vs Truth (programming is about how smart you code)
Junior Developer: fixing bugs, pulling requests i.e. contributing to the code base
Mid-level Developer: contributing in meetings, making decisions
Senior Developer: to run code more effectively, deleting code more than you contribute.
You’d need to be deliberate, thoughtful, and strategic. Think: what kind of code do we write and how does that positively impact the business.
Refactoring: restructuring an existing body of code, changing its internal structure without changing its external behavior.
It takes a lot of time; you might have a cleaner code, so ask yourself: would it solve any of the business problems, help you serve more customers, or make money for the company?
2. Myth (programming is about how much you know) vs Truth (programming is about how well you learn and adapt to an influx of constantly new information)
There’s a baseline of information you need to become an effective programmer.
There’s always something new around the corner to learn i.e. on-the-job learning. The better you get as a programmer, the more challenging the work you do. If you get good:
- maybe, you’re working on something no one in your company is working on, or
- there’s just no online documentation for the problem you’re trying to solve
It all boils down to being able to learn and keep learning.
3. Myth (programming is for those who don’t like working with people; introverts) vs Truth (programming is still customer service)
You’ll still need to effectively work with your coworkers, clients, bosses, and other stakeholders. They have varying levels of technical understanding, and you’ll need to convince them, and make them understand your point of view.
As you work on large-scale applications, you’d need to be able to get people to sign off on your code, so that your code gets shipped.
You can write the best piece of code, but if it doesn’t get shipped, what’s the point?
Ship code: To deliver the code for use. For example, pack onto a CD, DVD, USB thumb drive; upload to a file, web, cloud server; upload on a local machine, or onto a machine at a client site, etc.
As an effective programmer:
- It’s about how smartly you program – make efficient decisions
- It’s about how well you learn – step into new problems and solve them
- It’s about customer service – effectively work with teams at multiple levels