Thermacell Radius Mosquito Repellent

Thermacell Radius Mosquito Repellent

Price: $50  | Buy | Link

Protect yourself from those nasty bugs wherever you are with Thermacell’s Radius Zone Mosquito Repellent. It’s a rechargeable device that creates a 110sqft scent-free zone of protection against mosquitoes. It lasts up to 6h per charge, and each refill lasts up to 40h.

via The Awesomer
Thermacell Radius Mosquito Repellent

360º LEGO Train Factory Ride

360º LEGO Train Factory Ride

Link

BananenBuurman takes us on another fun ride on one of his LEGO railway constructions, this time taking a trip through his Grandpa’s factory, as tools, wood, and workbenches loom large. Want your own LEGO railway? Hit Trixbrix, and use code “crazybananen” for 10% off.

via The Awesomer
360º LEGO Train Factory Ride

5 Signs You Need to Start Removing Toxic People

They say you become just like the company you keep. Therefore, picking and choosing friends is one of life’s most underrated skills.

Friends make or break you. The right group of friends will help you get through life and succeed while the wrong ones will hold you down and potentially destroy you.

Moving through life, you’ll encounter countless people, many of whom you will call your “friend” at one point in life. Unfortunately, not every friend stays. In fact, the average length of a friendship is said to only be around seven years.

Most often, friends come and go but there are few who stick around for better or worse.

Not everyone who sticks is good for the relationship. Sometimes you must make the difficult choice of removing toxic people for your personal well-being.

Recognize these five signs to help you make this choice.

You Feel Drained Each Time You Hang Out

toxic friends

When you’ve been friends for a while, you’ve likely had your fair share of good and bad moments. Friends are there for you during bad times and vice versa. But this doesn’t excuse friends who always seem to suck the energy out of you every time.

Friends like these are toxic. They are usually negative, judgmental, and seem to be using you as a personal therapist to deal with their issues. This is extremely draining.

Cut these types of “friends” off before their negativity rubs off on you. Have some respect for yourself. You are not a personal punching bag.

See Also: 8 Types of Toxic Friends That Are Holding Your Happiness Hostage

You Can’t Compromise on Personal Values

It’s necessary to have friends from all walks of life because they offer you different views and help you grow. However, there are friends who you will never see eye-to-eye with.

Initially, it may not be a problem dealing with these friends but as you move further in life, your personal differences may just be too big to ignore.

Compromising on things like what to eat or what to watch is one thing. But when you are dealing with differences in life choices, you can’t afford to be with someone who contradicts you too often.

You’re the Only One Doing the Work

It takes two to tango. Otherwise, you’re just dancing with yourself. The same theory applies to friendship.

When you start realizing that you’re the only one making any effort to hang out or talk, that’s a red flag that your friend doesn’t value your friendship as much as you do.

Life happens and sometimes we become busy and burdened by responsibilities. True friends will try to spend time with you. If they can’t do that, then it’s best to move on.

You Can’t Be Yourself Around Them

It can take a while for people to become comfortable. When you met your friends for the first time, you probably felt wary at first but once you gained each other’s trust, it was smooth sailing.

But if there are still people you don’t feel comfortable with even after knowing for a while, you should move on.

You can’t develop good chemistry with everyone. And it’s not a true friendship if you can’t be yourself around them.

One of You Develops Unrequited Romantic Feelings

unrequited romantic feelings

This is the toughest friendship to end because neither of you did anything wrong unless you count “catching feelings” wrong. When you or your friend becomes hopelessly smitten but the other doesn’t reciprocate, it becomes an awkward situation.

This is painful because you are ending what was once a great friendship.

Holding on will only be more tragic. Save yourselves from future drama and quit while you’re ahead. Maybe, when feelings aren’t as hot anymore, you can rekindle your friendship.

Identifying which friends to keep is a tough process but keep in mind these key points. Chances are, you are already subconsciously doing it. Being more aware of your feelings towards your friends and relationships can help you refine the company you keep.

The post 5 Signs You Need to Start Removing Toxic People appeared first on Dumb Little Man.


via Dumb Little Man – Tips for Life
5 Signs You Need to Start Removing Toxic People

The Death Of Google Reader And The Rise Of Silos

