自学成才翁_自学成才的少年如何构建可在浏览器中运行的操作系统

自学成才翁

Arizona teenager Aaron Adams built and maintains this awe-inspiring solo project. Developed entirely in the cloud using c9.io’s online development environment, aOS (short for AaronOS) is an impressive tool, packed with a whole bunch of features and opportunities for customization.

亚利桑那州少年亚伦·亚当斯(Aaron Adams)建立并维护了这个令人敬畏的单人项目 。 aOS(使用c9.io的在线开发环境完全在云中开发),aOS(AaronOS的缩写)是一个令人印象深刻的工具,其中包含许多功能和自定义机会。

To list only a few of these features:

仅列出其中一些功能:

  • Fancy an OSX-inspired UI? Check. Prefer a classic Windows XP themed UI? Check. Or feel like designing your own? Go ahead!

    喜欢OSX风格的UI? 检查一下 更喜欢经典的Windows XP主题UI? 检查一下 还是喜欢自己设计? 前进!
  • Make sure to try out the NORAA virtual assistant’s speech recognition capability

    确保尝试NORAA虚拟助手的语音识别功能
  • Test out commands in the bash-style terminal window

    在bash风格的终端窗口中测试命令
  • Have a go using some of the in-built “apps” such as Text Editor, Function Grapher, and Music Visualizer

    可以使用一些内置的“应用程序”,例如文本编辑器,函数图示器和音乐可视化器
  • Why not write your own custom app using App Maker?

    为什么不使用App Maker编写自己的自定义应用程序?

Even more impressive is the story behind this young programmer and how he maintains this ongoing project.

更令人印象深刻的是这位年轻程序员的故事以及他如何维护这个正在进行的项目。

So I got in touch with Aaron, and he kindly agreed to answer a few questions. You can read his answers below.

因此,我与亚伦取得了联系,他也很乐意回答一些问题。 您可以在下面阅读他的答案。

Me: Hi Aaron, thanks for agreeing to answer a few questions about aOS. Let’s start by hearing a little more about you, and how you began your programming journey. Were there any key figures or events that inspired you?

我:Aaron,谢谢您同意回答有关aOS的几个问题。 首先,让我们详细了解一下您,以及您如何开始编程之旅。 是否有任何启发您的关键人物或事件?

Aaron: Thanks for your interest in aOS! About me? I’m just an average Arizona teen fresh out of high school. I’m currently working at a branch of AMC Theatres and also in a grocery store. My first programming experience came about by an ironic twist of fate, actually. When I signed up for high school classes in my freshman year, I was (and still am today) very interested in photography, so I requested Film Production as one of my classes.

亚伦:感谢您对aOS的关注! 关于我? 我只是刚从高中毕业的普通亚利桑那州青少年。 我目前在AMC剧院的分支机构和杂货店工作。 我的第一次编程经验实际上是命运的讽刺意味。 当我大一的时候报名参加高中课程时,我对摄影非常感兴趣(今天仍然是今天),所以我要求电影制作作为我的课程之一。

Apparently though, that class was full, so I was instead placed in GenYes — a class that focuses on educating my generation about important computer-related skills. Things like troubleshooting and fixing computers, using common programs, and of course — programming. If I had been accepted for the Film Production class, I likely never would have found programming, let alone let it envelop my life the way it has! My GenYes teacher really helped me out, and I retook the class again in my last year of high school. That class alone is what allowed my programming journey to take off at all.

但是,显然,该课程已满,因此我被安置在GenYes中-该课程专注于教育我们这一代人有关计算机的重要技能。 诸如故障排除和修复计算机,使用通用程序,当然还有编程之类的事情。 如果我被电影制作班录取了,我可能永远也找不到编程,更不用说让它像现在这样笼罩我的生活了! 我的GenYes老师真的帮助了我,在高中的最后一年,我又重新上课了。 仅仅那一堂课就让我的编程之旅从此起飞。

