Absorb Knowledge in 30 Seconds | Brain Bytes #2
Loïc Boset
Posted on July 17, 2021
Recap
Brain Bytes is a knowledge platform where you can learn new things about software development in less than 30 seconds.
Bytes of the Week
Domain-Specific Language (DSL)
A domain-specific language is a computer language specialized to a particular application domain. This is in contrast to a general-purpose language (GPL), which is broadly applicable across domains.
For example, HTML is a DSL for web pages.
Extract Method Refactoring
The more lines found in a method, the harder it’s to figure out what the method does.
Move this code to a separate new function and replace the old code with a call to the method.
void printOwing() {
printBanner();
// Print details.
System.out.println("name: " + name);
System.out.println("amount: " + getOutstanding());
}
becomes
void printOwing() {
printBanner();
printDetails(getOutstanding());
}
void printDetails(double outstanding) {
System.out.println("name: " + name);
System.out.println("amount: " + outstanding);
}
Web Accessibility (a11y)
Web accessibility is the inclusive practice of ensuring there are no barriers that prevent interaction with, or access to, websites on the World Wide Web by people with physical disabilities, situational disabilities, and socio-economic restrictions on bandwidth and speed.
When sites are correctly designed, developed and edited, generally all users have equal access to information and functionality.
Open–closed principle
In object-oriented programming, the open–closed principle states "software entities (classes, modules, functions, etc.) should be open for extension, but closed for modification". That is, such an entity can allow its behaviour to be extended without modifying its source code.
In practice: write your code so that you will be able to add new functionality without changing the existing code and preventing situations in which a change to one of your classes also requires you to adapt all depending classes.
Oauth
Oauth is an authorization protocol. OAuth doesn’t share your password but instead uses authorization tokens to prove an identity between consumers and service providers. For example, you can share some of your Google account information with a third-party provider without giving it your password data.
OAuth is a popular solution for both websites and users because it's more secure than sharing credentials and allows users to utilize services across multiple platforms.
Cross Site Scripting (XSS) Attacks
XSS attacks are a type of attack where a malicious script (e.g. Javascript) is injected into a website.
Flaws that allow these attacks to succeed are quite widespread and occur anywhere a web application uses input from a user without validating it.
Remember to always validate your user's input.
You are welcome to participate!
Brain Bytes is an open source project, so feel free to comment and reach out to me in any way should you want to participate in its development! There is plenty to do!
Come now and share your knowledge!
Thanks for reading 🙏 ❤️
Posted on July 17, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.