Software Engineering: Crash Course Computer Science #16

CrashCourse
14 Jun 201710:35

Summary

TLDRThis episode of CrashCourse Computer Science explores the discipline of Software Engineering, emphasizing the tools and practices that allow programmers to build large, complex programs like Microsoft Office. The video discusses object-oriented programming, APIs, Integrated Development Environments (IDEs), source control, and the importance of documentation and debugging in collaborative software development. It highlights how these techniques help manage the immense complexity of modern software, enabling teams to work together efficiently while maintaining code quality and stability.

Takeaways

  • 😀 Sorting algorithms are often a small part of a much larger program, highlighting the need for efficient coding practices in software engineering.
  • 🔍 The discipline of Software Engineering was coined by Margaret Hamilton, emphasizing the importance of preventative measures in software development.
  • 🛠️ Breaking down large programs into smaller, manageable functions allows multiple programmers to work concurrently on different aspects of a project.
  • 📚 Microsoft Office, as an example, contains approximately 40 million lines of code, illustrating the scale of modern software projects.
  • 🧩 Packaging functions into hierarchies and related 'objects' is a method to manage complexity in large codebases, as seen in Object-Oriented Programming (OOP).
  • 🔑 OOP uses public and private access modifiers to control the visibility and interaction between different parts of a program, encapsulating complexity.
  • 🏗️ In large projects, teams may focus on specific subsystems, like cruise control in a car's software, relying on well-documented APIs for interaction with other parts of the system.
  • 🛠️ Integrated Development Environments (IDEs) provide tools for writing, organizing, compiling, and debugging code, streamlining the development process.
  • 🔍 Documentation is crucial for understanding and reusing code, with comments serving as in-code explanations and 'read-me' files offering external guidance.
  • 🔄 Source Control systems, like version control, allow multiple developers to work on the same project without conflicts, tracking changes and enabling rollbacks if needed.
  • 🔍 Quality Assurance (QA) testing is a rigorous process to identify and fix bugs before software is released, ensuring reliability and performance.
  • 🌐 The script concludes with a teaser for the next episode, which will discuss how computers have become incredibly fast, hinting at the underlying hardware advancements.

Q & A

  • What is the main topic discussed in the CrashCourse Computer Science video?

    -The main topic discussed in the video is the concept of Object Oriented Programming (OOP) and the practices of Software Engineering, particularly in the context of building large and complex software systems like Microsoft Office.

  • Who coined the term 'Software Engineering'?

    -The term 'Software Engineering' was coined by engineer Margaret Hamilton, who worked on the Apollo missions for NASA.

  • How does breaking a program into smaller functions help in collaborative software development?

    -Breaking a program into smaller functions allows many people to work simultaneously on different parts of the program without worrying about the whole system. This modular approach enables teams to focus on specific components or features, improving efficiency and manageability.

  • What is the purpose of packaging functions into hierarchies within objects?

    -Packaging functions into hierarchies within objects helps in organizing related code together, making it easier to manage and navigate large codebases. It also promotes reusability and maintainability of the code.

  • Can you explain the concept of Object Oriented Programming using the example of a car's software?

    -Object Oriented Programming involves creating objects that can contain other objects, functions, and variables. In the context of a car's software, you might have an 'Engine' object that contains 'children' objects like 'CruiseControl', 'IgnitionControl', etc., each with their own related functions and variables. This allows for a structured and organized approach to programming complex systems.

  • What is the role of an API in collaborative software development?

    -An API (Application Programming Interface) defines how different parts of the code interact with each other. It allows programmers to access certain functions and data while restricting access to others, ensuring that only the right people can modify or use specific parts of the code.

  • Why is it important for functions to be marked as 'public' or 'private' in OOP?

    -Marking functions as 'public' or 'private' is crucial for encapsulation in OOP. 'Private' functions can only be called within the object they belong to, while 'public' functions can be accessed by other objects. This helps in hiding the internal workings of an object and exposing only what is necessary for interaction.

  • What is an Integrated Development Environment (IDE) and what are its benefits?

    -An Integrated Development Environment (IDE) is a software application that provides a comprehensive set of tools for writing, organizing, compiling, and testing code. Benefits of using an IDE include improved readability through features like color-coding, syntax error checking, efficient navigation of large codebases, and integrated debugging support.

  • How does documentation aid in software development and maintenance?

    -Documentation, both in the form of standalone files and in-code comments, helps programmers understand the purpose and functionality of the code. It is crucial for revisiting old code, onboarding new developers, and promoting code reuse, thus reducing redundancy and improving efficiency.

  • What is Source Control and how does it facilitate collaborative coding projects?

    -Source Control, also known as version control or revision control, is a system that tracks changes to the code over time and allows multiple developers to work on the same project without conflicts. It enables programmers to check out, modify, and commit code changes back to a central repository, while also providing a way to revert to previous versions if necessary.

  • What are the differences between alpha, beta, and release versions of software?

    -Alpha versions are the earliest stage of software development, typically rough and buggy, and are only tested internally. Beta versions are more complete but still not fully tested; they may be released to the public to help identify issues. The final release version is the software that has undergone thorough testing and is ready for public use.

