想学编程从什么入手(如何学习一门编程语言(双语版))

feifei123 发布于 2025-02-26 阅读(15)

php教程简单网站搭建

If you have an interest in creating computer programs, mobile apps, websites, games or an资源y other piece of software, youll need to learn how to program. Programs are created through the use 资源of a programming language. This language allows the program to function with the machine it is runni资源ng on, be it a computer, a mobile phone, or any other piece of hardware.如果你有兴趣编写计算机程序,移动APP,网站,游戏或者任资源何软件,你应该学习编程。

编程语言撰写的代码构建了计算机的程序。这个语言可以让程序让机器运行起来完成特写功能,机器指计算机、智能手机,其它任何的硬件产品中的一种。

1 Determine your are资源a of interest   明确你的兴趣点.You can start learning with any programming language (though some are defini资源tely "easier" than others), so youll want to start by asking yourself what it is you want to accompl资源ish by learning a programming language. This will help you determine what type of programming you sh资源ould pursue, and provide you a good starting point.你可以选择任意一门计算机语言起步,首先你要明确学习编程目标。

这个可以帮助你确定编程语言的类型,做为资源一个学习的好起点If you want to get into web development, youll have a whole different set of languages that 资源youll need to learn as opposed to developing computer programs. Mobile app developing requires a dif资源ferent skillset than machine programming. All of these decisions will influence your direction.如果你的目资源标是网页开发,也有一大堆不同的语言(有别与计算机应用程序)。

移动应用开发也需要一组技能,有别于机器编程这些决定都将影响你的学习方向。

2 Consider starting with a "simple资源r" language   虑从简单的语言入门.Regardless of your decision, you may want to consider starting with one of t资源he high-level, simpler languages. These languages are especially useful for beginners, as they teach资源 basic concepts and thought processes that can apply to virtually any language.学管你们的初衷是什么,编程入门应该选择一个资源简单的高级语言。

这些简单高级语言对初学者很重要,它们会让你明白基础的概念和流程The two most popular languages in this category are Python an资源d Ruby. These are both object-oriented web application languages that use a very readable syntax最流行的资源是Python和Ruby。

它们是面向对象的,支持Web应用程序 , 而且语法可读性好"Object-oriented" means that the language is built around 资源the concepts of "objects", or collections of data, and their manipulation. This is a concept that is资源 used in many advanced programming languages such as C++, Java, Objective-C, and PHP.面向对象是指,这个语言是基于对资源象、数据的集合及数据的操纵来构建的程序的。

面向对象的概念在诸如C++,Java, Objective-C, 和PHP广泛应用

3 Read through some basic tutorials fo资源r a variety of languages.   阅读一些基础的教程 If youre still not sure which language you should start learni资源ng, read through some tutorials for a few different languages. If one language makes a bit more sens资源e than the others, try it out for a bit to see if it clicks. There are countless tutorials for every资源 programming available online, including many on wikiHow:

如果你还不能确认学习什么编程语言,首先阅读一些基础教程如果感觉一门语言比另外的语言更有资源意思,可以尝试一下网上这类教程很多Python - A great starter language that is also quite powerful when you get familiar资源 with it. Used for many web applications and a number of games.。

这门语言是比较好的起步语言,功能非常强大在编写Web应用程序,游戏应用广资源泛Java - Used in countless types of programs, from games to web applications to ATM software 适用于很多的程序资源,从游戏到Web应用,到ATM机等,都有它的身影。

HTML - An essential starting place for any web developer. Having a handle o资源n HTML is vital before moving on to any other sort of web development.对Web开发者来说,这是必学的一门基础语言。

对于开发各类We资源b应用程序,掌握它是非常必要的C - One of the older languages, C is still a powerful tool, and is the basis for the 资源more modern C++, C#, and Objective-C.历史悠久的一门计算机语言,也是一个功能强大的工具,对于学习C++,C#,Object-C来说,它是它们的基础。

1 Learn 资源the core concepts of the language.  学习编程语言中一些重要与核心的概念While the parts of this step that apply will va资源ry depending on the language you choose, all programming languages have fundamental concepts that ar资源e essential to building useful programs. Learning and mastering these concepts early will make it ea资源sier to solve problems and create powerful and efficient code. Below are just some of the core conce资源pts found in many different languages这部分内容,主要取决于你选择的编程语言。