I’ve been talking a lot lately about the unfortunate shift of the web from being more decentralized to being about a few giant silos and I expect to have plenty more to say on the topic in the near future. But I’m thinking about this again after Andy Baio reminded me that this past weekend was five years since Google turned off Google Reader. Though, as he notes, Google’s own awful decision making created the diminished use that allowed Google to justify shutting it down. Here’s Andy’s tweeted thread, and then I’ll tie it back to my thinking on the silo’d state of the web today:

Many people have pointed to the death of Google Reader as a point at which news reading online shifted from things like RSS feeds to proprietary platforms like Facebook and Twitter. It might seem odd (or ironic) to bemoan a move by one of the companies now considered one of the major silos for killing off a product, but it does seem to indicate a fundamental shift in the way that Google viewed the open web. A quick Google search (yeah, yeah, I know…) is not helping me find the quote, but I pretty clearly remember, in the early days of Google, one of Larry Page or Sergey Brin saying something to the effect of how the most important thing for Google was to get you off its site as quickly as possible. The whole point of Google was to take you somewhere else on the amazing web. Update It has been pointed out to me that the quote in question most likely is part of Larry Page’s interview with Playboy in which he responded to the fact that in the early days all of their competitors were "portals" that tried to keep you in with the following:

We built a business on the opposite message. We want you to come to Google and quickly find what you want. Then we’re happy to send you to the other sites. In fact, that’s the point. The portal strategy tries to own all of the information.

Somewhere along the way, that changed. It seems that much of the change was really an overreaction by Google leadership to the "threat" of Facebook. So many of Google’s efforts from the late 2000s until now seemed to have been designed to ward off Facebook. This includes not just Google’s multiple (often weird) attempts at building a social network, but also Google’s infatuation with getting users to sign in just to use its core search engine. Over the past decade or so, Google went very strongly from a company trying to get you off its site quickly to one that tried to keep you in. And it feels like the death of Reader was a clear indication of that shift. Reader started in the good old days, when the whole point of an RSS reader was to help you keep track of new stuff all over the web on individual sites.

But, as Andy noted above, part of what killed Reader was Google attempting desperately to use it as a tool to boost Google+, the exact opposite of what Google Reader stood for in helping people go elsewhere. I don’t think Google Reader alone would have kept RSS or the open web more thriving than it is today, but it certainly does feel like a landmark shift in the way Google itself viewed its mission: away from helping you get somewhere else, and much more towards keeping you connected to Google’s big data machine.

Permalink | Comments | Email This Story

via Techdirt
The Death Of Google Reader And The Rise Of Silos

Making Fireworks from Scratch

Making Fireworks from Scratch

Link

How to Make Everything shares a brief history of fireworks, and how they work. Then he gathers the ingredients he needs to make them from scratch, including bat droppings. The resulting fireworks made for a pretty quiet Fourth of July, but technically they still worked.

via The Awesomer
Making Fireworks from Scratch

500 Intel Drones To Replace Fireworks Above Travis Air Force Base For Fourth of July

The Fourth of July is a little different today at Travis Air Force Base in Fairfield, Calif. From a report:

Instead of fireworks, 500 Intel Shooting Star drones will take to the sky to perform an aerial routine in honor of the holiday and the base’s 75th anniversary. These are the same drones that preformed at Disney World, the Super Bowl and the Olympics. One person controls the fleet of drones thanks to a sophisticated control platform that pre-plans the route of each drone. Intel engineers told me that the system can control an unlimited amount of drones. In the version I saw, the drones used GPS to stay in place and the drones lacked any collision detection sensors.

via Slashdot
500 Intel Drones To Replace Fireworks Above Travis Air Force Base For Fourth of July

Linux OS Tuning for MySQL Database Performance

Linux OS tuning for MySQL database performanceIn this post we will review the most important Linux settings to adjust for performance tuning and optimization of a MySQL database server. We’ll note how some of the Linux parameter settings used OS tuning may vary according to different system types: physical, virtual or cloud. Other posts have addressed MySQL parameters, like Alexander’s blog MySQL 5.7 Performance Tuning Immediately After Installation. That post remains highly relevant for the latest versions of MySQL, 5.7 and 8.0. Here we will focus more on the Linux operating system parameters that can affect database performance.

Server and Operating System

