Advent of Code is an Advent calendar of small programming puzzles for a variety of skill sets and skill levels that can be solved in any programming language you like. People use them as a speed contest, interview prep, company training, university coursework, practice problems, or to challenge each other. In this talk, the creator of Advent of Code will give a behind-the-scenes look at what it takes to run a month-long programming event for over 200,000 people.
johnnythecoder has been nominated for the Hacker Noon Contributor of the Year - LEARNING award!
Although we still talk about programming as a standalone career, the dominance of technology in our lives makes it clear that coding is much more than a career path. In my opinion, computer science is more than a college major or a high-paid job; it’s a skill, essential for thriving in a modern-day economy.
Whether you work in healthcare, marketing, business, or other fields, you will see more coding and have to deal with a growing number of technologies throughout your entire life.
Now that we live in a tech-driven world, asking “Should I learn to program” is almost synonymous with “Should I learn to speak, read, or count?”
The short answer is: yes.
How to start your journey in coding? The good news is there are plenty of resources to support you all the way through. To save you the trouble of looking them up and choosing the right ones, I created my list of learning platforms that offer well-rounded programming education and help you stay competitive on the job market.
Here are 12+ useful educational resources every coding student should check out.
#learning-to-code #learn-to-code #coding #programming #programming-languages #free-programming-sites #self-improvement #learn-to-code-free-online
Code Golf is a game that is designed to let programmers show off their excellency in codes by solving problems in the least number of characters. The word “Golf” in code golfing refers to the popular game golf where two players compete with each other, and the one with the fewest club strokes wins.
Similar to the golf game, code golf is a competition where the winner achieves the specifications in the fewest keystrokes. It is basically a kind of recreational computer programming competition where the participants compete to achieve the shortest possible source code that implements a certain algorithm.
Code Golfing can be said as a classic playground for programmers where the main attempt is to solve a problem with the least number of characters. It is written in Go language, licensed under MIT and is available on GitHub.
Below here, we listed general tips of Code Golf that are implemented in popular languages like
Python and others.
Original- if a<b:return a
**Code Golf- **return(b,a)[a<b]
Original- if a > 1 and b > 1 and 3 > a and 5 > b: foo()
Code Golf- if 3 > a > 1 < b < 5: foo()
Original- while foo(a):
**Code Golf- *while foo(a):print a;a=2
**Code Golf- **A+=B,
**Original- **from math import ceil
n = 3/2
Code Golf- n = 3/2
The score of your solution is the count of the Unicode characters in your source code. This means both “A” (U+0041 Latin Capital Letter A) and “” (U+1F609 Winking Face) cost the same despite the 1:4 ratio in byte count in UTF-8.
For each hole, the shortest solution is awarded 1,000 points, with the points decreasing in uniform decrements per rank. Your overall score is simply the sum of your points in each hole. Also, the execution time is limited to 5 seconds.
#developers corner #code golf #code golfing #coding #coding competition #programming #programming platforms
Static code analysis refers to the technique of approximating the runtime behavior of a program. In other words, it is the process of predicting the output of a program without actually executing it.
Lately, however, the term “Static Code Analysis” is more commonly used to refer to one of the applications of this technique rather than the technique itself — program comprehension — understanding the program and detecting issues in it (anything from syntax errors to type mismatches, performance hogs likely bugs, security loopholes, etc.). This is the usage we’d be referring to throughout this post.
“The refinement of techniques for the prompt discovery of error serves as well as any other as a hallmark of what we mean by science.”
We cover a lot of ground in this post. The aim is to build an understanding of static code analysis and to equip you with the basic theory, and the right tools so that you can write analyzers on your own.
We start our journey with laying down the essential parts of the pipeline which a compiler follows to understand what a piece of code does. We learn where to tap points in this pipeline to plug in our analyzers and extract meaningful information. In the latter half, we get our feet wet, and write four such static analyzers, completely from scratch, in Python.
Note that although the ideas here are discussed in light of Python, static code analyzers across all programming languages are carved out along similar lines. We chose Python because of the availability of an easy to use
ast module, and wide adoption of the language itself.
Before a computer can finally “understand” and execute a piece of code, it goes through a series of complicated transformations:
As you can see in the diagram (go ahead, zoom it!), the static analyzers feed on the output of these stages. To be able to better understand the static analysis techniques, let’s look at each of these steps in some more detail:
The first thing that a compiler does when trying to understand a piece of code is to break it down into smaller chunks, also known as tokens. Tokens are akin to what words are in a language.
A token might consist of either a single character, like
(, or literals (like integers, strings, e.g.,
Bob, etc.), or reserved keywords of that language (e.g,
def in Python). Characters which do not contribute towards the semantics of a program, like trailing whitespace, comments, etc. are often discarded by the scanner.
Python provides the
tokenize module in its standard library to let you play around with tokens:
code = b"color = input('Enter your favourite color: ')"
for token in tokenize.tokenize(io.BytesIO(code).readline):
TokenInfo(type=62 (ENCODING), string='utf-8')
TokenInfo(type=1 (NAME), string='color')
TokenInfo(type=54 (OP), string='=')
TokenInfo(type=1 (NAME), string='input')
TokenInfo(type=54 (OP), string='(')
TokenInfo(type=3 (STRING), string="'Enter your favourite color: '")
TokenInfo(type=54 (OP), string=')')
TokenInfo(type=4 (NEWLINE), string='')
TokenInfo(type=0 (ENDMARKER), string='')
(Note that for the sake of readability, I’ve omitted a few columns from the result above — metadata like starting index, ending index, a copy of the line on which a token occurs, etc.)
#code quality #code review #static analysis #static code analysis #code analysis #static analysis tools #code review tips #static code analyzer #static code analysis tool #static analyzer
This article will introduce the concepts and topics common to all programming languages, that beginners and experts must know!
Do you want to learn a programming language for the first time?
Do you want to improve as a Programmer?
Well, then you’re in the right place to start. Learn any programming language without difficulty by learning the concepts and topics common to all programming languages.
Let me start by answering the following questions:
Programming develops creative thinking
Programmers solve a problem by breaking it down into workable pieces to understand it better. When you start learning to program, you develop the habit of working your way out in a very structured format. You analyze the problem and start thinking logically and this gives rise to more creative solutions you’ve ever given.
Whether you want to uncover the secrets of the universe, or you just want to pursue a career in the 21st century, basic computer programming is an essential skill to learn.
_– _Stephen Hawking
Everybody in this country should learn how to program a computer… because it teaches you how to think.
_- _Steve Jobs
Programming Provides Life-Changing Experiences
Programming always provides you with a new challenge to take risks every time and that teaches you to take risks in your personal life too. The world is filled up with websites, apps, software and when you build these yourself you’ll feel more confident. When a programmer solves a problem that no one has ever solved before it becomes a life-changing experience for them.
A program is a set of instructions to perform a task on a computer.
Programming is the process of designing and building an executable computer program to accomplish a specific task.
Well, according to me programming is like raising a baby. We provide knowledge (data) to help understand a baby what’s happening around. We teach a baby to be disciplined (and much more) by making rules.
Similarly, a computer is like a baby. We set rules and provide data to the computer through executable programs with the help of a Programming Language.
That’s it👍. If you can understand this basic concept of programming, you’re good to go. Pick up a programming language and start learning. Read the following section to get an idea of where to start.
My recommendation is to choose Python Programming Language as a start, because it’s beginner-friendly.
#programming #programming-tips #programming-language #programming-top-story #computer-science #data-structures-and-algorithms #tips-for-programmers #coding
There is no better moment for me than starting a brand new project.
Smells like new project spirit… (Whatever it means)
Starting a new project is funny. Everything seems to be in the right place. But as the projects grow and the deadlines come closer the things begin to boiling.
So, let’s talk about signals that can tell us if our code sucks and we how we can avoid that.
I guess we all have known at least one project that anyone wants to touch, or heard the phrase:
It works, don’t touch it!
Well, that’s not a good signal. I know there are complex projects, big projects, but if nobody in your team can touch it without breaking something, then there is something wrong with that code.
Code is like a garden, it needs to be treat and maintained, if it grows in size or complexity with no control, then will be harder to maintain and easily can get death.
Code grows out of control when there are no conventions to work in it, team practices, even solo practices are important to keep our code under control.
If you see yourself in a scenario where is hard to add things to your project, then you should rethink the whole thing.
If only one person in your team can understand a project, then that’s a problem and hopefully that person never gets sick or goes on vacation.
If you are working by yourself please don’t write overcomplicated code; in my experience simplicity is better; writing code that anyone can read is the right thing to do.
t is clear today may not be that clear in a couple of weeks, even for you.
Use comments on your code. Do not comment on every single line but put enough comments on the complicated and crucial parts.
I have to insist on this. Simple is better; there is no need to show anyone how abstract you can be or how much you know the language. Keeping things simple is way much more productive than trying to show off your knowledge and skill.
Keep your code as readable as possible, simple as possible. Clear variable names, descriptive functions names, clear statements. This will save time for you and your team.
A good way to measure how readable your code is is to overcome the necessity of comments. If the code does not need many comments to describe it, then it means the code is readable enough.
The best code is not only the one that is fast and performant; the best code is also the one you enjoy working on. I’ve had nightmares of codebases that I had to work with, and I also have had codebases that I enjoy.
Coding is a team sport, and every member of the team must be able to play the game, so write for the team.
#development #programming #software-development #coding #coding-skills #software-engineering #code-quality #code