每门编程语言都有一些基本的概念,这些概念是编写程序的基础尽早熟悉并掌握这些概念,让你更资源容易的解决问题,创建功能强大、高效的代码下面是一些编程语言的核心的概念:Variables - A variable is a way to store and refer to changing p资源ieces of data. Variables can be manipulated, and often have defined types such as "integers", "chara资源cters", and others, which determine the type of data that can be stored. When coding, variables typi资源cally have names that make them somewhat identifiable to a human reader. This makes it easier to und资源erstand how the variable interacts with the rest of the code

变量:存储与修改数据的方法,变量可以变程序所操纵,一般会定义类型,如整形,字符串资源等,用来确定数据存储的类型编写代码时,一般会指定变量的名称,其目的是起到标识并区别更容易理解这个变量与代码其它部分的关系Conditional Statements - A conditional s资源tatement is an action that is performed based on whether the statement is true or not. The most comm资源on form of a conditional statement is the "If-Then" statement. If the statement is true (e.g. x = 5)资源 then one thing happens. If the statement is false (e.g. x != 5), then something else happens

条件语句:指令资源根据条件的成立或者不成立,执行不同的代码 最常用的表达式是If-Then结构如条件成立(x=5的情况),做一件事情,如条件不成立(x<>5的情况)做另外一件事情Functions or Subrout资源ines - The actual name for this concept may be called something different depending on the language.资源 It could also be "Procedure", a "Method", or a "Callable Unit". This is essentially a smaller progr资源am within a larger program. A function can be "called" by the program multiple times, allowing the p资源rogrammer to efficiently create complex programs。

函数或者子程序:它的真实的命名因程序语言不同而异常常被叫做“过程”,“方法”,或者“调用单元”在大程序资源中有小程序很重要一个函数可以被程序调用多次,这样方便程序员编程时很高效Data input - This is a broad concept that is used in nearly every资源 language. it involves handling a users input as well as storing that data. How that data is gathere资源d depend on the type of program and the inputs available to the user (keyboard, file, etc.). This is资源 closely linked to Output, which is how the result is returned to the user, be it displayed on the s资源creen or delivered in a file。

数据输入:这是一个在很多程序中使用的很大的一个概念,包含程序如何处理用户输入数据,如何存储数据。数据如何收集也与不同类型的程序、提供的输入变量资源有关。如何输出数据,是通过显示器还是文件,也是同样道理。

2  Install any necessary software.安装所有必备的软件(工欲善其事,必先利其器)Many programming资源 languages require compilers, which are programs designed to translate the code into a language that资源 the machine can understand. Other languages, such as Python, use an interpreter which can execute t资源he programs instantly without compiling很多编程语言需要编绎器,它也是一些用来把代码转化成机器语言的程序。

另外一些语言如Python无需编绎器,而过通过解释器边读资源取边执行的.Some languages have IDEs (Integrated Development Environment) which usually contain a code edi资源tor, a compiler and/or interpreter, and a debugger. This allows the programmer to perform any necess资源ary function in one place. IDEs may also contain visual representations of object hierarchies and di资源rectories一般程序评议有一个集成开发环境(IDE),通常由代码编辑器,编绎器或者解释器,还有调试器等构成。

这样程序员可以在同一个地方完成基本上所有的功能IDE通常又包含可视化的对象层次结构的目资源录.There are a variety of code editors available online. These programs offer different ways of highl资源ighting syntax and provide other developer-friendly tools现在网上有很多代码编辑器,这些程序提供各种彩色文本高亮显示和很多用户友好的工具,.

1 资源Focus on one concept at a time    同一时间段专注一个概念. One of the first programs taught for any language is 资源the "Hello World" program. This is a very simple program that displays the text "Hello, World" (or s资源ome variation), on the screen. This program teaches first-time programmers the syntax to create a ba资源sic, functioning program, as well as how to handle displaying output. By changing the text, you can 资源learn how basic data is handled by the program. Below are some wikiHow guides on creating a "Hello W资源orld" program in various languages程序界一般教一门新的语言会用“你好,世界”来起步。

