Connect with us

Technology

What is Pseudocode and How Does it Make You a Better Developer?

Published

on


When you first begin to learn to program there are many things to study before you build your first app. Thinking like a programmer helps you break down problems into algorithms to solve them. Algorithms are the steps your code will take to solve a problem or answer a question.

It can be challenging if you’re a new coder to think like a programmer from the very start. Translating app ideas to actual code takes some practice.

To bridge the gap between what you want your app to do and the actual code you need to write, you can use pseudocode.

What Is Pseudocode?

Pseudocode is a plain-text description of a piece of code or an algorithm. It’s not actually coding; there is no script, no files, and no programming. As the name suggests, it’s “fake code”.

Pseudocode is not written in any particular programming language. It’s written in plain English that is clear and easy to understand.

While it’s not written in a programming language, there are still keywords used that refer to common coding concepts. These are written in uppercase letters to make it easier to read.

  • START
  • INPUT
  • READ/GET
  • PRINT/DISPLAY
  • CALCULATE/DETERMINE
  • SET
  • INCREMENT/DECREMENT
  • PROGRAM
  • END

Here is a snippet of what pseudocode might look like for a program that asks you to input your favorite color and prints your choice.

START
PROGRAM getColor
Create variable Color
Ask the user for their favorite color
READ INPUT into Color
PRINT Color
END 

This is a pretty simple algorithm written in pseudocode. Anyone can read and understand what this is trying to do. As the coder, all you have to do is bring this to life using whichever programming language you code in. Here’s the same program in JavaScript:

let color = window.prompt("What is your favorite color?");
console.log(color);

This program uses JavaScript syntax to write the algorithm. If you don’t know JavaScript it can be a little challenging to figure out what is happening.

Pseudocode writes the algorithm, programming languages write the syntax.

How Is Pseudocode Helpful?

Pseudocode helps you plan out your app before you write it. It helps you create algorithms in a format that is easier to read than code syntax. Once programming languages come into the picture it can be harder to understand what your code is doing.

The JavaScript example is easy to read if you know the language. But what if you’re just reading it and trying to determine the logic? Specific terms like window.prompt or console.log don’t reveal much about the algorithm.

Good software principles are important. If you interview to become a software engineer, they won’t expect you to memorize syntax. They will ask about your knowledge of algorithms and structure. You’ll write much better code if you construct your algorithms and structure before you start coding.

How to Write Pseudocode

Writing a full program in pseudocode requires a lot of different statements and keywords much like regular programming. In fact, once you get far enough along in your pseudocode it will start to look very close to a real program.

Let’s build on the keywords with pseudocode statements to build algorithms.

Conditionals

Conditional statements are critical to programming. These statements are IF statements or IF/ELSE statements which can add logic to your code. These statements are written in pseudocode using:

  • IF
  • ELSE
  • ELSE IF
  • THEN

Here’s a program that performs a simple IF/ELSE statement written in pseudocode. See if you can determine what this code is trying to do just by reading.

START
PROGRAM isOdd
Create variable Choice
Ask the user for a number
READ INPUT into Choice
IF Choice is even THEN
 PRINT "No"
ELSE
 PRINT "Yes"
ENDIF
END

It’s a pretty simple program. It asks the user for a number and does something depending on whether the number is odd or even.

Iteration

Another essential part of programming is iteration, also known as creating loops. Some common loops are for loops and while loops, both of which can be written in pseudocode.

START
PROGRAM forLoop
FOR 1 through 12
 PRINT "Hello"
ENDFOR
END

This algorithm is for a program that will print “Hello” 12 times, which is a bit excessive but shows how simple it is to write a loop in pseudocode.

While loops are also written very easily

START
PROGRAM whileLoop
Create variable Counter
SET Counter equal to 1
WHILE Counter is less than 10
 Print "Hello"
 INCREMENT Counter
ENDWHILE
END

Another pretty simple algorithm using a while loop to print “Hello”.  Both loop examples have a clear start and end to the iteration.

You also can write what is commonly known as Do-While loops. The keywords in pseudocode are different: REPEAT and UNTIL.

