SlideShare uma empresa Scribd logo
1 de 11
Microsoft® Small Basic Debugging Aids Estimated time to complete this lesson: 1 hour
Debugging Aids In this lesson, you will learn about: Using the TextWindow.WriteLine operation to debug your programs.
Debugging  Even a minor bug in a program can defeat the efforts of the programmer! Debugging is a method of detecting and resolving bugs in your computer program. Every programmer develops the skill to detect bugs and debug his or her program. While working on large programs, programmers write debugging support code that is not included in the final program. This is to determine the point where a program fails to run.
TextWindow.WriteLine As a Debugging Helper So how can you debug programs in Small Basic? To debug your program, you can use the TextWindow.WriteLine operation. This operation acts as a debugging helper, and it provides information to help debug your program.
TextWindow.WriteLine As a Debugging Helper In this program, you first display an ellipse on the graphics window. In case your program does not run as expected, you need to debug it!  This is when you can use the TextWindow.WriteLine operation as a debugger. It can help you trace the value of “i” on every iteration of the For…EndFor loop. The value of “i” is displayed in a separate text window, enabling you to easily detect a bug and fix it. Let’s look at an example that uses the TextWindow.WriteLine operation for debugging.
TextWindow.WriteLine As a Debugging Helper Oh! The image you requested is not visible on the graphics window. It’s time to debug your code! Now, let’s use the TextWindow.WriteLine operation in another program and see how it can help you debug the program. In this example, you use the Flickr object to download a photo from www.flickr.com and display it on the graphics window.
TextWindow.WriteLine As a Debugging Helper One of the possibilities could be unavailability of an Internet connection or no access to the website.  To check this possibility, you can use the TextWindow.WriteLine operation for displaying the path of the image from the website. If the Internet connection is working fine, the path of the image will be displayed in the text window. Otherwise, the text window will not display any path. As you can see, the text window is not displaying the path of the image, which means you are not connected to the Internet.
 TextWindow.WriteLine As a Debugging Helper You may not see the contents of the file in the text window because: ,[object Object]
 The file may not be present at the specified source.
 The name of the specified file may be incorrect.Now, let’s write a program to copy a file and display its contents in the text window. Now how do we detect the error? It’s time to debug your code once again… In this example, if the CopyFileoperation is successful, the text window displays the contents of the file.
TextWindow.WriteLine As a Debugging Helper Let’s use the TextWindow.WriteLine operation to detect the error. You can modify your program and use  TextWindow.WriteLine to display the return value of the CopyFile operation in the text window  which will either be SUCCESS or FAILED. So, if your program is unable to run due to the CopyFile operation error, you immediately know about it!

Mais conteúdo relacionado

Mais procurados

Programming language environments
Programming language environmentsProgramming language environments
Programming language environmentsMr McAlpine
 
Step by Step guide for creating first ABAP report in SAP
Step by Step guide for creating first ABAP report in SAPStep by Step guide for creating first ABAP report in SAP
Step by Step guide for creating first ABAP report in SAPnityaabap
 
Android application (how to add a splash screen with timer) tutorial #4
Android application (how to add a splash screen with timer) tutorial #4Android application (how to add a splash screen with timer) tutorial #4
Android application (how to add a splash screen with timer) tutorial #4Yasmine Sherif EL-Adly
 
Creating a Personalized ipad Wallpaper
Creating a Personalized ipad WallpaperCreating a Personalized ipad Wallpaper
Creating a Personalized ipad Wallpaperszanotti
 
Stepshot Intro
Stepshot IntroStepshot Intro
Stepshot IntroStepShot
 
Android application (how to change the background) tutorial #3
Android application (how to change the background) tutorial #3Android application (how to change the background) tutorial #3
Android application (how to change the background) tutorial #3Yasmine Sherif EL-Adly
 
Creating a package_in_abap_navigator
Creating a package_in_abap_navigatorCreating a package_in_abap_navigator
Creating a package_in_abap_navigatornityaabap
 
How To Make A Quikmap
How To Make A QuikmapHow To Make A Quikmap
How To Make A Quikmapsatonner
 
Android application (how to change the icon )tutorial #2
Android application (how to change the icon )tutorial #2Android application (how to change the icon )tutorial #2
Android application (how to change the icon )tutorial #2Yasmine Sherif EL-Adly
 
How to add gadgets
How to add gadgetsHow to add gadgets
How to add gadgetsRuth Aw
 
Amazing photoshop light effect in 10 steps
Amazing photoshop light effect in 10 stepsAmazing photoshop light effect in 10 steps
Amazing photoshop light effect in 10 stepsIrene Situmorang
 