That sure was a lucky twist of fate! Tell me more how aOS began? What was the initial idea, or scope of the project?

那肯定是命运的幸运转折! 告诉我更多aOS是如何开始的? 什么是最初的想法或项目范围?

This is a tricky question! My first experiences in programming were spent making dozens of tiny little projects; such as calculators, string manipulators, etc. One of these projects was an “Operating System”, or at least something which looked a bit like one. You can see that project here.

这是一个棘手的问题! 我最初的编程经验是花在制作许多小项目上。 例如计算器,字符串操纵器等。其中一个项目是“操作系统”,或者至少是一个看起来有点像的项目。 您可以在这里看到该项目。

At the time, I was so proud of it — but I thought to myself, why stop at a simple joke app? What if I tried to actually make a legitimate program with an actual purpose? aOS is where I went with that initial desire. Note that aOS and the first “operating system” project are two completely different builds. I started over and gave up many times in the early periods of aOS, usually with the excuse of “I am in way over my head.”

当时,我为之感到骄傲-但我心想,为什么要停在一个简单的玩笑应用程序上? 如果我试图实际制作具有实际目的的合法程序该怎么办? 我最初的愿望就是去aOS。 请注意,aOS和第一个“操作系统”项目是两个完全不同的内部版本。 我重新开始并在aOS的早期放弃了很多次,通常以“我在头顶上”为借口。

I’m sure a lot of beginner developers go through a similar experience. How did you work through those initial doubts?

我敢肯定,很多初学者都会经历类似的经历。 您是如何解决这些最初的疑问的?

The main way that I worked around these early doubts is that after all these unsuccessful attempts, I decided to actually finish my programming course on JavaScript to learn that bit more, so I could come back and try again.

解决这些早期怀疑的主要方法是,在所有这些失败的尝试之后,我决定实际结束JavaScript编程课程以学习更多的知识,因此我可以再次尝试。

The approach I took at the next attempt was, rather than focusing on “building an entire operating system”, I would focus instead on “creating a desktop”, and then “creating a window”, and then “making the window move” — with each as separate, self-contained tasks. This change of focus meant the project no longer felt like an immense task that would never be completed. Instead, it now felt like a collection of (supposedly) easier tasks, and each time I completed one, it motivated me to move on to another. This continued, and here we are today — I’m proud to say aOS now almost feels like a ‘real’ desktop.

我下一次尝试的方法不是专注于“构建整个操作系统”,而是专注于“创建桌面”,然后“创建窗口”,然后“使窗口移动” —每个都是独立的,独立的任务。 焦点的改变意味着该项目不再像一个永远无法完成的艰巨任务。 取而代之的是,现在感觉就像是一组(据说)更容易完成的任务,每当我完成一个任务时,它就会促使我继续前进。 这一直持续到今天,今天我们很自豪–我很自豪地说aOS现在几乎感觉像是一个“真实”的桌面。

Could you clarify for everyone reading this exactly what aOS is? To what extent does it emulate a ‘real-world’ operating system?

您能为每个阅读这篇文章的人澄清一下什么是aOS吗? 它在多大程度上模拟了“现实世界”的操作系统?

OK, so aOS actually does not in any way interact with the hardware of the machine. The closest to the machine that aOS gets is reading the battery level, and perhaps reading the state of the network. The browser handles all the low-level memory management, and aOS cannot work on its own, say, installed in boot code or running in native code. In that sense, aOS is truly closer to a desktop environment than to an operating system.

好的,因此aOS实际上不会以任何方式与计算机的硬件进行交互。 最接近aOS的机器正在读取电池电量,也许正在读取网络状态。 浏览器处理所有低级内存管理,并且aOS不能单独运行,例如安装在引导代码中或以本机代码运行。 从这个意义上讲,aOS实际上更接近于桌面环境而不是操作系统。

Sure — as an exercise in UI and systems design though, it is a remarkable feat. What inspiration did you take from any existing projects?

