Wallace Wang - Beginning Programming All-in-One For Dummies

Здесь есть возможность читать онлайн «Wallace Wang - Beginning Programming All-in-One For Dummies» — ознакомительный отрывок электронной книги совершенно бесплатно, а после прочтения отрывка купить полную версию. В некоторых случаях можно слушать аудио, скачать через торрент в формате fb2 и присутствует краткое содержание. Жанр: unrecognised, на английском языке. Описание произведения, (предисловие) а так же отзывы посетителей доступны на портале библиотеки ЛибКат.

Beginning Programming All-in-One For Dummies: краткое содержание, описание и аннотация

Предлагаем к чтению аннотацию, описание, краткое содержание или предисловие (зависит от того, что написал сам автор книги «Beginning Programming All-in-One For Dummies»). Если вы не нашли необходимую информацию о книге — напишите в комментариях, мы постараемся отыскать её.

Let there be code!
Beginning Programming All-in-One For Dummies

Beginning Programming All-in-One For Dummies — читать онлайн ознакомительный отрывок

Ниже представлен текст книги, разбитый по страницам. Система сохранения места последней прочитанной страницы, позволяет с удобством читать онлайн бесплатно книгу «Beginning Programming All-in-One For Dummies», без необходимости каждый раз заново искать на чём Вы остановились. Поставьте закладку, и сможете в любой момент перейти на страницу, на которой закончили чтение.

Тёмная тема
Сбросить

Интервал:

Закладка:

Сделать

Scripting languages work with one or more existing programs and act as “glue” that connects different parts of an existing program together. For example, Microsoft Office consists of several programs including a word processor (Microsoft Word), a spreadsheet (Microsoft Excel), and a database (Microsoft Access). By using the scripting language that comes with Microsoft Office, you can write a program that can automatically yank information from an Access database, create a chart from that information in an Excel spreadsheet, and then copy both the data and its accompanying chart into a Word document for printing.

Trying to yank information from a database, create a chart with it, and print the data and chart using a system programming language, like C++ or Java, would mean creating everything from scratch including a database, a spreadsheet, and a word processor. By using a scripting language, you use existing components and simply “glue” them together. The existing components do all the work, while the scripting language just passes the data from one component to another.

Because scripting languages work with existing programs, they differ from traditional programming languages (like C++ or Java) in two important ways:

Because scripting languages work with one or more existing programs, scripting languages are usually interpreted rather than compiled. Therefore, if someone else wants to run your program, written in a scripting language, they need the source code to your program along with all the programs your scripting program needs, such as Microsoft Word and Microsoft Access. As a result, scripting languages are used less to create commercial applications and more to create custom solutions.

To make scripting languages easy to understand and use, even for nonprogrammers, most scripting languages are typeless languages. System programming languages, like C++ and Swift, are strongly typed or type-safe languages. Strongly-typed languages force you to define the type of data your program can use at any given time. So, if your program asks the user to type a name, a strongly typed language makes sure that the user doesn’t type in a number by mistake. This protects a program from accidentally trying to manipulate the wrong type of data, which could crash the program as a result.In comparison, typeless languages don’t care what type of data the program stores at any given time. This makes writing programs much easier because your program assumes if it’s going to yank data from a particular program, such as Microsoft Excel, the data is probably going to be the right “type” anyway, so type-checking would just be restrictive and tedious.

Scripting languages are typically used in four different ways:

To automate repetitive tasks

To customize the behavior of one or more programs

To transfer data between two or more programs

To create stand-alone programs

Automating a program

At the simplest level, scripting languages (also called macro languages) can automate repetitive tasks that essentially record your keystrokes so you can play them back at a later time. For example, if you regularly type the term Campylobacteriosis (a disease caused by the Campylobacter bacteria), you have two choices:

Type the term manually, and hope that you spell it correctly each time.

Type the term just once (the easier solution), record your keystrokes, and use those captured keystrokes to create a scripting language program that you can save and run in the future.