Outlines

00:00

📚 Introduction to Software Engineering

Carrie Anne introduces the concept of Software Engineering, emphasizing the complexity of large-scale programming projects like Microsoft Office, which contains around 40 million lines of code. She explains that such projects require a set of tools and practices to manage efficiently. The discipline of Software Engineering was named by Margaret Hamilton, an engineer known for her contributions to the Apollo missions. The analogy of a root canal is used to illustrate the importance of preventative measures in software development. The video also touches on the idea of breaking down large programs into smaller, manageable functions, which can be worked on by different teams simultaneously, and the concept of Object-Oriented Programming (OOP), which involves organizing code into objects and hierarchies to encapsulate functionality and hide complexity.

05:03

🛠 Tools and Practices in Software Development

This paragraph delves into the tools and practices that software engineers use to build complex software. Integrated Development Environments (IDEs) are highlighted as essential tools that provide a text editor, syntax checking, and debugging support. The importance of documentation, both in standalone files and within the code itself through comments, is underscored for code maintenance and reuse. Source Control systems, which manage changes to code and prevent conflicts in collaborative environments, are also discussed. The paragraph further explains the role of Quality Assurance (QA) testing in ensuring software reliability and the use of alpha and beta versions for internal and public testing, respectively. The video concludes by acknowledging the vast processing power required to run the millions of lines of code that make up today's software, setting the stage for the next episode's topic on computer speed.

Mindmap

Keywords

💡Sorting Algorithm

A sorting algorithm is a method for rearranging a list of items into a particular order, typically numerical or alphabetical. In the context of the video, it's used to illustrate the simplicity of small code tasks compared to the complexity of large software projects like Microsoft Office, which has approximately 40 million lines of code. Sorting algorithms are foundational in computer science and are often used to teach programming concepts due to their relative simplicity and clear objective.

💡Software Engineering

Software Engineering refers to the application of engineering principles to software development. It encompasses a set of tools, practices, and methodologies aimed at efficiently managing the creation and maintenance of software. The term was coined by Margaret Hamilton, who emphasized its importance in preventing serious problems during the Apollo missions. In the video, software engineering is highlighted as the discipline that enables the construction of massive software systems through structured practices and collaborative tools.

💡Object-Oriented Programming (OOP)

Object-Oriented Programming is a programming paradigm that uses objects, which can contain data, in the form of fields (often known as attributes or properties), and code, in the form of procedures (often known as methods). OOP is about creating re-usable code by encapsulating data and functions into objects. In the video, OOP is explained through the analogy of a car's software, where different functionalities like cruise control are encapsulated into objects, making it easier to manage and maintain large codebases.

💡Function