Here are some Linux parameters that you should check and consider modifying if you need to improve database performance.

The value represents the tendency of the kernel  to swap out memory pages. On a database server with ample amounts of RAM, we should keep this value as low as possible. The extra I/O can slow down or even render the service unresponsive. A value of 0 disables swapping completely while 1 causes the kernel to perform the minimum amount of swapping. In most cases the latter setting should be OK:

The change should be also persisted in /etc/sysctl.conf:

XFS

XFS is a high-performance, journaling file system designed for high scalability. It provides near native I/O performance even when the file system spans multiple storage devices.  XFS has features that make it suitable for very large file systems, supporting files up to 8EiB in size. Fast recovery, fast transactions, delayed allocation for reduced fragmentation and near raw I/O performance with DIRECT I/O.

The default options for mkfs.xfs are good for optimal speed, so the simple command:

will provide best performance while ensuring data safety. Regarding mount options, the defaults should fit most cases. On some filesystems you can see a performance increase by adding the noatime mount option to the /etc/fstab.  For XFS filesystems the default atime behaviour is relatime, which has almost no overhead compared to noatime and still maintains sane atime values.  If you create an XFS file system on a LUN that has a battery backed, non-volatile cache, you can further increase the performance of the filesystem by disabling the write barrier with the mount option nobarrier. This helps you to avoid flushing data more often than necessary. If a BBU (backup battery unit) is not present, however, or you are unsure about it, leave barriers on, otherwise you may jeopardize data consistency. With this options on, an /etc/fstab file should look like the one below:

ext4

ext4 has been developed as the successor to ext3 with added performance improvements. It is a solid option that will fit most workloads. We should note here that it supports files up to 16TB in size, a smaller limit than xfs. This is something you should consider if extreme table space size/growth is a requirement. Regarding mount options, the same considerations apply. We recommend the defaults for a robust filesystem without risks to data consistency. However, if an enterprise storage controller with a BBU cache is present, the following mount options will provide the best performance:

Note: The data=writeback option results in only metadata being journaled, not actual file data. This has the risk of corrupting recently modified files in the event of a sudden power loss, a risk which is minimised with a presence of a BBU enabled controller. nobh only works with the data=writeback option enabled.

ZFS

ZFS is a filesystem and LVM combined enterprise storage solution with extended protection vs data corruption. There are certainly cases where the rich feature set of ZFS makes it an essential option to consider, most notably when advance volume management is a requirement. ZFS tuning for MySQL can be a complex topic and falls outside the scope of this blog. For further reference, there is a dedicated blog post on the subject by Yves Trudeau:

Most modern Linux distributions come with noop or deadline I/O schedulers by default, both providing better performance than the cfq and anticipatory ones. However it is always a good practice to check the scheduler for each device and if the value shown is different than noop or deadline the policy can change without rebooting the server:

To make the change persistent, you must modify the GRUB configuration file:

AWS Note: There are cases where the I/O scheduler has a value of none, most notably in AWS VM instance types where EBS volumes are exposed as NVMe block devices. This is because the setting has no use in modern PCIe/NVMe devices. The reason is that they have a very large internal queue and they bypass the IO scheduler altogether. The setting in this case is none and it is the optimal in such disks.

Ideally different disk volumes should be used for the OS installation, binlog, data and the redo log, if this is possible. The separation of OS and data partitions, not just logically but physically, will improve database performance. The RAID level can also have an impact: RAID-5 should be avoided as the checksum needed to ensure integrity is costly. The best performance without making compromises to redundancy is achieved by the use of an advanced controller with a battery-backed cache unit and preferably RAID-10 volumes spanned across multiple disks.

AWS Note: For further information about EBS volumes and AWS storage optimisation, Amazon has documentation at the following links:

https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/nvme-ebs-volumes.html

https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/storage-optimized-instances.html

Database settings

Non-uniform memory access (NUMA) is a memory design where an SMP’s system processor can access its own local memory faster than non-local memory (the one assigned local to other CPUs). This may result in suboptimal database performance and potentially swapping. When the buffer pool memory allocation is larger than size of the RAM available local to the node, and the default memory allocation policy is selected, swapping occurs. A NUMA enabled server will report different node distances between CPU nodes. A uniformed one will report a single distance:

In the case of a NUMA system, where numactl shows different distances across nodes, the MySQL variable innodb_numa_interleave should be enabled to ensure memory interleaving. Percona Server provides improved NUMA support by introducing the flush_caches variable. When enabled, it will help with allocation fairness across nodes. To determine whether or not allocation is equal across nodes, you can examine numa_maps for the mysqld process with this script:

Conclusion

In this blog post we examined a few important OS related settings and explained how they can be tuned for better database performance.

While you are here …

You might also find value in this recorded webinar Troubleshooting Best Practices: Monitoring the Production Database Without Killing Performance

 

Spyros Voultepsis

Spyros earned his stripes after more than 20 years’ experience in the IT and Telco sectors. He has direct in-depth experience of distributed systems, databases, virtualization, and application delivery. He joined Percona in 2017 as a Senior MySQL DBA in the Managed Services team.

via Planet MySQL
Linux OS Tuning for MySQL Database Performance

Tourniquet Use Should Be One of Your Basic First Aid Skills

There are some skills you hope you never need to use, but having them could be a matter of life and death: welcome to bleeding control.

BleedingControl.org, an group begun by the American College of Surgeons, has successfully campaigned for a national Stop The Bleed Day; the organization believes that many lives could be saved if ordinary citizens had some basic information on how to stop traumatic bleeding in an emergency situation. Reporter and certified EMT Tim Mak rounded up the most critical points on the day dedicated to bleeding awareness in an effort to teach more people how to save lives.

Advertisement

According to Mak, 20 percent of people who die from bleeding could have been saved with this care, and bleeding to death is the top cause of preventable death. Here’s what you need to know.

What To Look For

It is possible to bleed to death from smaller wounds, but people who bleed out often do so because they have cut an artery. You will know an artery has been severed if blood is spurting from the wound and bright red. Also, if blood is pooling, if the injured person is unconscious, or if you’re seeing a partial or full amputation. A person with a severed artery can die in 2-3 minutes.

How To Intervene

Mak provided a step-by-step guide which may seem simple, but in a scenario where someone is massively bleeding, you might be a little panicked. Simple rules help.

Advertisement

First, make sure you’re not stepping into danger. Then, call 911. Even if you’re about to stop the bleeding successfully, you want trained medical professionals to get there ASAP. Then you find the injury and apply pressure to stop the blood loss.

You may not have a tourniquet on hand, but if you do, tie it off between the blood flow and the exit wound, above the injury. If not, or if the wound is too big to be contained by a tourniquet, grab a clean cloth or hemostatic (bleeding control) gauze, if available. Pack the wound and hold it down with steady pressure. You’re trying to close off the artery and keep it closed until help can arrive. Mak advises people apply as much pressure as possible, because even if the injury is severe, the artery is fairly deep inside the body. You need to press hard to reach it and shut it off.

Advertisement

Finally, if you have the presence of mind to do so, mark the time the tourniquet or pressure was applied. This is useful information for medical professionals, as there are dangers to leaving tourniquets on too long.

These are the basics, but if you want to take a hands on class for free, Bleeding Control offers them all over the country. As Mak wrote, there’s nothing like hands-on training when it’s time to step up.


via Lifehacker
Tourniquet Use Should Be One of Your Basic First Aid Skills

How to Send Completely Anonymous Emails: 5 Effective Methods

Advertisement

Have you ever had the need to send anonymous emails to someone? Maybe you’re discreetly declaring your love to someone. Or maybe you’re a journalist and need to secretly communicate with an informant.

There are plenty of legitimate reasons someone may want to send anonymous email. There are free online services on the web that allow you to do this. Or you can use a VPN and an anonymous burner email account (i.e. throwaway).

These days it’s very easy to send emails without having to reveal your true identity. In this article, you’ll learn how to send an anonymous email using the five most effective methods we’ve found.

1. Burner Email Account + VPN

Using a web-based email account like Gmail is a great option. You can sign up for a Gmail account without providing any actual identifying information, and then use that address as a kind of burner email account.

When you send anonymous emails from Gmail’s web-based email client, the originating IP in the SMTP envelope is Google’s server, not your own computer’s IP. This is a nifty way to hide your IP address from the receiver


How to Use a Fake IP Address & Mask Yourself Online




How to Use a Fake IP Address & Mask Yourself Online