Android hello world application tutorial #1
Android hello world application tutorial #1Android hello world application tutorial #1
Android hello world application tutorial #1Yasmine Sherif EL-Adly
 
Images & Dreamweaver
Images & DreamweaverImages & Dreamweaver
Images & DreamweaverjbellWCT
 

Mais procurados (16)

Moreno Xec
Moreno XecMoreno Xec
Moreno Xec
 
Small basic
Small basicSmall basic
Small basic
 
Programming language environments
Programming language environmentsProgramming language environments
Programming language environments
 
Step by Step guide for creating first ABAP report in SAP
Step by Step guide for creating first ABAP report in SAPStep by Step guide for creating first ABAP report in SAP
Step by Step guide for creating first ABAP report in SAP
 
Android application (how to add a splash screen with timer) tutorial #4
Android application (how to add a splash screen with timer) tutorial #4Android application (how to add a splash screen with timer) tutorial #4
Android application (how to add a splash screen with timer) tutorial #4
 
Creating a Personalized ipad Wallpaper
Creating a Personalized ipad WallpaperCreating a Personalized ipad Wallpaper
Creating a Personalized ipad Wallpaper
 
Stepshot Intro
Stepshot IntroStepshot Intro
Stepshot Intro
 
Android application (how to change the background) tutorial #3
Android application (how to change the background) tutorial #3Android application (how to change the background) tutorial #3
Android application (how to change the background) tutorial #3
 
Creating a package_in_abap_navigator
Creating a package_in_abap_navigatorCreating a package_in_abap_navigator
Creating a package_in_abap_navigator
 
How To Make A Quikmap
How To Make A QuikmapHow To Make A Quikmap
How To Make A Quikmap
 
Android application (how to change the icon )tutorial #2
Android application (how to change the icon )tutorial #2Android application (how to change the icon )tutorial #2
Android application (how to change the icon )tutorial #2
 
How to add gadgets
How to add gadgetsHow to add gadgets
How to add gadgets
 
812 wordpress tablet
812 wordpress tablet812 wordpress tablet
812 wordpress tablet
 
Amazing photoshop light effect in 10 steps
Amazing photoshop light effect in 10 stepsAmazing photoshop light effect in 10 steps
Amazing photoshop light effect in 10 steps
 
Android hello world application tutorial #1
Android hello world application tutorial #1Android hello world application tutorial #1
Android hello world application tutorial #1
 
Images & Dreamweaver
Images & DreamweaverImages & Dreamweaver
Images & Dreamweaver
 

Destaque

3.3 the math object
3.3   the math object3.3   the math object
3.3 the math objectallenbailey
 
4.2 responding to events
4.2   responding to events4.2   responding to events
4.2 responding to eventsallenbailey
 
4.1 playing with shapes
4.1   playing with shapes4.1   playing with shapes
4.1 playing with shapesallenbailey
 
3.2 stacks and arrays
3.2   stacks and arrays3.2   stacks and arrays
3.2 stacks and arraysallenbailey
 
4.4 advanced games
4.4   advanced games4.4   advanced games
4.4 advanced gamesallenbailey
 

Destaque (6)

3.3 the math object
3.3   the math object3.3   the math object
3.3 the math object
 
4.2 responding to events
4.2   responding to events4.2   responding to events
4.2 responding to events
 
4.1 playing with shapes
4.1   playing with shapes4.1   playing with shapes
4.1 playing with shapes
 
3.2 stacks and arrays
3.2   stacks and arrays3.2   stacks and arrays
3.2 stacks and arrays
 
4.4 advanced games
4.4   advanced games4.4   advanced games
4.4 advanced games
 
Mlp_winter-2015
Mlp_winter-2015Mlp_winter-2015
Mlp_winter-2015
 

Semelhante a 3.6 debugging aids

Introducing small basic
Introducing small basicIntroducing small basic
Introducing small basicAn I
 
Introducing small basic
Introducing small basicIntroducing small basic
Introducing small basicSara Samol
 
Progressive Web Application by Citytech
Progressive Web Application by CitytechProgressive Web Application by Citytech
Progressive Web Application by CitytechRitwik Das
 
Programming Without Coding Technology (PWCT) Features - Framework & Extension
Programming Without Coding Technology (PWCT) Features - Framework & ExtensionProgramming Without Coding Technology (PWCT) Features - Framework & Extension
Programming Without Coding Technology (PWCT) Features - Framework & ExtensionMahmoud Samir Fayed
 