当然-作为UI和系统设计中的一项练习,这是一项了不起的壮举。 您从任何现有项目中汲取了什么灵感?

I’ve taken inspiration from many sources. Looking back as far as I can remember, the only real operating systems I used were Windows (at home) and Chrome OS (at school). In the oldest surviving version of aOS available, there are a couple of Windows-inspired artefacts present. One is that Notepad is, of course, named after its Windows counterpart.

我从很多方面都得到了启发。 回顾过去,我使用的唯一真正的操作系统是Windows(在家)和Chrome OS(在学校)。 在可用的最旧的aOS版本中,存在一些Windows启发的人工制品。 其中之一就是记事本,当然是以其Windows对应物命名的。

The Files and Internet apps took some subtle cues from the Chrome browser in their design; mostly with the tab bar at the top sticking above the content than anything else. More recently, inspiration from other sources can be very easily found in different places of the OS. The WindowBlur effect is very reminiscent of the Aero look from Windows. The taskbar is very similar to that of Windows. I’ve included a simulated bash console, which is obviously inspired by Linux. Another Linux feature is the ability to fold windows with the button on the left side of the title bar. The ‘Settings’ menu is very much inspired by the Windows 10 settings menu.

文件和Internet应用程序在设计中从Chrome浏览器中获得了一些细微的提示; 大多数情况下,顶部的标签栏比内容高。 最近,在操作系统的不同位置可以很容易地找到其他来源的灵感。 WindowBlur效果非常让人联想到Windows的Aero外观。 任务栏与Windows非常相似。 我提供了一个模拟的bash控制台,该控制台显然是受Linux启发的。 Linux的另一个功能是可以使用标题栏左侧的按钮折叠窗口。 Windows 10设置菜单非常启发了“设置”菜单。

There are a few different Dashboard modes that are inspired by those of Windows 7, Android, and Linux’s XFCE Whiskermenu. I’m sure you can spot many other features where I’ve drawn inspiration from those sources!

有几种不同的仪表板模式,其灵感来自Windows 7,Android和Linux的XFCE Whiskermenu。 我相信您可以发现许多其他功能,这些都是我从这些资源中汲取灵感的!

Overall, what have been your favorite parts of the project so far? And what have been the biggest challenges you’ve faced?

总体而言,到目前为止,您最喜欢该项目的哪些部分? 您面临的最大挑战是什么?

My favorite part of the project? Oh boy, again with the hard questions! I’m really not sure if I could point to a specific moment, but I remember that getting the window movement and resizing features working correctly alongside the WindowBlur effect was one of the best “I did it!” moments. I’d say those moments of toiling away over something for more than a week before finally finishing and perfecting it — those are my favorite moments in aOS development.

我最喜欢的项目部分? 哦,男孩,又遇到了难题! 我真的不确定是否可以指出一个特定的时刻,但是我记得让窗口移动和调整大小的功能与WindowBlur效果一起正常工作是最好的“我做到了!”之一 片刻。 我要说的是,花一个多星期辛苦工作的那一刻才最终完成并完善它们–这些是我在aOS开发中最喜欢的时刻。

As for challenging parts of development, I can immediately think of two: working with the security restrictions enforced by the browser, and performance issues caused by the browser. In fact, I’ve had to rewrite major parts of the OS several times because performance was too bad.

对于开发中具有挑战性的部分,我可以立即想到两个:处理由浏览器实施的安全性限制,以及由浏览器引起的性能问题。 实际上,由于性能太差,我不得不多次重写操作系统的主要部分。

For example, when it was first unveiled, WindowBlur was horrible on the framerate, even on more powerful machines. I was forced to redo it, and even more recently just dial it down a bit, for the sake of performance.

例如,当它首次发布时,WindowBlur在帧速率上甚至在功能更强大的机器上都是可怕的。 为了性能起见,我被迫重做它,最近甚至只是稍微拨下它。