Sometimes you need to hide your IP address. Online anonymity continues to be important as privacy gets trampled. Here are some ways to cloak your I.P address and mask yourself online.
Read More

.

how to send completely anonymous emails

If someone were to trace the IP that show up when you send an email from the online Gmail account, it would only trace to the nearest Google server to you. Which, in my case, is the Wichita, Kansas area.

how to send completely anonymous emails

With that said, your actual IP address is stored on Google’s systems. So, if the government or any other authority ever came knocking and asked for your location, Google could provide it.

If that’s not enough privacy for you, you can add another layer of anonymity by encrypting your connection with a VPN service. We recommend avoiding free VPN services and instead pay for a reputable one like ExpressVPN or CyberGhost.

Once connected, you can then use Gmail through the encrypted VPN.

how to send completely anonymous emails

Now, when you go to your Gmail account and send an email, the originating IP will still show up as one of Google’s servers, but there will be two differences.

First, the Google server won’t likely be located anywhere near your actual location. Second, if Google is ever asked to provide your actual IP, they’ll only be able to provide the erroneous IP address hosted by the VPN service.

Note: An anonymous burner email account isn’t quite the same as a disposable email account


Need a Disposable Email Address? Try These Great Services




Need a Disposable Email Address? Try These Great Services

Need to send or receive an email without using your real address? Here are some great services that let you do just that.
Read More

!

2. Email Client + VPN

Another solution that avoids the need for any anonymous email service is using an email client like Thunderbird on your own PC.

There are three steps you’ll need to follow to make this approach work:

All you have to do is fire up your preferred VPN service and make sure your computer has a remote IP address.

how to send completely anonymous emails

Then, just send an email via your throwaway email account using your desktop email client, just like you normally would.

The difference is that now, instead of the header providing your actual originating IP address


What Can You Learn From An Email Header (Metadata)?




What Can You Learn From An Email Header (Metadata)?

Did you ever get an e-mail and really wondered where it came from? Who sent it? How could they have known who you are? Surprisingly a lot of that information can be from from the…
Read More

, it’ll show your VPN’s IP address located some place far away. It’s a quick and easy way to send anonymous emails with very little effort.

how to send completely anonymous emails

AnonEmail is a service by AnonyMouse. It allows you to send anonymous emails by resending your email several times through random nodes, thus making it impossible to trace back.

In AnonEmail, you can fill in your recipient, the subject, and a short plain-text message. Contrary to many other services AnonEmail does not (seem to) log your IP. However, we urge you not to use it for anything illegal!

As an extra security measure, AnonEmail will wait for an unknown period of time before sending your email along. Why? So no one will be able to prove your “guilt” based on time/location, or make geographic presumptions based on timezones.

how to send completely anonymous emails

Like the name implies, this is another web-based, anonymous email tool. Although it lacks the complete anonymity of AnonEmail, it’s the simplest option to use.

You’ll be able to specify a sender’s address and a fake origin email address for your secret message. This one logs your IP address, so you’ll need to use a free VPN service


7 Completely Free VPN Services to Protect Your Privacy




7 Completely Free VPN Services to Protect Your Privacy

If you’re looking for a free VPN, the choices are currently limited, with many services switching to a paid model. These free virtual private networks can be used to avoid region blocking and more.
Read More

if you want to fully cover your tracks.

Also, neither Send Anonymous Mail nor AnonEmail allow the recipient to reply to your email, so these solutions are only best if you want to send a one-way anonymous email message.

how to send completely anonymous emails

If you absolutely need secure, anonymous, two-way email conversation, ProtonMail is a popular solution. Many say that ProtonMail is better than Gmail


Gmail vs. ProtonMail: Which Email Client Is Best for You?




Gmail vs. ProtonMail: Which Email Client Is Best for You?

While Gmail may be the most convenient email client, ProtonMail is more secure. Which one is right for you? We’ll help you find out with this comparison.
Read More

.

I’ve personally used ProtonMail when communicating with a journalist living in China. The journalist was using a VPN to access his ProtonMail account, providing several levels of security from prying government eyes. Not only was his originating IP address located outside of China, but all communications using ProtonMail are encrypted.