In programming, a function is a block of code that performs a specific task and can be called upon to execute that task repeatedly. Functions help in organizing code into reusable components. The script mentions that even though a sorting algorithm might be simple, large programs like Microsoft Office consist of hundreds of thousands of functions, emphasizing the scale at which software engineering operates.

💡API (Application Programming Interface)

An API is a set of rules and protocols for building and interacting with software applications. It defines how software components should interact and allows different parts of a program to communicate with each other. In the video, the API is likened to a way for collaborating programmers to interact across various parts of the code, ensuring that they can use the right functions and data without interfering with each other's work.

💡Encapsulation

Encapsulation is a fundamental concept in OOP where the details of an object's implementation are hidden from the rest of the program. It restricts direct access to some of an object's components, which can prevent accidental modification and misuse. The video explains encapsulation by describing how functions related to cruise control are bundled into a single object, with certain functions being 'private' and only callable within that object.

💡Integrated Development Environment (IDE)

An IDE is a software application that provides comprehensive facilities for coding, debugging, and maintaining software projects. IDEs typically include a source code editor, build automation tools, and a debugger. In the video, IDEs are described as essential tools for programmers, offering features like syntax highlighting and error checking, which streamline the coding process and help in identifying and fixing bugs more efficiently.

💡Debugging

Debugging is the process of finding and resolving bugs or defects that prevent correct operation of computer programs. In the script, it is mentioned that most programmers spend a significant portion of their time testing and debugging, rather than writing new code. Debugging is crucial for ensuring that software functions correctly and is free of errors.

💡Documentation

Documentation in programming refers to the written instructions and explanations that help understand the code. It can be in the form of comments within the code or separate 'read-me' files. The video emphasizes the importance of documentation for code reuse and for helping programmers, both new and revisiting, to understand the functionality and structure of the code.

💡Source Control

Source control, also known as version control or revision control, is the management of changes to the source code of software over time. It allows multiple developers to work on the same project without overwriting each other's changes. The video describes source control as a critical tool for large teams working on large projects, enabling them to check out, modify, and commit code in a controlled and organized manner.

💡Quality Assurance (QA) Testing

QA Testing is the process of verifying that a software application meets specified requirements and is free from defects. It is a systematic testing approach that aims to ensure software quality. In the video, QA is mentioned as a team effort to rigorously test software and elicit bugs, which is vital for ensuring the software works as intended for a wide range of users and situations.

Highlights

Sorting algorithms are often a small part of a much larger program, requiring special tools and practices in software engineering.

Microsoft Office has approximately 40 million lines of code, illustrating the scale of large software projects.

Software Engineering as a discipline was coined by Margaret Hamilton, who contributed to NASA's Apollo missions.

Breaking large programs into smaller functions allows for simultaneous work by multiple people.

Microsoft Office likely contains hundreds of thousands of functions, necessitating further organization beyond function packaging.

Functions are organized into hierarchies and related code is grouped into 'objects' for better management.

The concept of an 'object' in software can contain other objects, functions, and variables.

Object Oriented Programming (OOP) is about encapsulating complexity and selectively revealing it through abstraction.

OOP allows for the division of labor in software development, similar to the construction of physical structures.

APIs (Application Programming Interfaces) are crucial for defining how different parts of code interact within a program.

Public and private functions in OOP help manage accessibility and encapsulation within objects.

Integrated Development Environments (IDEs) provide essential tools for writing, organizing, compiling, and testing code.

Documentation is vital for code maintenance and reuse, with comments serving as in-code documentation.

Source Control systems enable collaborative work on large coding projects by managing code versions.

Quality Assurance (QA) testing is a rigorous process to identify and fix bugs before software release.

Beta software is a mostly complete version released to the public for testing, while alpha versions are internal.

The tools and techniques of software engineering are essential for creating complex software like YouTube, Grand Theft Auto 5, and PowerPoint.

Transcripts

play00:03

Hi, I’m Carrie Anne, and welcome to CrashCourse Computer Science!

play00:05

So we’ve talked a lot about sorting in this series and often code to sort a list of numbers