As for security, ensuring that everyone is viewing the page in https was very difficult. Without https, Chrome would ask for a permission prompt every single time I tried to access the microphone (for the NORAA virtual assistant) or camera (for the Camera app). Using https, the site is more secure, and Chrome only asks one time about all this, and remembers each user’s preference.

关于安全性,确保每个人都在查看https中的页面非常困难。 如果不使用https,则每次我尝试访问麦克风(对于NORAA虚拟助手)或相机(对于“相机”应用)时,Chrome都会询问权限提示。 使用https,该网站更加安全,Chrome浏览器仅询问一次所有相关信息,并记住每个用户的偏好。

Also, now that I think about it, perhaps the absolute worst problem I faced in the development of aOS was Chrome’s cache. Chrome would cache my script and stylesheet, which would make updates next to impossible to push. I’ve since worked around this feature, by placing the millisecond of the GET request in the URL parameters of the script file. That was a hard roadblock to figure out!

此外,现在考虑一下,也许我在开发aOS时遇到的绝对最糟糕的问题是Chrome的缓存。 Chrome会缓存我的脚本和样式表,这将使更新几乎无法推送。 此后,我通过将GET请求的毫秒数放置在脚本文件的URL参数中来解决此功能。 那是很难找出的障碍!

Are you part of a wider developer community?

您是更广泛的开发者社区的一员吗?

Until recently, I have worked alone on this project. However, I have since had some contributions in the form of icons, graphics, and ideas from the public, and I am open to contributions from anyone — as long as I’m able to review and implement the changes myself.

直到最近,我还独自从事这个项目。 但是,此后,我以公众的图标,图形和想法的形式做出了一些贡献,只要我能够自己查看和实施更改,我就可以接受任何人的贡献。

Much of your source code is publicly available, and is unconventional in that most of the logic is contained within a single 12,000-plus line file. Does this affect your workflow, and if so, do you plan to refactor your code at some point?

您的许多源代码是公开可用的,并且是非常规的,因为大多数逻辑都包含在单个12,000多个行文件中。 这会影响您的工作流程吗?如果是,您打算在某个时候重构代码吗?

While the very large singular file may seem like a caveat, I’ve actually kept it this way for a reason. When the script files are called upon separately — say each app in its own script file — then Chrome will load each file asynchronously and run them all as soon as they load, with the result being they are almost always run out of order!

尽管非常大的单个文件可能看起来像是一个警告,但实际上我出于某种原因一直将其保留下来。 如果分别调用脚本文件(例如在其自己的脚本文件中说每个应用程序),那么Chrome将异步加载每个文件,并在加载后立即运行所有文件,结果几乎总是无序运行!

In aOS, system apps initializing in the wrong order, or certain bits of boot code running in the wrong order, can break the system. In one large file, all of this timing issue is avoided, and each module loads one by one, in perfect order. I’ve since made more steps towards getting more of a modular setup into the source, but for now, one big file is still the way I’m going.

在aOS中,以错误的顺序初始化的系统应用程序,或者以错误的顺序运行的启动代码的某些位,可能会破坏系统。 在一个大文件中,避免了所有此类计时问题,并且每个模块均以完美的顺序逐一加载。 从那以后,我已经采取了更多的步骤,以使更多的模块化设置进入源代码,但就目前而言,一个大文件仍然是我要走的路。

You used Cloud9 to develop and host AaronOS. Do you do all your dev work online, or do you work locally as well? What is your current development setup like?

您使用Cloud9开发和托管AaronOS。 您是否在网上进行所有开发工作,还是在本地工作? 您当前的开发设置是什么样的?

Originally AaronOS was developed on Codecademy’s codebit program. This was back in V0.9 and earlier, and the codebit version was very limited as I could only use three files — one HTML, one CSS, and one JavaScript. No PHP, or outside linking (besides images).

