一切都只是文件和程序。
去年,在我大学计算机科学学习的第二年,我正在阅读《计算机网络:自顶向下的方法》。在第二章的末尾,有一个项目创意列表,我立刻被吸引住了。
我仍然记得那种兴奋感,当时我在我的笔记本电脑上禁用了防火墙(在设置中),后来我意识到客户端并不需要禁用防火墙 :D。我创建了一个 Python 脚本,通过 TCP 发送“hello”,并在我朋友的笔记本电脑上运行“服务器”(其实就是一个 Python 程序),服务器将其转换为大写,并返回“HELLO”。一周后,我完成了一个简单的多线程 HTTP 服务器的构建。我更改了路由器的设置,将端口转发到我的笔记本电脑,这样任何人都可以在任何地方使用我的(不安全的)HTTP 服务器,成功地将我笔记本上的所有文件置于风险之中 :D
在那一刻,一切都开始变得清晰,一切都是一堆文件和程序。我想,“我爱计算机科学”,我真的感动得泪水夺眶而出。
在高中时,我学习了一些入门的计算机科学课程,其中一门课教我们一些非常基础的 PHP 和 MySQL。我们只需在安装过程中按“下一步”就安装了 MySQL,突然间,我们的 PHP 代码就能将数据存储在“数据库”中。我感到困惑……像是“教授,数据库在哪里?”他没有理解我的问题,“我是说这些东西存储在哪里?”这确实是个棘手的问题,但他回答我“这只是一些文件”。我并不完全相信,但至少让我心里安定了一些……至少它在硬盘上!
在学习了操作系统、数据库和计算机网络后,我终于明白了数据库在哪里。从某种意义上说,它只是一堆文件和一些 TCP 套接字在上面。他是对的。
我不确定为什么接受一切只是一些文件和进程需要花费这么长时间去内化。
查看原文
Last year, two years into my CS studies at college, I was reading Computer Networking: A Top Down Approach, at the end of chapter 2 it contained a list of project ideas to do. I was hooked.<p>I still remember the thrill I had, disabling the firewall (in the settings) on my laptop (later I realized the client doesn't need to disable the firewall :D)
Creating a python script that sends "hello" via TCP, and running the "server" (which is just a python program) on my friend's laptop, the server makes it uppercase, and sends "HELLO" back.
a week later I had finished building a simple multithreaded http server.
I changed the router setting to do port forwarding to my laptop, so that anyone can use my (insecure) HTTP server anywhere, successfully putting all the files on my laptop in risk :D<p>At that moment everything started to click, everything is bunch of files and programs.
I thought, "I love computer science", and I literally had tears in my eyes.<p>In high school I studied some introductory computer science classes, in one of them we were taught some very basic PHP and MySQL, we installed MySQL just by pressing "next" in the setup, and suddenly, our PHP code is storing data in the "database". I was puzzled... like "professor, where is the database", he didn't understand my question, "I mean where is this stuff stored?"
It was kind of tough question indeed, but he answered me "it's just some files".
I didn't buy it, but it set my heart at ease at least... at least it's on the hard disk!<p>After studying operating systems, databases and computer networking, I finally understood where is the database. in some sense, it's just bunch of files and some TCP socket on the top. he was correct.<p>I'm not sure why accepting that everything is just a bunch of files and processes takes so much time to internalize.