4007655 introduction-to-javascript
4007655 introduction-to-javascript4007655 introduction-to-javascript
4007655 introduction-to-javascriptVikash Chandra
 
Introducing small basic
Introducing small basicIntroducing small basic
Introducing small basicsom_nangia
 
VISUAL_BASIC_LECTURE_NOTE_A_Z_MADE_EASY.pdf
VISUAL_BASIC_LECTURE_NOTE_A_Z_MADE_EASY.pdfVISUAL_BASIC_LECTURE_NOTE_A_Z_MADE_EASY.pdf
VISUAL_BASIC_LECTURE_NOTE_A_Z_MADE_EASY.pdfNALANDACSCCENTRE
 
Explaindio is a versatile tool for creating animated videos
Explaindio is a versatile tool for creating animated videosExplaindio is a versatile tool for creating animated videos
Explaindio is a versatile tool for creating animated videosFoyezAhmed10
 
MVC for Desktop Application - Part 1
MVC for Desktop Application - Part 1MVC for Desktop Application - Part 1
MVC for Desktop Application - Part 1晟 沈
 
Pixlr and small apps in the classroom
Pixlr and small apps in the classroomPixlr and small apps in the classroom
Pixlr and small apps in the classroomArtfulArtsyAmy
 
LabsLab8.htmlLab 8 Im Thinking of a NumberBefore yo.docx
LabsLab8.htmlLab 8 Im Thinking of a NumberBefore yo.docxLabsLab8.htmlLab 8 Im Thinking of a NumberBefore yo.docx
LabsLab8.htmlLab 8 Im Thinking of a NumberBefore yo.docxDIPESH30
 
Developers Border Line: Unit Testing
Developers Border Line: Unit TestingDevelopers Border Line: Unit Testing
Developers Border Line: Unit TestingSikandar Ahmed
 
Membangun Desktop App
Membangun Desktop AppMembangun Desktop App
Membangun Desktop AppFajar Baskoro
 
Copycat Site BluePrint - make money online fast
Copycat Site BluePrint - make money online fastCopycat Site BluePrint - make money online fast
Copycat Site BluePrint - make money online fastEdward806784
 

Semelhante a 3.6 debugging aids (20)

Java script hello world
Java script hello worldJava script hello world
Java script hello world
 
Introducing small basic
Introducing small basicIntroducing small basic
Introducing small basic
 
Introducing small basic
Introducing small basicIntroducing small basic
Introducing small basic
 
Introducing Small Basic.pdf
Introducing Small Basic.pdfIntroducing Small Basic.pdf
Introducing Small Basic.pdf
 
Progressive Web Application by Citytech
Progressive Web Application by CitytechProgressive Web Application by Citytech
Progressive Web Application by Citytech
 
Programming Without Coding Technology (PWCT) Features - Framework & Extension
Programming Without Coding Technology (PWCT) Features - Framework & ExtensionProgramming Without Coding Technology (PWCT) Features - Framework & Extension
Programming Without Coding Technology (PWCT) Features - Framework & Extension
 
4007655 introduction-to-javascript
4007655 introduction-to-javascript4007655 introduction-to-javascript
4007655 introduction-to-javascript
 
Introducing small basic
Introducing small basicIntroducing small basic
Introducing small basic
 
VISUAL_BASIC_LECTURE_NOTE_A_Z_MADE_EASY.pdf
VISUAL_BASIC_LECTURE_NOTE_A_Z_MADE_EASY.pdfVISUAL_BASIC_LECTURE_NOTE_A_Z_MADE_EASY.pdf
VISUAL_BASIC_LECTURE_NOTE_A_Z_MADE_EASY.pdf
 
Explaindio is a versatile tool for creating animated videos
Explaindio is a versatile tool for creating animated videosExplaindio is a versatile tool for creating animated videos
Explaindio is a versatile tool for creating animated videos
 
MVC for Desktop Application - Part 1
MVC for Desktop Application - Part 1MVC for Desktop Application - Part 1
MVC for Desktop Application - Part 1
 
Part1
Part1Part1
Part1
 
Slide 01
Slide 01Slide 01
Slide 01
 
Pixlr and small apps in the classroom
Pixlr and small apps in the classroomPixlr and small apps in the classroom
Pixlr and small apps in the classroom
 
LabsLab8.htmlLab 8 Im Thinking of a NumberBefore yo.docx
LabsLab8.htmlLab 8 Im Thinking of a NumberBefore yo.docxLabsLab8.htmlLab 8 Im Thinking of a NumberBefore yo.docx
LabsLab8.htmlLab 8 Im Thinking of a NumberBefore yo.docx
 