最初,AaronOS是在Codecademy的代码位程序上开发的。 这是V0.9和更早的版本,并且代码位版本非常有限,因为我只能使用三个文件-一个HTML,一个CSS和一个JavaScript。 没有PHP,也没有外部链接(除了图片)。

All my dev work is done online, and the Cloud9 IDE is very good in terms of its continuity — I can be writing code on one computer, run out of battery abruptly, and pick up on another computer with the IDE in the exact same state it was in when I ran out of battery. The file is scrolled to the same place, terminal sessions persist, tabs persist, everything persists. Even the cursor remains in the same place! I literally log in on any computer and just get to work, which is amazing.

我所有的开发工作都是在线完成的,并且Cloud9 IDE的连续性非常好-我可以在一台计算机上编写代码,突然用完电池,然后在IDE处于完全相同的状态下接上另一台计算机那是我没电的时候。 文件被滚动到相同的位置,终端会话持续,选项卡持续,所有内容持续。 甚至光标都停留在同一位置! 我实际上登录了任何计算机,然后开始工作,这真是太好了。

My main hardware setup is an HP 350 G1 machine running an i3 processor with integrated graphics, and, more recently, 16GB RAM. It’s my main gaming machine as well, and has surprised me with its ability to run 60FPS in many games.

我的主要硬件设置是一台HP 350 G1机器,该机器运行带有集成显卡的i3处理器,以及最近的16GB RAM。 它也是我的主要游戏机,它在许多游戏中都能运行60FPS的能力使我感到惊讶。

I use Windows 10 for gaming, but I mainly run Linux Mint with the XFCE desktop. I’ve got AeroGlass and Classic Shell installed, which make it look much like Windows 7. Personally, I’m not a fan of the Windows 10 UI — little details really bug me, such as Command Prompt occasionally opening with the Windows 98-themed window borders, or the way that running programs in compatibility mode for Windows XP makes them use the Windows 7 Basic window borders. Make up your mind, Windows!

我使用Windows 10进行游戏,但是我主要在XFCE桌面上运行Linux Mint。 我已经安装了AeroGlass和Classic Shell,这使它看起来很像Windows7。就我个人而言,我不是Windows 10 UI的粉丝–确实让我感到烦恼的是一些细节,例如Command Prompt偶尔会随Windows 98-主题窗口边框,或在Windows XP兼容模式下运行程序的方式使它们使用Windows 7 Basic窗口边框。 下定决心,Windows!

You’ve clearly got a keen eye for consistent UX! What frameworks or tools did you use to build the UI and backend logic? And do you have a favorite language to work with?

您显然对统一的UX有着敏锐的眼光! 您使用什么框架或工具来构建UI和后端逻辑? 您有喜欢的语言吗?

One of my goals with aOS was to use no third-party JavaScript libraries. All code was written by scratch myself — no jQuery, Angular, Underscore, etc. — it’s all 100% pure “vanilla” JavaScript. The UI is presented completely in HTML and CSS, and all client-side code is JavaScript. Server-side code is written in PHP.

我使用aOS的目标之一是不使用第三方JavaScript库。 所有代码都是我自己写的,没有jQuery,Angular,Underscore等。它们都是100%纯的“原始” JavaScript。 UI完全以HTML和CSS表示,所有客户端代码均为JavaScript。 服务器端代码是用PHP编写的。

My favorite language would have to be JavaScript, though TI-BASIC comes in as a close second. For anyone who doesn’t know, TI-BASIC is the language used on TI-8* calculators, and means a lot to me because it was the only way I could program during other classes! Plus, the other kids at school appreciated the video games I put onto their calculators for them.

尽管TI-BASIC紧随其后,但我最喜欢的语言是JavaScript。 对于任何不知道的人,TI-BASIC是TI-8 *计算器上使用的语言,对我来说意义重大,因为这是我在其他课程中编程的唯一方式! 另外,学校的其他孩子也很欣赏我为他们安装的计算器上的视频游戏。

The NORAA virtual assistant is a really cool feature — how did that come about?

