Тёмный

Building a Large PowerShell Application - Bruce Payette - PSConfEU 2023 

PowerShell Conference EU
Подписаться 5 тыс.
Просмотров 1,2 тыс.
50% 1

In this session, I, Bruce Payette, introduce myself as a founding member of the PowerShell team and the lead architect on the language. I discuss my experience managing a large-scale application written in PowerShell and explain that I wanted to tackle a project of significant scale since the PowerShell team mostly works on small scripts. I define a large application as one with 10,000 lines of code or more and emphasize the importance of maintaining it over time.
I share that I personally wrote a programming language interpreter in PowerShell, consisting of around 12,000 lines of code in one file, and elaborate on my process of building and maintaining the application for the past three years. I mention working on it periodically, debugging, adding tests, and implementing features.
I then provide examples of the functionality of the programming language interpreter, showcasing its ability to perform math operations, work with modules, create functions, and interact with PowerShell's functionality. I demonstrate various commands and features, such as manipulating collections, executing PowerShell commands, and implementing a factorial function. Additionally, I mention the tools I built for unit testing and generating documentation using the programming language interpreter.
Moving on, I delve into some challenges in building a large application using PowerShell. I discuss source code organization and how maintaining a large amount of source code becomes difficult. I explore options like dot sourcing and concatenating files, but mention their limitations. I also discuss namespace management and recommend using classes as a better solution to organize data with attached code. I express satisfaction with the use of classes in PowerShell, designed by Jason Shirk.
The conversation touches on documentation conventions, the advantage of using namespaces, and specific code snippets related to debugging and regex usage. We discuss the importance of managing error channels and information, and I mention having a common error handling function. I explain that every expression in the language derives from a base class and must implement the eval function. We also discuss support for patterns, including expandable strings and regular expression literals.
We briefly touch upon best practices, the challenge of cardinality in writing reliable PowerShell programs, and the performance of PowerShell function invocation. We suggest using static methods in classes to mitigate some of the issues with functions.
Shifting towards code performance, I compare the time it takes to run a function and a static method, finding that the static method is about three times faster. I stress the importance of checking for functions as they can be performance hotspots, and mention that replacing functions with static classes can significantly improve script performance. I also discuss the tests I wrote for the code, opting for a smaller DSL for embedded tests instead of Pester.
Regarding documentation, I mention the current use of an HTML style DSL but consider switching to generating markdown. In summary, I highlight that the Tiny language has been stable for the past three years and can be used to build large PowerShell applications. I address misconceptions about PowerShell's suitability for large applications and express my goal of proving otherwise.
I acknowledge that packaging is still a challenge and mention an abandoned attempt at improving PowerShell for application mode. I inform the listeners that all the code and presentation materials are available on GitHub. Finally, I welcome questions from the audience and address a query about version management challenges with the single file model, admitting that it is indeed a problem without a great solution at the moment.
I conclude by expressing gratitude to the audience and wishing them a pleasant conference experience.

Опубликовано:

 

15 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии    
Далее
БЕРЕМЕННАЯ БЕЛКА ЗЛИТСЯ#cat
00:11
Просмотров 341 тыс.
How to Think like a Programmer
1:45:15
Просмотров 256
Stop using Zapier, Make, n8n
25:33
Просмотров 21 тыс.
21 HORRIFIC Tech Fails they want you to forget.
26:19
101 Weird But Useful Minecraft Hacks
48:36
Просмотров 4,5 млн
10 BIGGEST CATCHES OF ALL TIME
10:43
Просмотров 14 млн
Inside One Of The BIGGEST Cruise Ships In The World
47:08
This Tiny House Is A Design Masterclass!
18:49
Просмотров 1,2 млн
БЕРЕМЕННАЯ БЕЛКА ЗЛИТСЯ#cat
00:11
Просмотров 341 тыс.