search

Pseudo Code

Apr 18, 2025 am 10:33 AM

Pseudocode: A secret weapon to improve code efficiency

Recently, Yonatan Doron published an article on Medium titled "The Art of Code - Why You Should Write More Pseudocode". As a fan of pseudo-code, I really like this title. Pseudocode refers to "code" that describes what you want to do or what you want to communicate with, but it does not belong to any particular language and does not use any correct API or other content.

Writing annotated pseudo-code helps organize ideas, boost motivation, and plan expected code results in advance. That way, when we start writing code, we always have this mind map or framework to help us focus and improve efficiency.

Jeremy Keith once compared it to writing a script:

"When a user submits a form, a modal dialog box with confirmation information is displayed." Then he encourages everyone to write a script...but I am not referring to scripts in the JavaScript sense; Write down each step you want to complete. Once done, translate every line of script you wrote in English (or Portuguese) into JavaScript.

I see educators using this technology time and time again. But it’s not just for teachers to use and students to learn – it goes a long way toward anyone. I find myself writing pseudo-code before writing real code, and of course, sometimes I keep it in code comments. Most commonly, I use it in Notion documentation or Slack conversations to express my point of view.

Even simple ideas:

<code>如果env.dev停止邮件投递</code>

Anything that has logic and branching or step-by-step operations will benefit greatly from it. Please note that this code is not a valid code. It doesn't work in any language I can think of. Sometimes, I will add some brackets or semicolons casually out of muscle memory. Who cares? It's just about communicating ideas with yourself or others.

<code>如果(支持网格)使用网格否则使用flexbox将内容布局在基本行中</code>

This is very natural. They probably won't care about grammar, they will only understand what it means.

<code>在表单提交时验证如果存在错误显示错误;否则提交到api;如果api成功显示ui成功;否则显示ui失败;</code>

(After writing this, it reminds me of uilang. See how the plain text code blocks work there.)

Yonatan's article lacks real pseudo-code examples, so I asked around. Check out these great examples!

My entire notebook is pseudo-code...

These are converted to comments before starting to encode so that I can know what I'm doing and what pictures I've made afterwards. twitter.com/9vfJYfweDh

— Ruth John (@Rumyra) May 28, 2019

Whiteboards are great for writing pseudo-code as well as adding graphics. picture. twitter.com/56FUu4rhmU

— norom (@_norom_) May 28, 2019

Oh, I used to do this...pictures. twitter.com/lQi4Y8RhwP

— Ben Koppenens (@bkoppenens) May 28, 2019

Always use it! picture. twitter.com/YFVVNwls5M

— Bryan (@iamBryanSanders) May 28, 2019

Trying to use both JavaScript and php can sometimes be a bit tricky picture. twitter.com/Xp0bQyV86D

— frankie | webdev (@azoicx) May 29, 2019

Belated join. Quick script mapping. picture. twitter.com/n1kYDxKgya

— Adam Styles (@thelibstyles) May 31, 2019

I was surprised how much pseudo-code is written on paper! This is really cool. It's a little weird for me because I rarely do anything with paper. I probably should.

Pseudo Code

The above is the detailed content of Pseudo Code. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
A Little Reminder That Pseudo Elements are Children, Kinda.A Little Reminder That Pseudo Elements are Children, Kinda.Apr 19, 2025 am 11:39 AM

Here's a container with some child elements:

Menus with 'Dynamic Hit Areas'Menus with 'Dynamic Hit Areas'Apr 19, 2025 am 11:37 AM

Flyout menus! The second you need to implement a menu that uses a hover event to display more menu items, you're in tricky territory. For one, they should

Improving Video Accessibility with WebVTTImproving Video Accessibility with WebVTTApr 19, 2025 am 11:27 AM

"The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect."- Tim Berners-Lee

Weekly Platform News: CSS ::marker pseudo-element, pre-rendering web components, adding Webmention to your siteWeekly Platform News: CSS ::marker pseudo-element, pre-rendering web components, adding Webmention to your siteApr 19, 2025 am 11:25 AM

In this week's roundup: datepickers are giving keyboard users headaches, a new web component compiler that helps fight FOUC, we finally get our hands on styling list item markers, and four steps to getting webmentions on your site.

Making width and flexible items play nice togetherMaking width and flexible items play nice togetherApr 19, 2025 am 11:23 AM

The short answer: flex-shrink and flex-basis are probably what you’re lookin’ for.

Position Sticky and Table HeadersPosition Sticky and Table HeadersApr 19, 2025 am 11:21 AM

You can't position: sticky; a

Weekly Platform News: HTML Inspection in Search Console, Global Scope of Scripts, Babel env Adds defaults QueryWeekly Platform News: HTML Inspection in Search Console, Global Scope of Scripts, Babel env Adds defaults QueryApr 19, 2025 am 11:18 AM

In this week's look around the world of web platform news, Google Search Console makes it easier to view crawled markup, we learn that custom properties

IndieWeb and WebmentionsIndieWeb and WebmentionsApr 19, 2025 am 11:16 AM

The IndieWeb is a thing! They've got a conference coming up and everything. The New Yorker is even writing about it:

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.