NORAA虚拟助手是一个非常酷的功能-怎么实现的?

NORAA was invented one night when I was re-watching War Games, (a movie with a computer called JOSHUA which tricked everyone into thinking there was a global thermonuclear war). NORAA is inspired in part by Windows’ Cortana, and in part by JOSHUA (edit: Aaron, please don’t start WW3…).

NORAA是在我重新观看《战争游戏》的那天晚上发明的(这是一部名为JOSHUA的计算机的电影,使每个人都以为是一场全球性热核战争)。 NORAA的部分灵感来自Windows的Cortana,部分灵感来自JOSHUA (编辑:Aaron,请不要启动WW3…)

JOSHUA is where the terminal-like appearance for NORAA comes from. I’ve coded in the ability for NORAA to adapt his or her responses based on his or her attitude towards you. Sadly, this feature has gotten little implementation besides a few testing commands. Currently, NORAA is more focused on performing tasks than looking things up on the Internet. In case you were wondering, NORAA is my own name, spelled backwards!

JOSHUA是NORAA终端外观的来源。 我已经编码为NORAA,可以根据他或她对您的态度来调整他或她的React。 令人遗憾的是,除了一些测试命令之外,该功能几乎没有实现。 当前,NORAA更加专注于执行任务,而不是在Internet上查找事物。 如果您想知道,NORAA是我自己的名字,请反拼!

In terms of the future, what are your plans and ambitions? What’s up next for AaronOS? And how about cloud-based systems and desktops in general?

在未来,您有什么计划和抱负? AaronOS接下来要做什么? 总体而言,基于云的系统和桌面如何?

At this point, I have no specific plans for AaronOS; by which I mean that AaronOS has no real point at which it will be “finished”. Much like the game Minecraft, it will be continually updated and improved upon until I am physically unable to keep working on it, or if I ever run out of money… whichever comes first!

目前,我还没有针对AaronOS的具体计划。 我的意思是说AaronOS没有“完成”它的真正意义。 就像游戏《我的世界》一样,它会不断更新和改进,直到我无法继续进行游戏,或者如果我花光了……以先到者为准!

That said, the next big step for aOS is the release of the Beta version. The Beta is not finished and is still under development, but it will be marked by some big upgrades, perhaps by the introduction of an Extension Market where you can download apps, scripts, and stylesheets made by other users. Only time will tell.

也就是说,aOS的下一个重要步骤是Beta版的发布。 Beta尚未完成,仍在开发中,但是它将进行一些重大升级,可能是引入了扩展市场,您可以在其中下载其他用户制作的应用程序,脚本和样式表。 只有时间证明一切。

While there are few cloud-based desktops available, the only two I can think of off the top of my head that are still in active development are my own aOS and another called OS.js, which is an amazing project.

虽然几乎没有可用的基于云的桌面,但我能想到的唯一两个仍在积极开发中的桌面是我自己的aOS和另一个名为OS.js的项目,这是一个了不起的项目。

I hope that aOS, OS.js, and other projects like them will stand as proof that with programming (and enough free time), you can make almost anything you want come true.

我希望aOS,OS.js和其他类似项目能够证明,通过编程(以及足够的空闲时间),您几乎可以实现所有想要的事情。

Aaron, thanks for taking the time to answer some questions! Once again, congrats on a truly impressive project — I look forward to seeing what comes next!

亚伦,感谢您抽出宝贵的时间回答一些问题! 再次恭喜一个真正令人印象深刻的项目-我期待看到接下来的发展!

My pleasure — thank you for this wonderful opportunity to talk about aOS! I look forward to reading it when it comes out.

我的荣幸—感谢您有宝贵的机会讨论aOS! 我期待阅读它的到来。

翻译自: https://www.freecodecamp.org/news/how-a-self-taught-teenager-built-an-operating-system-that-runs-in-your-browser-47da735ac919/

自学成才翁

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值