Figure 3-6 shows a scripting language, Visual Basic for Applications (VBA), that has captured keystrokes and saved them in a VBA scripting language program.

FIGURE 36Recording keystrokes automatically creates the equivalent VBA code - фото 15

FIGURE 3-6:Recording keystrokes automatically creates the equivalent VBA code in Microsoft Word.

Customizing a program

Besides letting you automate a program, scripting languages also let you customize a program, which can make the program easier to use. For example, you may have a spreadsheet that calculates your company’s invoices. However, to use this spreadsheet, you need to know the specific place in the spreadsheet to type new invoice information. Type this information in the wrong place, and the spreadsheet doesn’t work right.

To avoid this problem, you can write a program in a scripting language that can display a window with boxes to type in new invoice information. Then the scripting language program automatically plugs that new information in the correct place in the spreadsheet every time.

For even more power, a scripting language can combine automation with customization to make programs perform tasks on their own. By using VBA in Microsoft Office, you could write a VBA program that tells your computer to copy data from an Excel spreadsheet, paste it into a Word document at a specific time each day, and then save your document.

Transferring data among multiple programs

Built-in scripting languages can help you automate or customize a program, but what if you use a program that doesn’t include a scripting language? Or what if you need to transfer data between two or more programs, but neither program uses the same scripting language? In these cases, you’ll need to use a scripting language that isn’t tied to any particular program, such as JavaScript, Perl, Python, or Ruby.

When scripting languages link two or more programs together, the scripting language programs are often referred to as glue. So, if you have a web page that lets users type in their names, addresses, and credit card numbers, and a database program that stores customer information, you could use a scripting program to glue the web page to the database. The user would type information into the web page, and the scripting language would then yank this data off the web page and shove it into the database.

By gluing programs together, scripting languages let you combine existing programs to create custom applications. Because scripting languages are interpreted rather than compiled, they can run on any computer with the proper language interpreter. So, whether you use Linux, macOS, or Windows, you can still use the same scripting language (and programs) on different computers.

Creating stand-alone programs

If you wanted to create your own program, you could write everything from scratch. So, if you wanted to include features of a spreadsheet and a database, you would have to create your own spreadsheet and database.

Obviously this would be difficult to do, so by using scripting languages within existing programs, you can create custom programs that rely on the features of an existing program like Microsoft Excel.

Now instead of writing a spreadsheet from scratch, you can use the features of the Excel spreadsheet and create a custom program based on Excel. This lets you reuse proven features of an existing program while letting you focus solely on writing the features you need.

Stand-alone programs, based on existing programs, can simply make that existing program much easier to use. For example, Microsoft Excel is a powerful spreadsheet that many people don’t know how to use. By creating a stand-alone program based on Excel, your stand-alone program can gently guide users into solving problems without forcing them to learn Excel.

Database Programming Languages

Programming languages, such as C++, are general-purpose languages because they can literally be used to create any type of program from operating systems and word processors to antivirus utilities and video games. However, in the business world, the most common type of custom programs needed are those that store and retrieve data, such as invoices, inventory, customer information, and so on.

Читать дальше
Тёмная тема
Сбросить

Интервал:

Закладка:

Сделать

Похожие книги на «Beginning Programming All-in-One For Dummies»

Представляем Вашему вниманию похожие книги на «Beginning Programming All-in-One For Dummies» списком для выбора. Мы отобрали схожую по названию и смыслу литературу в надежде предоставить читателям больше вариантов отыскать новые, интересные, ещё непрочитанные произведения.


Отзывы о книге «Beginning Programming All-in-One For Dummies»

Обсуждение, отзывы о книге «Beginning Programming All-in-One For Dummies» и просто собственные мнения читателей. Оставьте ваши комментарии, напишите, что Вы думаете о произведении, его смысле или главных героях. Укажите что конкретно понравилось, а что нет, и почему Вы так считаете.

x