它只在屏幕上显示“你好,世界”的简单程序它教会新手创建产基本程序结构的最简单的语法资源,及处理显示的输出通过修改文本,你会了解程序如何处理基本数据下面的链接是不同的编程语言显示“你好,世界!”:Hello World in Python

Hello World in RubyHello 资源World in CHello World in PHPHello World in C#Hello World in Java

2Learn through deconstruction of onl资源ine examples.通过剖析网络上大量案例来学习There are thousands of code examples online for virtually every programmi资源ng languages. Use these examples to examine how various aspects of the language work and how differe资源nt parts interact. Take bits and pieces from various examples to create your own programs网络上有大量的代码实例资源可供学习与参考,通过实例的学习,可以了解语言工作的方方面面及它们部件之间如何交互。

可以从实例中选取部分代码来创建你的程序

3 Examine the syntax.   检查语法的正确性The synt资源ax is the way the language is written so that the compiler or interpreter can understand it. Each la资源nguage has a unique syntax, though some elements may be shared across multiple languages. Learning t资源he syntax is essential for learning how to program in the language, and is often what people think o资源f when they think about computer programming. In reality, it is simply the foundation upon which mor资源e advanced concepts are built语法是编程语言的书写正确方式,这样编绎器与解释器才能够理解程序。

每个语言的语法都是不一样的,尽管一些元素共享多门编程语言学习语法知识是学习编程资源的基本功,编程代码也体现了程序员的思想现实中也一样,语法是语言中其它高级功能的基础

4 Experiment with changes.   通过修改程序进行不断的实验Make changes to y资源our example programs and then test the result. By experimenting, you can learn what works and what d资源oesnt much quicker than by reading a book or guide. Dont be afraid to break your program; learning t资源o fix errors is a major part of any development process, and new things almost never work right the 资源first time 修改样本程序,测试结果。

通过大量实验,你会学会那些可行,那些不可行,这种方法比阅读书本与编程指南要高效与快速不要害怕程序的中断,学会如何纠正错误是开发过程中一个不可缺少的步骤,新资源事情一般不可能第一次就能够正常运行.

5 Start practicing debugging.开始练习调试代码When youre programming, youre invariably goin资源g to come across bugs. These are errors in the program, and can manifest virtually anywhere. Bugs ca资源n be harmless quirks in the program, or they can be major errors that keep the program from compilin资源g or running. Hunting down and fixing these errors is a major process in the software development cy资源cle, so get used to doing this early一旦编写程序,你会经常遇到错误,它们会出现在程序任何地方。

它们是不通过编绎或者解释的主要错误找到并修正这个错误是软件开发环节中一资源个重要环节,所以不要紧张As you experiment with changing basic programs, youre going to come across things that d资源ont work. Figuring out how to take a different approach is one of the most valuable skills you can h资源ave as a programmer修改基本程序时,经常会碰到程序问题.找到不同解决问题的方案,是作为程序积累经验与技巧的最佳途径。

6 Comment all of your code.   对代码资源进行必要的注释Nearly all programming languages have a "comment" function that allows you to include text th资源at is not processed by the interpreter or compiler. This allows you to leave short, but clear, human资源-language explanations of what the code does. This will not only help you remember what your code do资源es in a large program, it is an essential practice in a collaborative environment, as it allows othe资源rs to understand what your code is doing程序语言一般都注释这个功能,注释的内容编绎器与解释器是不会处理的。

一般情况下,注释要求用简洁的,自然语言来解释代码的做什资源么在大型程序中,这个方法可以帮助你记住代码的功能,在团队协助的环境下,也是让他人读懂你的代码的方法.

1 Code daily.每天都编写代码(拳不离手,曲不离口)Mastering a program资源ming language takes time above all else. Even a simpler language like Python, which may only take a 资源day or two to understand the basic syntax, takes lots of time to become truly proficient at. Like an资源y other skill, practice is the key to becoming more proficient. Try to spend at least some time each资源 day coding, even if its only for an hour between work and dinner 掌握一门编程语言非常费时,即便是Python这个语言,也需要1-2天资源才能够理解基本的语法,掌握需要更多的时间。