play00:09

might only be ten lines long, which is easy enough for a single programmer to write.

play00:13

Plus, it’s short enough that you don’t need any special tools – you could do it

play00:16

in Notepad.

play00:17

Really!

play00:18

But, a sorting algorithm isn’t a program; it’s likely only a small part of a much

play00:22

larger program.

play00:23

For example, Microsoft Office has roughly 40 millions lines of code.

play00:27

40 MILLION!

play00:28

That’s way too big for any one person to figure out and write!

play00:32

To build huge programs like this, programmers use a set of tools and practices.

play00:36

Taken together, these form the discipline of Software Engineering – a term coined

play00:40

by engineer Margaret Hamilton, who helped NASA prevent serious problems during the Apollo

play00:44

missions to the moon.

play00:45

She once explained it this way: “It’s kind of like a root canal: you waited till

play00:49

the end, [but] there are things you could have done beforehand.

play00:51

It’s like preventative healthcare, but it’s preventative software.”

play00:55

INTRO

play01:04

As I mentioned in episode 12, breaking big programs into smaller functions allows many

play01:08

people to work simultaneously.

play01:10

They don’t have to worry about the whole thing, just the function they’re working on.

play01:14

So, if you’re tasked with writing a sort algorithm, you only need to make sure it sorts

play01:18

properly and efficiently.

play01:19

However, even packing code up into functions isn’t enough.

play01:22

Microsoft Office probably contains hundreds of thousands of them.

play01:25

That’s better than dealing with 40 million lines of code, but it’s still way too many

play01:29

“things” for one person or team to manage.

play01:31

The solution is to package functions into hierarchies, pulling related code together

play01:35

into “objects”.

play01:36

For example, car’s software might have several functions related to cruise control, like

play01:40

setting speed, nudging speed up or down, and stopping cruise control altogether.

play01:44

Since they’re all related, we can wrap them up into a unified cruise control object.

play01:48

But, we don’t have to stop there, cruise control is just one part of the engine’s

play01:52

software.

play01:53

There might also be sets of functions that control spark plug ignition, fuel pumps, and

play01:56

the radiator.

play01:58

So we can create a “parent” Engine Object that contains all of these “children”

play02:01

objects.

play02:02

In addition to children *objects*, the engine itself might have its *own* functions.

play02:05

You want to be able to stop and start it, for example.

play02:08

It’ll also have its own variables, like how many miles the car has traveled.

play02:12

In general, objects can contain other objects, functions and variables.

play02:15

And of course, the engine is just one part of a Car Object.

play02:18

There’s also the transmission, wheels, doors, windows, and so on.

play02:21

Now, as a programmer, if I want to set the cruise control, I navigate down the object

play02:25

hierarchy, from the outermost objects to more and more deeply nested ones.

play02:29

Eventually, I reach the function I want to trigger: “Car, then engine, then cruise

play02:33

control, then set cruise speed to 55”.

play02:36

Programming languages often use something equivalent to the syntax shown here.

play02:39

The idea of packing up functional units into nested objects is called Object Oriented Programming.

play02:44

This is very similar to what we’ve done all series long: hide complexity by encapsulating

play02:49

low-level details in higher-order components.

play02:52

Before we packed up things like transistor circuits into higher-level boolean gates.

play02:56

Now we’re doing the same thing with software.

play02:57

Yet again, it’s a way to move up a new level of abstraction!

play03:07

Breaking up a big program, like a car’s software, into functional units is perfect

play03:11

for teams.

play03:12

One team might be responsible for the cruise control system, and a single programmer on

play03:16

that team tackles a handful of functions.

play03:19

This is similar to how big, physical things are built, like skyscrapers.

play03:22

You’ll have electricians running wires, plumbers fitting pipes, welders welding, painters

play03:26

painting, and hundreds of other people teeming all over the hull.

play03:29

They work together on different parts simultaneously, leveraging their different skills.

play03:34

Until one day, you’ve got a whole working building!