START
PROGRAM doWhileLoop
Create variable Counter
SET Counter equal to 1
REPEAT
 Print "Hello"
 INCREMENT Counter
UNTIL Counter is equal to 10
END

Just like a do-while loop, this will perform an action until certain criteria are met. Once it is met the loop will exit.

Functions

Functions are a programmer’s best friend. They contain code that can be called over and over again and are used in all high-level programming languages. Adding functions into your pseudocode is very easy.

START
PROGRAM sampleFunction
PRINT "This is a function"
END

You can call functions in pseudocode.

call sampleFunction

There is not much to functions; they’re very simple and you can add any logic you like.

Error Handling

Being able to write code that reacts to errors is very important when apps are developed. As such, you can include these catches into your pseudocode.

You can handle errors and exceptions using the keyword: EXCEPTION. Here’s a simple algorithm that catches an error

START
PROGRAM catchError
Create variable Number
Ask the user for a number
READ INPUT into Number
EXCEPTION
WHEN Number is not a number
 PRINT "Error: Please pick a number"
END

The exception code will catch bad input from the user. Code testing is vital to writing good apps. Some of these exceptions will re-appear in your testing, so it’s good to be able to write them in your pseudocode when planning the app.

Software Development and More

Pseudocode is all about making you a better coder. Now that you know how to write it you can see just how useful it can be as part of your programming process. Programmers make some pretty good money, so if this is your career move you have a lot of opportunities if you learn a lot.

Knowing how to use pseudocode is recommended however you’re learning to code. Want to know more? Check out some basic principles that every programmer should follow.

Read the full article: What is Pseudocode and How Does it Make You a Better Developer?



Source link

قالب وردپرس

Technology

5 Best Google Fi Compatible Phones You Can Go For

Published

on


Google Fi, a carrier service launched by Google in the US, was previously available for Pixel and Nexus smartphones only. As of now, Google has extended support for a lot of Android smartphones.

The Google Fi service provides the users with data services on three different mobile networks including US Cellular, Sprint, and T-Mobile. Google Fi also utilizes Wi-Fi for texting and calling according to the availability.

Previously, it was easy to choose a Google Fi compatible phones as there were only two or three of them. Now, finding the most appropriate Google Fi compatible phone is a task due to several options available now.

Here we have curated the list of 5 best Google Fi compatible phones. You can select the best fit for you according to your needs after going through the specifications of the smartphones.

Also Read: Top Gaming Phones For 2020: Best Smartphones To Play Video Games

5 Best Google Fi Compatible Phones

1. Moto G7

Moto G7 can be considered as the most affordable smartphone with Google Fi support. It comes with a 6.2-inch Full HD+ display and has a water repellant design. It is based on the Android 9.0 Pie and runs on the Qualcomm Snapdragon 632 processor.

Moto G7 has 4GB RAM along with 64GB onboard storage and its memory is expandable up to 128GB via microSD card. It sports a dual rear camera set up including a 12MP primary sensor and a 5MP depth sensor. The phone also features a 8MP selfie camera.

In terms of battery, Moto G7 is powered by a 3000mAh battery and supports 15W TurboPower charge. As of now, Moto G7 is available at a price of $198.50. So if you want to buy an affordable google fi compatible phone, Moto G7 is the best fit.

2. OnePlus 7T

Best google fi compatible phones

OnePlus 7T is one of the best mid-ranged smartphones available in the market. The phone features a 6.55-inch Fluid Display along with a 90Hz refresh rate. It runs on the Qualcomm Snapdragon 855 processor and is based on the latest Android 10.

OnePlus 7T sports a triple rear camera setup including a 48MP primary sensor, 12MP secondary sensor, and a 16MP tertiary sensor. Apart from that, it features a 16MP front camera for selfies.

The smartphone has two variants based on storage including 128GB onboard storage variant and 256GB onboard storage variant. The smartphone comes equipped with a powerful battery of 3800mAh and supports Warp Charge 30T.