与其它技能一样,熟能生巧. 每天抽出一点时间编程,即使工作或者用餐中的间隙时间

2Set goals for your programs.为编写的程序设定一个挑资源战性目标By setting attainable but challenging goals, you will be able to start solving problems and comi资源ng up with solutions. Try to think of a basic application, such as a calculator, and develop a way t资源o make it. Use the syntax and concepts youve been learning and apply them to practical uses设定一个可行但又有资源挑战的目标,这样能够解决问题,提出方案。

先想出一个简单的应用程序,如计算器的开发及步骤在编写过程中使用已学的语法与概念,并运用到实际中

3Talk with others and read other 资源programs.与高手交流,经常阅读别人的程序There are lots of programming communities dedicated to specific languages or资源 disciplines. Finding and participating in a community can do wonders for your learning. You will ga资源in access to a variety of samples and tools that can aid you in your learning process. Reading other资源 programmers code can inspire you and help you grasp concepts that you havent mastered yet.有很多的编程社区,资源致力于特写的编程语言或者相应学科。

参于到这些你感兴趣的社区活动,你会接触大量例子,工具来帮助你学习阅读别人的代码可以激发你的创造力,帮助你掌握一些核心的概念与思想Check out programmi资源ng forums and online communities for your language of choice. Make sure to participate and not just 资源constantly ask questions. These communities are usually viewed as a place of collaboration and discu资源ssion and not simply Q&A. Feel free to ask for help, but be prepared to show your work and be open t资源o trying different approaches 去看看编程的论坛,尽量参与进去,不局限于问问题。

社区里有很多的协助,讨论,不局限于问答不要羞于问问题,提交你的工作,打开的想像力,尝试不同的资源方法Once you have some experience under your belt, consider attending a hack-a-thon or programming jam资源. these are events where individuals or teams compete against the clock to develop a functional prog资源ram, usually based around a specific theme. These events can be a lot of fun and are a great way to 资源meet other programmers 积累到一定的程度,参加一些编程

果酱,这些是个体或者团队定期开发一些功能性程序,一般面对一些特定的主题。这些活动好玩,也是接触其它程序员的好方法。

Chall资源enge yourself to keep it fun.挑战自己,让编程变得有趣好玩Try to do things that you dont know how to do yet. Resear资源ch ways to accomplish the task (or a similar one), and then try to implement that in your own progra资源m. Try to avoid being content with a program that "basically" works; do everything you can to make s资源ure every aspect works flawlessly挑战一些你不知道如何做的事情。

并研究提出解决问题的方法,并用你的程序实现问题的求解为了不满足于简单的基本程序,尽量想办法让代码完美的运资源行起来

1Take a few training courses.参加一些培训课程 Many universities, community colleges, and community center资源s offer programming classes and workshops that you can attend without having to enroll in the school资源. These can be great for new programmers, as you can get hands-on help from an experienced programme资源r, as well as network with other local programmers很多的大学,社区学院,社区提供一些编程课程或者就业课程,你可以参加这些课程。

对新手来说也是一个非常难资源得的机会,你可以得到有经验丰富程序员及时的帮助,也可以与当地的其它程序员协作分享

2Buy or borrow a book. T购置或者借阅一些工具书here are thousands of ins资源tructional books available for every conceivable programming language. While your knowledge should n资源ot come strictly from a book, they make great references and often contain a lot of good examples编程方资源面的书籍多如牛毛。

当然你的知识不可能都书本上来,书本只做一些重要参考与案例的解读.

3Study math and logic.学习数学与逻辑的知识Most programming involves b资源asic arithmetic, but you may want to study more advanced concepts. This is especially important if y资源ou are developing complex simulations or other algorithm-heavy programs. For most day-to-day program资源ming, you dont need much advanced math. Studying logic, especially computer logic, can help you unde资源rstand how best to approach complex problem solving for more advanced programs 编程一般涉及到简单的算术,.你还要学习更多资源的高级内容。

这一点对于编写复杂的模拟或者涉及大量算法的程序对于大多数日常工作的程序代码,并不涉及大量高级的数学知识学习点逻辑,特别是计算机逻辑,对于理解与解决复杂问题,编写高级的程序很有用