play03:36

But, returning to our cruise control example… its code is going to have to make use of functions

play03:41

in other parts of the engine’s software, to, you know, keep the car at a constant speed.

play03:45

That code isn’t part of the cruise control team’s responsibility.

play03:48

It’s another team’s code.

play03:49

Because the cruise control team didn’t write that, they’re going to need good documentation

play03:53

about what each function in the code does, and a well-defined Application Programming

play03:57

Interface -- or API for short.

play03:59

You can think of an API as the way that collaborating programmers interact across various parts

play04:04

of the code.

play04:04

For example, in the IgnitionControl object, there might be functions to set the RPM of

play04:08

the engine, check the spark plug voltage, as well as fire the individual spark plugs.

play04:12

Being able to set the motor’s RPM is really useful, the cruise control team is going to

play04:17

need to call that function.

play04:18

But, they don’t know much about how the ignition system works.

play04:21

It’s not a good idea to let them call functions that fire the individual spark plugs.

play04:25

Or the engine might explode!

play04:26

Maybe.

play04:27

The API allows the right people access to the right functions and data.

play04:31

Object Oriented Programming languages do this by letting you specify whether functions are

play04:34

public or private.

play04:36

If a function is marked as “private”, it means only functions inside that object

play04:40

can call it.

play04:41

So, in this example, only other functions inside of IgnitionControl, like the setRPM

play04:45

function, can fire the sparkplugs.

play04:47

On the other hand, because the setRPM function is marked as public, other objects can call

play04:52

it, like cruise control.

play04:54

This ability to hide complexity, and selectively reveal it, is the essence of Object Oriented

play04:58

Programming, and it’s a powerful and popular way to tackle building large and complex programs.

play05:03

Pretty much every piece of software on your computer, or game running on your console,

play05:07

was built using an Object Oriented Programming Language, like C++, C# or Objective-C. Other

play05:12

popular “OO” languages you may have heard of are Python and Java.

play05:15

It’s important to remember that code, before being compiled, is just text.

play05:19

As I mentioned earlier, you could write code in Notepad or any old word processor.

play05:23

Some people do.

play05:24

But generally, today’s software developers use special-purpose applications for writing

play05:28

programs, ones that integrate many useful tools for writing, organizing, compiling and

play05:33

testing code.

play05:34

Because they put everything you need in one place, they’re called Integrated Development

play05:38

Environments, or IDEs for short.

play05:39

All IDEs provide a text editor for writing code, often with useful features like automatic

play05:44

color-coding to improve readability.

play05:46

Many even check for syntax errors as you type, like spell check for code.

play05:50

Big programs contain lots of individual source files, so IDEs allow programmers to organize

play05:54

and efficiently navigate everything.

play05:56

Also built right into the IDE is the ability to compile and run code.

play06:00

And if your program crashes, because it’s still a work in progress, the IDE can take

play06:04

you back to the line of code where it happened, and often provide additional information to

play06:08

help you track down and fix the bug, which is a process called debugging.

play06:11

This is important because most programmers spend 70 to 80% of their time testing and

play06:16

debugging, not writing new code.

play06:18

Good tools, contained in IDEs, can go a long way when it comes to helping programmers prevent

play06:22

and find errors.

play06:23

Many computer programmers can be pretty loyal to their IDEs though - but let’s be honest.

play06:27

VIM is where it’s at.

play06:29

Providing you know how to quit.

play06:30

In addition to coding and debugging, another important part of a programmer's job is documenting

play06:34

their code.

play06:35

This can be done in standalone files called “read-me’s” which tell other programmers

play06:38

to read that help file before diving in.

play06:40

It can also happen right in the code itself with comments.

play06:43

These are specially-marked statements that the program knows to ignore when the code

play06:46

is compiled.

play06:47

They exist only to help programmers figure out what’s what in the source code.

play06:51

Good documentation helps programmers when they revisit code they haven’t seen for

play06:54

awhile, but it’s also crucial for programmers who are totally new to it.