The basic variant of OnePlus 7T including 8GB RAM and 128GB onboard storage is available at a price of $502.50 approximately and the top-notch variant is available at a price of $515.40.

3. Google Pixel 4 XL

Best Google Fi compatible phones

Google Pixel 4 XL was launched back in October 2019. The smartphone comes with a 6.3-inch display and is based on the Android 10. It runs on the Qualcomm Snapdragon 855 processor and can be dubbed as one of the best Google Fi compatible phones.

Snapdragon 855 is accompanied with 6GB RAM and 64GB onboard storage in the Google Pixel 4. Apart from that, it sports a dual rear camera setup including a 16MP primary camera and a 12MP secondary sensor.

Google Pixel 4 XL comes equipped with a 3700mAh battery and USB Type-C support. However, the price of the smartphone is a bit high as it is available at a price of $939 in the market. You can go forward to buy Pixel 4 XL only if you want a high ranged smartphone.

4. Samsung Galaxy S20

Samsung Galaxy S20

If you are looking for a Google Fi compatible smartphone with 5G connectivity support then Samsung Galaxy S20 is the best option out there. The smartphone features a 6.2-inch punch-hole display along with a 90Hz refresh rate. It runs on the Samsung Exynos 990 processor that is accompanied by 8GB RAM and 128GB onboard storage.

The best part about the smartphone is that it has a expandable memory upto 1TB via a microSD card. Samsung Galaxy S20 comes with a triple rear camera setup including a 64MP primary lens, 12MP secondary lens and a 12MP tertiary lens. It sports a 10MP selfie camera.

Samsung Galaxy S20 comes with a massive 4000mAh battery. The smartphone is available at a price of $933.12 in the market. Apart form Samsung Galaxy S20, you can also go for other smartphones of Samsung Galaxy S20 series as they all are Google Fi compatible.

5. Google Pixel 3a

Best Google-Fi compatible phones

Google Pixel 3a is the best fit for you if you are looking for a compact Google Fi compatible smartphone. With a 5.6-inch OLED display, the smartphone features three different color profiles.

Google Pixel 3a runs on the Qualcomm Snapdragon 670 processor and is based on the Android 9.0 Pie. In terms of storage, the smartphone comes equipped with 4GB RAM along with 64GB onboard storage.

Google Pixel has very basic camera specifications including a 12MP rear camera and an 8MP front camera. It is powered by a 3000mAh battery. Google Pixel 3a will cost around $406.13 as of now.

Choosing Google Fi Compatible Phones

You can choose the most appropriate smartphone from the above-mentioned Google Fi compatible smartphones. Apart from those smartphones, you can also check out whether your smartphone is compatible with Google Fi or not by visiting the compatibility page.

We will keep updating this list with new Google Fi compatible phones as and when they become available. So, don’t forget to check the list again after some time.

The post 5 Best Google Fi Compatible Phones You Can Go For appeared first on Fossbytes.



Source link

قالب وردپرس

Continue Reading

Technology

Apple’s AR glasses just hit a key developmental milestone

Published

on



  • Apple’s rumored AR glasses recently hit a key developmental milestone
  • Apple’s AR glasses may arrive as soon as 2022.
  • Tim Cook has long been a fan of Augmented Reality and believes the technology’s impact could rival that of the iPhone.

Amid rumors that Apple may release a pair of Augmented Reality-powered glasses in early 2022, a new report from The Information relays that work on the highly anticipated product continues to move forward. The report specifically claims that a key developmental milestone was recently reached as semitransparent lenses for the device recently “passed the prototype stage and entered trial production.”

The report indicates that mass production is still a good two years away, which aligns with previous reports we’ve seen. Of course, there’s no guarantee Apple’s AR glasses will hit the market given that the entire project has been subject to various delays in recent years. There was even a brief period of time, rumor has it, where Apple canceled the project altogether.

That notwithstanding, The Information adds:

The lenses use a polarized system, similar to the technology in 3D movie glasses, which create the illusion of depth using stereoscopic images, the person said. The technology is similar to that in other AR and VR devices already on the market from Microsoft, Magic Leap and Facebook…