4Never资源 stop programming.不要两天捕鱼,三天晒网There is a popular theory that becoming an expert takes at least 10,000资源 hours of practice. While this is up for debate, the general principle remains true: mastery takes t资源ime and dedication. Dont expect to know everything overnight, but if you stay focused and continue t资源o learn, you may very well end up an expert in your field 要成为其一行业的专家,有一个很著名的1万小时理论。

虽然这个理论有很大的争议性,但还是资源有一个定的普适性时间与专注是不可缺少的先决条件,不可能一口气吃成一个胖子,如果你聚集于一点,不断学习,你就很可能成为这方面的专家.

5 Learn another programming languag资源e.   学习一门其它的编程语言While you can certainly get by with mastering one language, many programmers help th资源eir chances of success in the field by learning multiple languages. Their second or third languages 资源are usually complementary to their first one, allowing them to develop more complex and interesting 资源programs. Once you have a good grasp on your first program, it may be time to start learning a new o资源ne 精通一门语言固然好,很多程序员是通过学习多门语言帮助他们获得成功。

他们的第二,三门语言是第一门语言的补充,他们能够开发出更复杂与有趣的程序如果你第一门语言精通,也是学习一门新语言的好时机.You资源 will likely find that learning your second language goes much quicker than the first. Many core con资源cepts of programming carry over across languages, especially if the languages are closely related你会发资源现学习第二门语言时,学习速度比较快。

一些核心的概念是通过语言再次呈现的,特别是这些语言比较相似

1 Enroll in a four year program.参加四年的专业课程While not st资源rictly necessary, a four year program at a college or university can expose you to a variety of diff资源erent languages, as well as help you network with professionals and other students. This method cert资源ainly isnt for everyone, and plenty of successful programmers never attended a four-year institution资源.四年的大学学习计划,让你接触不同的语言,并与专家与其它学生接触。

但这个方法并不适用任何人,很多成功的程序员并没有上过大学

2Create a portfolio.制作个人简历As you create资源 programs and expand your knowledge, make sure that all of your best work is saved in a portfolio. Y资源ou can show this portfolio to recruiters and interviewers as an example of the work you do. Make sur资源e to include any work done on your own time, and ensure that you are allowed to include any work don资源e with another company 编写程序的同时,也在扩展你的知识,确保你的所有好的作品写入履历中。

在面试中你可以抛出你的履历作为你的工作案例,主非常有说服力这些作品可以是你利用自己时间做资源的作品,也可以是你参与其它公司的项目

3Do some freelance work.做一些特约的工作(兼职工作)There is a very large freelance market for p资源rogrammers, especially mobile app developers. Take on a few small freelance jobs to get a feel for h资源ow commercial programming works. Oftentimes you can use the freelance jobs to help build your portfo资源lio and point to published work 程序员是一个很大的自由职业市场的工种,特别是对于移动APP的开发者来说。

找一个自由工作,体验一下编程如何商业化你可以通过自由市场构建你的资源履历、发布你的工作

4Develop your own freeware or commercial programs.开发自己的免费或者商业化软件You dont have to work for a资源 company to make money programming. If you have the skills, you can develop software yourself and re资源lease it for purchase, either through your own website or through another marketplace. be prepared t资源o be able to provide support for any software you release for commercial sale, as customers will exp资源ect their purchase to work 你也不一定非要就职于一家软件公司才能挣钱。

如果你有编程技能,你能够自己开发软件,并在自己的网站或者其它的商业网站上发布软件出售它不忘记要提供服务与资源后续的支持工作,因为顾客需要它来完成他们的工作.Freeware is a popular way to distribute small programs and utilities. The de资源veloper doesnt receive any money, but its a great way to build name recognition and make yourself vi资源sible in the community发布免费软件,是一种比较流行分发程序与工具的方式。

开发者没有任何收益,但这是打造网络知名度并且让社区可见的一种好的方法

亲爱的读者们,感谢您花时间阅读本文。如资源果您对本文有任何疑问或建议,请随时联系我。我非常乐意与您交流。

标签:  之家 资源网 资源 程序 语言 

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。