Developers Border Line: Unit Testing
Developers Border Line: Unit TestingDevelopers Border Line: Unit Testing
Developers Border Line: Unit Testing
 
Question 4 evaluation
Question 4  evaluationQuestion 4  evaluation
Question 4 evaluation
 
django
djangodjango
django
 
Membangun Desktop App
Membangun Desktop AppMembangun Desktop App
Membangun Desktop App
 
Copycat Site BluePrint - make money online fast
Copycat Site BluePrint - make money online fastCopycat Site BluePrint - make money online fast
Copycat Site BluePrint - make money online fast
 

Mais de allenbailey

4.3 collision detection
4.3   collision detection4.3   collision detection
4.3 collision detectionallenbailey
 
3.5 the controls object
3.5   the controls object3.5   the controls object
3.5 the controls objectallenbailey
 
2.6 flickr, image list, and network objects
2.6   flickr, image list, and network objects2.6   flickr, image list, and network objects
2.6 flickr, image list, and network objectsallenbailey
 
2.5 clock, desktop, and dictionary objects
2.5   clock, desktop, and dictionary objects2.5   clock, desktop, and dictionary objects
2.5 clock, desktop, and dictionary objectsallenbailey
 
2.3 exploring shapes
2.3   exploring shapes2.3   exploring shapes
2.3 exploring shapesallenbailey
 
2.2 turtle graphics
2.2   turtle graphics2.2   turtle graphics
2.2 turtle graphicsallenbailey
 
2.1 graphics window
2.1   graphics window2.1   graphics window
2.1 graphics windowallenbailey
 

Mais de allenbailey (8)

4.3 collision detection
4.3   collision detection4.3   collision detection
4.3 collision detection
 
3.5 the controls object
3.5   the controls object3.5   the controls object
3.5 the controls object
 
2.6 flickr, image list, and network objects
2.6   flickr, image list, and network objects2.6   flickr, image list, and network objects
2.6 flickr, image list, and network objects
 
2.5 clock, desktop, and dictionary objects
2.5   clock, desktop, and dictionary objects2.5   clock, desktop, and dictionary objects
2.5 clock, desktop, and dictionary objects
 
2.3 exploring shapes
2.3   exploring shapes2.3   exploring shapes
2.3 exploring shapes
 
2.2 turtle graphics
2.2   turtle graphics2.2   turtle graphics
2.2 turtle graphics
 
2.1 graphics window
2.1   graphics window2.1   graphics window
2.1 graphics window
 
1.3 variables
1.3   variables1.3   variables
1.3 variables
 

Último

What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 

Último (20)

What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 

3.6 debugging aids

  • 1. Microsoft® Small Basic Debugging Aids Estimated time to complete this lesson: 1 hour
  • 2. Debugging Aids In this lesson, you will learn about: Using the TextWindow.WriteLine operation to debug your programs.
  • 3. Debugging Even a minor bug in a program can defeat the efforts of the programmer! Debugging is a method of detecting and resolving bugs in your computer program. Every programmer develops the skill to detect bugs and debug his or her program. While working on large programs, programmers write debugging support code that is not included in the final program. This is to determine the point where a program fails to run.
  • 4. TextWindow.WriteLine As a Debugging Helper So how can you debug programs in Small Basic? To debug your program, you can use the TextWindow.WriteLine operation. This operation acts as a debugging helper, and it provides information to help debug your program.
  • 5. TextWindow.WriteLine As a Debugging Helper In this program, you first display an ellipse on the graphics window. In case your program does not run as expected, you need to debug it! This is when you can use the TextWindow.WriteLine operation as a debugger. It can help you trace the value of “i” on every iteration of the For…EndFor loop. The value of “i” is displayed in a separate text window, enabling you to easily detect a bug and fix it. Let’s look at an example that uses the TextWindow.WriteLine operation for debugging.
  • 6. TextWindow.WriteLine As a Debugging Helper Oh! The image you requested is not visible on the graphics window. It’s time to debug your code! Now, let’s use the TextWindow.WriteLine operation in another program and see how it can help you debug the program. In this example, you use the Flickr object to download a photo from www.flickr.com and display it on the graphics window.
  • 7. TextWindow.WriteLine As a Debugging Helper One of the possibilities could be unavailability of an Internet connection or no access to the website. To check this possibility, you can use the TextWindow.WriteLine operation for displaying the path of the image from the website. If the Internet connection is working fine, the path of the image will be displayed in the text window. Otherwise, the text window will not display any path. As you can see, the text window is not displaying the path of the image, which means you are not connected to the Internet.
  • 8.
  • 9. The file may not be present at the specified source.
  • 10. The name of the specified file may be incorrect.Now, let’s write a program to copy a file and display its contents in the text window. Now how do we detect the error? It’s time to debug your code once again… In this example, if the CopyFileoperation is successful, the text window displays the contents of the file.
  • 11. TextWindow.WriteLine As a Debugging Helper Let’s use the TextWindow.WriteLine operation to detect the error. You can modify your program and use TextWindow.WriteLine to display the return value of the CopyFile operation in the text window  which will either be SUCCESS or FAILED. So, if your program is unable to run due to the CopyFile operation error, you immediately know about it!
  • 12. Let’s Summarize… Congratulations! Now you know how to: Use the TextWindow.WriteLine operation to debug programs.
  • 13. It’s Time to Apply Your Learning… A program creates a slide show of images in the graphics window. All these images are stored in a local folder. With every mouse click, a new image is displayed in the graphics window. Use the TextWindow.WriteLine operation as a debugging helper by displaying the path of each image in the text window.