Some features of ProtonMail include:

  • End-to-End Encryption: Messages are not only encrypted when they’re sent from ProtonMail servers, but all stored messages are encrypted as well. Without access to the appropriate ProtonMail account, no one can access your messages.
  • Private User Data: ProtonMail’s encryption process, which uses an encryption key on your own client computer, mean even the system administrators at ProtonMail can’t access your messages. On the downside, this means they can’t recover your account for you. On the upside, it means they can’t provide messages to any governing authority either.
  • Open Source Cryptography: Since ProtonMail uses open-source cryptographic libraries


    5 Common Encryption Types and Why You Shouldn’t Make Your Own




    5 Common Encryption Types and Why You Shouldn’t Make Your Own

    Is it a good idea roll your own encryption algorithm? Ever wonder what types of encryption are the most common? Let’s find out.
    Read More

    , you can be sure there are no “back doors” available for anyone to access your emails. That includes both system administrators or hackers.

If you have a need for regular two-way encrypted emails, you may want to consider signing up for a ProtonMail account and just using it as your regular email service.

Start Sending Anonymous Emails Your Way

As you can see, there are a lot of ways to send anonymous email. You can use a local solution with a VPN and either an email client or through a throwaway online email account. You could use a secure, encrypted email service like ProtonMail. Or you could just use one of the free websites that let you send one-way, fully-anonymous messages.

The choice really depends on why you’re sending the message and what level of security and anonymity you need.

Not sure which VPN service is right for you? See our comparison of the best VPN services


The Best VPN Services




The Best VPN Services

We’ve compiled a list of what we consider to be the best Virtual Private Network (VPN) service providers, grouped by premium, free, and torrent-friendly.
Read More

. If you’re looking for other ways to bolster your personal security, you may also want to take a look at boosting your PC’s security


The Best Computer Security and Antivirus Tools




The Best Computer Security and Antivirus Tools

Need a security solution for your PC? Concerned about malware, ransomware, viruses, and intruders through your firewalls? Want to back up vital data? Just confused about it all? Here’s everything you need to know.
Read More

.



via MakeUseOf.com
How to Send Completely Anonymous Emails: 5 Effective Methods

What Is Object Oriented Programming? The Basics Explained in Layman’s Terms

Advertisement

If you’ve done some beginner programming, or even started to look at different languages, you’ve probably come across the phrase “object-oriented programming” (or “OOP”).

There are all sorts of technical explanations as to what it is, but today we’re going to take a look at defining object-oriented programming in a simple way.

Before We Start: Procedural Languages

To understand what an object-oriented programming language is, you need to understand what it replaced. Early programming languages were procedural—so-called because the programmer would define a very specific set of procedures that the computer would undertake.

What Is Object Oriented Programming and How to Get Started Learning It

In the earliest days, procedures were written on punch cards. Those steps took in data, performed a sequence of actions on that data, then output new data.

Procedural languages worked well for a time (and some are still in use). But when you want to program something beyond a basic sequence of steps, procedural languages can become difficult to manage. That’s where object-oriented programming comes in.

The Object of Object-Oriented Programming

So then, what is object-oriented programming?

The first object-oriented language (generally agreed to be Simula) introduced the idea of objects. Objects are collections of information that are treated as a singular entity.

We’ll dive deeper into what that actually means in a second with an example, but first we have to talk about classes. Classes are sort of like pre-objects. They contain a list of attributes that, when defined, become an object.

What Is Object Oriented Programming and How to Get Started Learning It

Let’s take the example of programming a chess game. We might have a class called Piece. Within Piece, we have a list of attributes:

  • Color
  • Height
  • Shape
  • Movement allowed

An object simply defines one particular instance of a thing belonging to that class.

So we could have an object called WhiteQueen. That object would have definitions for all four attributes (white, tall, cylindrical with crenellations, any number of spaces in any direction). It might also have methods or functions.

What makes this so much better than the procedural approach?

In short, object-oriented programming languages (like Java) makes it easier to organize data and code in a way that’s more versatile for larger project.

To discuss it in a bit more detail, we’ll talk about the four basics of object-oriented programming.

Object-Oriented Programming: Abstraction

Just because you want to use something doesn’t mean you need to know how it works. An espresso machine, for example, is complex. But you don’t need to know how it works. You just need to know that when you hit “On,” you’re going to get espresso.