The person said making the AR lenses is especially challenging because they are composed of multiple, extremely thin layers of different synthetic materials, each of which is susceptible to bubbles, scratches and other marks. To reduce defects, the lenses must be manufactured in dust-free zones known as clean rooms.

Apple reportedly has upwards of 1,000 employees currently working the project. You might also recall that code in an iOS 13 build from last September contained references to AR-based applications and devices.

As to what type of functionality Apple’s AR glasses will bring to the table, the device will include a microphone to allow users to call Siri into action and, of course, field and make calls. There are also indications that the device will ship with a built-in accelerometer so that the device can register commands when a user moves his or her head in a particular direction.

The first incarnation of Apple AR glasses will likely not include a camera due to battery life and design considerations. Subsequent models, however, may feature a camera module.

Design-wise, it’s believed that Apple’s AR glasses will support both polarized and prescription lenses. Further, different sizes will be available for both men and women. Aesthetically, rumor has it that the product will look like a regular pair of glasses with thicker than average frames which will contain the battery and assortment of chips.

It’s far too soon to know how much Apple’s AR glasses might cost, but an alleged Foxconn insider a few years ago suggested it might be in the range of $600.

Incidentally, Tim Cook has long been a champion of Augmented Reality, with the Apple CEO a few years ago stating that it remains a “core technology” Apple continues to invest in.

“I think AR is extremely interesting and sort of a core technology,” Cook said back in 2016. ” So, yes, it’s something we’re doing a lot of things on behind that curtain that we talked about.”

All told, it will be interesting to see how the market reacts to Apple’s AR Glasses if and when it’s released. Recall that Google Glass, while intriguing, was more of a gimmick with few real-world applications. In turn, Google Glass didn’t gain any traction in the market. If Apple’s AR glasses, in contrast, can prove itself to be more than a gimmick, perhaps Apple will have another breakout hit on its hands.



Source link

قالب وردپرس

Continue Reading

Technology

Microsoft Teams takes on Zoom with bizarre new feature

Published

on


{“@context”:”https://schema.org”,”@type”:”VideoObject”,”name”:”Metro.co.uk”,”duration”:”T55S”,”thumbnailUrl”:”https://i.dailymail.co.uk/1s/2020/07/10/08/30607208-0-image-a-59_1594367601294.jpg”,”uploadDate”:”2020-07-10T08:52:47+0100″,”description”:”Together mode is a new meeting experience in Teams that uses AI segmentation technology to digitally place participants in a shared background, making it feel like you’re sitting in the same room with everyone else in the meeting or class.”,”contentUrl”:”https://videos.metro.co.uk/video/met/2020/07/10/4451065279760546166/640x360_MP4_4451065279760546166.mp4″,”height”:360,”width”:640}

To view this video please enable JavaScript, and consider upgrading to a web
browser that
supports HTML5
video

Microsoft is adding a virtual auditorium view to its Teams communication platform in a bid to make video meetings feel more natural during lockdown.

The firm has developed AI technology that places participants alongside one another, digitally seated with the same background, creating the impression everyone is in the same room.

‘Together mode’ is designed to help people feel more connected and less fatigued by video meetings, which have become commonplace among those working from home since coronavirus lockdown measures came into place in March.

The feature – which rolls out on Thursday before becoming generally available in August – is one of a number of improvements the tech giant is introducing on Microsoft Teams.

Users can expect to find video filter enhancements and emoji-based live reactions to pop up on screen among the raft of updates.

It’s like being back at uni – only with video calling (Microsoft 365)

Microsoft Teams displays, a new category of device for the firm, has also been announced amid a surge in demand for video communication tools and growing competition from the likes of Zoom, Facebook and Google.

These Teams-focused devices will have an ambient touchscreen and a hands-free experience powered by Cortana.

Microsoft teams turns meetings into virtual auditoriums

This is…strange (Microsoft 365)

The Lenovo ThinkSmart View will be the first Microsoft Teams display to be made available



Source link

قالب وردپرس

Continue Reading

Trending