play06:57

I just want to take a second here and reiterate that it’s THE WORST when someone parachutes

play07:02

a load of uncommented and undocumented code into your lap, and you literally have to go

play07:06

line by line to understand what the code is doing.

play07:08

Seriously.

play07:09

Don’t be that person.

play07:10

Documentation also promotes code reuse.

play07:13

So, instead of having programmers constantly write the same things over and over, they

play07:16

can track down someone else’s code that does what they need.

play07:19

Then, thanks to documentation, they can put it to work in their program, without ever

play07:23

having to read through the code.

play07:25

“Read the docs” as they say.

play07:26

In addition to IDEs, another important piece of software that helps big teams work collaboratively

play07:30

on big coding projects is called Source Control, also known as version control or revision control.

play07:36

Most often, at a big software company like Apple or Microsoft, code for projects is stored

play07:40

on centralized servers, called a code repository.

play07:43

When a programmer wants to work on a piece of code, they can check it out, sort of like

play07:47

checking out a book out from a library.

play07:48

Often, this can be done right in an IDE.

play07:51

Then, they can edit this code all they want on their personal computer, adding new features

play07:55

and testing if they work.

play07:56

When the programmer is confident their changes are working and there are no loose ends, they

play08:00

can check the code back into the repository, known as committing code, for everyone else

play08:04

to use.

play08:05

While a piece of code is checked out, and presumably getting updated or modified, other

play08:09

programmers leave it alone.

play08:10

This prevents weird conflicts and duplicated work.

play08:12

In this way, hundreds of programmers can be simultaneously checking in and out pieces

play08:17

of code, iteratively building up huge systems.

play08:19

Critically, you don’t want someone committing buggy code, because other people and teams

play08:23

may rely on it.

play08:25

Their code could crash, creating confusion and lost time.

play08:27

The master version of the code, stored on the server, should always compile without

play08:31

errors and run with minimal bugs.

play08:33

But sometimes bugs creep in.

play08:34

Fortunately, source control software keeps track of all changes, and if a bug is found,

play08:38

the whole code, or just a piece, can be rolled back to an earlier, stable version.

play08:42

It also keeps track of who made each change, so coworkers can send nasty, I mean, helpful

play08:47

and encouraging emails to the offending person.

play08:50

Debugging goes hand in hand with writing code, and it’s most often done by an individual

play08:54

or small team.

play08:55

The big picture version of debugging is Quality Assurance testing, or QA.

play08:59

This is where a team rigorously tests out a piece of software, attempting to create

play09:02

unforeseen conditions that might trip it up.

play09:04

Basically, they elicit bugs.

play09:06

Getting all the wrinkles out is a huge effort, but vital in making sure the software works

play09:10

as intended for as many users in as many situations as imaginable before it ships.

play09:15

You’ve probably heard of beta software This is a version of software that’s mostly complete,

play09:19

but not 100% fully tested.

play09:21

Companies will sometimes release beta versions to the public to help them identify issues,

play09:25

it’s essentially like getting a free QA team.

play09:28

What you don’t hear about as much is the version that comes before the beta: the alpha version.

play09:33

This is usually so rough and buggy, it’s only tested internally.

play09:36

So, that’s the tip of the iceberg in terms of the tools, tricks and techniques that allow

play09:39

software engineers to construct the huge pieces of software that we know and love today, like

play09:44

YouTube, Grand Theft Auto 5, and Powerpoint.

play09:47

As you might expect, all those millions of lines of code needs some serious processing

play09:50

power to run at useful speeds, so next episode we’ll be talking about how computers got so incredibly fast.

play09:56

See you then.

Rate This

5.0 / 5 (0 votes)

الوسوم ذات الصلة
Software EngineeringObject-OrientedProgramming ConceptsCode HierarchyAPIsIDEsSource ControlDebuggingDocumentationQA TestingNASA Apollo
هل تحتاج إلى تلخيص باللغة الإنجليزية؟