What Is Object Oriented Programming and How to Get Started Learning It

The same is true of objects in object-oriented programming. In our chess example, we may have a move() method. That method could require a lot of data and other methods. It might need the initial position and final position variables. It could use another method for determining whether it’s captured a piece.

But you don’t need to know that. All you need to know is that when you tell the piece to move, it moves. That’s abstraction.

Object-Oriented Programming: Encapsulation

Encapsulation is one of the ways that object-oriented programming creates abstraction. Each object is a collection of data that’s treated as a single entity. And within those objects are data—both variables and methods.

The variables within an object are generally kept private, which means other objects and methods can’t access them. Objects can only be affected by using their methods.

A Bishop object might contain several pieces of information. For example, it could have a variable called “position.” That variable is necessary to use the move() method. And, of course, it has a color.

By making the position variable private and the move() method public, a programmer protects the move variable from being affected by anything else. And if the color is a private variable, there’s no way for another object to change it unless there’s a method that allows the change. (Which you probably wouldn’t have, as the color of the piece should remain constant.)

These variables and methods are kept within the Bishop object. Because they’re encapsulated, a programmer could make a change to the structure or contents of the object without worrying about the public interface.

Object-Oriented Programming: Inheritance

In addition to classes, object-oriented programming languages also have sub-classes. These contain all of the attributes from the parent class, but they can also contain other attributes.

In our chess game, the pawn pieces need a method that can turn them into other pieces if they make it to the end of the board. We’ll call it the transformPiece() method.

Not every piece needs the transformPiece() method. So we wouldn’t want to put it in the Piece class. Instead, we can create a sub-class called Pawn. Because it’s a sub-class, it inherits all of the attributes from Piece. So an instance of the sub-class Pawn includes a color, height, shape, and movement allowed.

But it also includes the transformPiece() method. Now we never have to worry about accidentally using that function on a rook. Here’s a technical explanation:

Creating sub-classes also saves a lot of time. Instead of creating new classes for everything, programmers can create a base class and then extend it to new sub-classes when they need to. (However, it’s worth noting that over-reliance on inheritance is bad


10 Basic Programming Principles Every Programmer Must Follow




10 Basic Programming Principles Every Programmer Must Follow

Always write code that can be maintained by anyone who may end up working on your software. To that end, here are several programming principles to help you clean up your act.
Read More

.)

Object-Oriented Programming: Polymorphism

Polymorphism is a result of inheritance. Fully understanding polymorphism takes some programming knowledge, so we’re just going to stick with the basics here. In short, polymorphism allows programmers to use methods of the same name, but with different objects.

For example, our Piece class might have a move() method that moves a piece one space in any direction. That works for the king piece, but not for anything else. To fix this problem, we can define new move() method in the Rook sub-class that defines movement as an unlimited number of spaces forward, backward, left, or right.

Now, when a programmer invokes the move() method and uses a piece as the argument, the program will know exactly how the piece should move. This saves a ton of time over trying to figure out which of many different methods you should use.

Object-Oriented Programming in a Nutshell

If your head is spinning a bit after those last four definitions, don’t worry too much. Here are the main things you need to remember:

  • Object-oriented programming collects information into single entities called objects.
  • Each object is a single instance of a class.
  • Abstraction hides the inner workings of an object when it’s not necessary to see them.
  • Encapsulation stores related variables and methods within objects and protects them.
  • Inheritance allows sub-classes to use attributes from parent classes.
  • Polymorphism allows objects and methods to deal with multiple different situations with a single interface.

If you can remember those points, you’ll have a good handle on what object-oriented programming is. The four basics of object-oriented programming, as I mentioned, can be a little difficult to get a handle on. But once you start programming, they’ll become more clear.

Remember that we’ve only discussed generalities in this article. Different object-oriented languages will have their own quirks and ways to make things happen. Once you choose the right language for you


Looking for the Best Programming Languages? Start Here!




Looking for the Best Programming Languages? Start Here!

Whether you’re completely new to programming languages or looking to jump into a new kind of programming, one of the most important questions to ask is: “Which programming language is right for me?”
Read More

, you’ll start to learn how it puts OOP principles into practice.



via MakeUseOf.com
What Is Object Oriented Programming? The Basics Explained in Layman’s Terms