Notas do Editor

  1.  Slide Notes:In this program, you first display an ellipse on the graphics window. Next, you use the SetOpacity operation of the Shapes object to set the opacity level of the ellipse. You place this code within a For…EndFor loop, to change the opacity with every single iteration. Similarly, you set the zoom level of the ellipse within the same loop.  In case your program does not run as expected, you need to debug it! This is when you can use the TextWindow.WriteLine operation as a debugger.  The TextWindow.WriteLine operation can help you trace the value of “i” on every iteration of the For…EndFor loop. The value of “i” gets displayed in a separate text window, enabling you to easily detect the bug and fix it.Code:GraphicsWindow.Height = 400GraphicsWindow.Width = 600Ellipse = Shapes.AddEllipse(200,200)Shapes.Move(Ellipse,200,100)For i = 1 To 5Program.Delay(1000)Shapes.SetOpacity(Ellipse,5*i) Shapes.Zoom(Ellipse,i * 0.4,i * 0.4) TextWindow.WriteLine("Value of i at this moment is " + i) EndFor 
  2. Code:Sourcepath = Program.Directory+"Sourcedata.txt"Destpath = Program.Directory+"dest"file.CopyFile(Sourcepath,Destpath)TextWindow.WriteLine(File.ReadContents(File.ReadContents(destPath+"data.txt")))
  3. Code:Sourcepath = Program.Directory+"Sourcedata.txt"Destpath = Program.Directory+"dest"TextWindow.WriteLine(file.CopyFile(Sourcepath,Destpath))TextWindow.WriteLine(File.ReadContents(File.ReadContents(destPath+"data.txt")))
  4. Solution:Please Note: Ensure that a folder containing the images exists at the path specified in the program.ImagePath = program.Directory + "img" i = 1GraphicsWindow.Width = 600GraphicsWindow.Height = 450GraphicsWindow.Top = (Desktop.Height-450) / 2GraphicsWindow.left = (Desktop.Width-600) / 2 GUI()SmallBasicImage = File.GetFiles(ImagePath) GraphicsWindow.DrawResizedImage(SmallBasicImage[i], 50, 50, 500, 300) Controls.ButtonClicked = SlideShowSub GUI GraphicsWindow.BackgroundColor="LightSlateGray" GraphicsWindow.FontSize=25 nxtBtn = Controls.AddButton("<",50,370) bckBtn = Controls.AddButton(">",500,370) Controls.SetSize(nxtBtn, 50, 50)Controls.SetSize(bckBtn, 50, 50) EndSubSubSlideShowIfControls.GetButtonCaption(Controls.LastClickedButton) = ">" ThenIfi < Array.GetItemCount(SmallBasicImage) Theni = i + 1 images[i] = ImageList.LoadImage(SmallBasicImage[i]) GraphicsWindow.DrawResizedImage(images[i], 50, 50, 500, 300) TextWindow.WriteLine("Image Name:" + SmallBasicImage[i]) EndIfEndIfIfControls.GetButtonCaption(Controls.LastClickedButton) = "<" ThenIfi > 1 Theni = i - 1 images[i] = ImageList.LoadImage(SmallBasicImage[i]) GraphicsWindow.DrawResizedImage(images[i], 50, 50, 500, 300) TextWindow.WriteLine("Image Name:" + SmallBasicImage[i]) EndIfEndIfEndSub