SlideShare ist ein Scribd-Unternehmen logo
1 von 31
Windows 8 development
                             C# vs. C++
                         practical experience
                                   Daniel Biesiada
                           consultant and solution architect




sobota, 5 stycznia 13
About me




sobota, 5 stycznia 13
About me
        13


sobota, 5 stycznia 13
About me
        13
         7
sobota, 5 stycznia 13
About me
        13
         7
sobota, 5 stycznia 13
About me
        13
         7
sobota, 5 stycznia 13
About me
        13
         7
sobota, 5 stycznia 13
Two apps




sobota, 5 stycznia 13
In common
                        • Windows 8 app targeting touch devices
                        • Relatively simple (in scope ~= 1 month)
                        • B2B model:
                         • I’m just the dev and advisory guy
                         • Product design, management and
                            ownership => customer side


sobota, 5 stycznia 13
Top differences
                        •   Customer types:

                            •   Corporate vs. Startup entity

                        •   Technology:

                            •   C# & Xaml vs. C++, Xaml & DirectX

                        •   Design

                            •   Core „Metro” vs. 95% custom

                            •   In-app business model {free vs. paid}


sobota, 5 stycznia 13
Top differences
                        •   Customer types:

                            •   Corporate vs. Startup entity

                        •   Technology:

                            •   C# & Xaml vs. C++, Xaml & DirectX

                        •   Design

                            •   Core „Metro” vs. 95% custom

                            •   In-app business model {free vs. paid}


sobota, 5 stycznia 13
Team, process &
                                 communication
                        •   Roles and competences
                            •   think carefully about communication inside the team

                            •   especially when customer is part of the team

                        •   Tools:
                            •   for prototyping

                            •   for testing

                            •   for software and design requirements

                        •   „Agile” approach
                            •   short iterations vs. discussion about „imperfect product”

                            •   milestones and again appropriate communication with the customer




sobota, 5 stycznia 13
Design




sobota, 5 stycznia 13
Design




sobota, 5 stycznia 13
Design




sobota, 5 stycznia 13
Design




sobota, 5 stycznia 13
Design
                        •   When porting from Web/IOS:

                            •   New features (non existing on other platforms)

                                •   Snap View

                                •   Search, Share contracts

                            •   Understanding of Metro Design principles

                                •   If only possible everything asynchronous

                                •   (Data = Content) Driven Development

                        •   Expression Blend, tricky yet unavoidable and handy tool
                            for design keen developers.



sobota, 5 stycznia 13
CPP vs. C#
                                       experience
                        •   Easy part:

                            •   Xaml is the same and behaves the same, you can
                                trust it and your skills

                            •   Great async support with PPL Tasks

                                •   still, remember about the Dispatcher

                        •   Challenges:

                            •   WinRT projection to C# != projection to C++

                            •   DirectX mappings, then it’s cool too.

                            •   Understanding of share contract



sobota, 5 stycznia 13
WinRT in C++ from
                               C-sharpers’
                        •   Basic Platform::String example:

                            •   In C++:

                                •   initializer,

                                •   cast to std::wstring

                                •   ::Begin, ::End iterators

                                •   array [] wchar_t indexer

                                •   Concat method & operators

                            •   AND THAT’S ALL WHAT YOU HAVE


sobota, 5 stycznia 13
WinRT in C++ from
                           C-sharpers’
                        •   How to sub divide, search and execute other usual string
                            operations?

                            •   cast to std::wstring and go with STL


                            •   Pros: great interaction with STL

                            •   Cons: stupid question rather: why the heck so basic
                                object is so limited?


                        •   .. and there is more diffs like that, C#‘ers will catch them
                            often



sobota, 5 stycznia 13
PPL Tasks
 	
   if	
  (file	
  !=	
  nullptr)
 	
   {
 	
   	
   Platform::String^	
  m_imageFileName	
  =	
  file-­‐>Name;
 	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  
 	
   	
   task<Streams::IRandomAccessStream^>	
  createStreamTask(
                                  file-­‐>OpenAsync(FileAccessMode::ReadWrite));

                        createStreamTask.then(
                        [=](Streams::IRandomAccessStream^	
  randomAccessStream)	
  {
                        	
   SaveImageToStream(randomAccessStream,	
  saveBackground);
                        });
 	
   }




sobota, 5 stycznia 13
PPL Tasks
	
   loadAndRenderTask.then([=]()
  	
   if	
  (file	
  !=	
  nullptr)
	
   {
  	
   {
	
   	
   Dispatcher-­‐>RunAsync(CoreDispatcherPriority::Normal,
  	
   	
   Platform::String^	
  m_imageFileName	
  =	
  file-­‐>Name;
	
   	
   	
   ref	
  new	
  DispatchedHandler([=]()
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  
	
   	
   	
   {	
   	
   	
   	
   	
   	
   	
   	
   	
  
  	
   	
   task<Streams::IRandomAccessStream^>	
  createStreamTask(
                                 	
   LoadWaitGrid-­‐>Visibility	
  =
                                   file-­‐>OpenAsync(FileAccessMode::ReadWrite));
                                               Windows::UI::Xaml::Visibility::Collapsed;
	
   	
   	
   	
   LoadProgressRing-­‐>IsActive	
  =	
  false;
                                   createStreamTask.then(
                                            SpeedText-­‐>Visibility	
  =	
  
                                   [=](Streams::IRandomAccessStream^	
  randomAccessStream)	
  {
                                               Windows::UI::Xaml::Visibility::Visible;	
  
                                   	
   SaveImageToStream(randomAccessStream,	
  saveBackground);
	
   	
   	
   	
   BackgroundButtonSpeed-­‐>Visibility	
  =	
  
                                   });
  	
   }                                       Windows::UI::Xaml::Visibility::Visible;

                            ...

	
   	
   	
   }	
   	
  
	
   }




sobota, 5 stycznia 13
Dynamic Binding
 	
  
                          and Cache
        Windows::UI::Xaml::Media::Imaging::BitmapImage^	
  bitmapSrc	
  =
 	
     	
   ref	
  new	
  Windows::UI::Xaml::Media::Imaging::BitmapImage();

        bitmapSrc-­‐>CreateOptions	
  =	
  BitmapCreateOptions::IgnoreImageCache;
 	
     bitmapSrc-­‐>UriSource	
  =	
  uri;
 	
     img-­‐>CacheMode	
  =	
  nullptr;
 	
     img-­‐>Source	
  =	
  bitmapSrc;
 	
     LoadListView-­‐>Items-­‐>Append(img);
        ...




sobota, 5 stycznia 13
Dynamic Binding
 	
  
                            and Cache
        Windows::UI::Xaml::Media::Imaging::BitmapImage^	
  bitmapSrc	
  =
 	
     	
   ref	
  new	
  Windows::UI::Xaml::Media::Imaging::BitmapImage();

        bitmapSrc-­‐>CreateOptions	
  =	
  BitmapCreateOptions::IgnoreImageCache;
 	
     bitmapSrc-­‐>UriSource	
  =	
  uri;
 	
     img-­‐>CacheMode	
  =	
  nullptr;
 	
     img-­‐>Source	
  =	
  bitmapSrc;
 	
     LoadListView-­‐>Items-­‐>Append(img);
        ...

 	
     ...
        file-­‐>DeleteAsync();

 	
     auto	
  item	
  =	
  (Image^)LoadListView-­‐>Items-­‐>GetAt(selected);
 	
     auto	
  src	
  =	
  (BitmapImage^)item-­‐>Source;
 	
     src-­‐>UriSource	
  =	
  nullptr;	
  //If	
  you	
  don’t	
  clear	
  it,	
  cache	
  stays
                                      	
  	
  	
  	
  	
  //even	
  if	
  all	
  IgnoreCache,	
  CacheMode	
  properties	
  
                                      	
  	
  	
  	
  	
  //are	
  set	
  well	
  
 	
     LoadListView-­‐>Items-­‐>RemoveAt(selected);
        ...
sobota, 5 stycznia 13
Resource
                              Management
                        • BitmapSource <=> DirectX/WIC
                        • Different Resolutions, DPI and
                          Proportions

                         • Xaml based positioning
                         • Renderer’s rescale capabilities
                         • Res/Snap/DPI Detection
sobota, 5 stycznia 13
Direct 2D paths,
                   nice stuff and bad stuff
                        •   Nice stuff, it handles ink over bezier curves well!


                        •   It lacks of BitmapBrush for Bezier strokes

                            •   BitmapBrush can only fill closed paths

                        •   Sampling on your own:
                                  strokeGeometry-­‐>ComputePointAtLength(	
  ...	
  )


                        •   Blending is kind of tricky:

                            •   ID2D1Image -> D2D1Bitmap tricks for eraser


sobota, 5 stycznia 13
Sharing API
                                    challenges
 	
     RandomAccessStreamReference^	
  imp	
  =	
  nullptr;	
  
 	
     ComPtr<IStream>	
  stream;

 	
     StorageFile^	
  file	
  =	
  SaveToFileForSharing();
 	
     auto	
  p	
  =	
  file-­‐>Path;

 	
     ras	
  =	
  RandomAccessStreamReference::CreateFromFile(file);

 	
     e-­‐>Request-­‐>Data-­‐>Properties-­‐>Title	
  =	
  "Hello	
  from	
  Bord	
  by	
  Pixle";

 	
   //e-­‐>Request-­‐>Data-­‐>SetUri(	
  ...	
  );
 	
   //e-­‐>Request-­‐>Data-­‐>SetText(	
  ...	
  );
 	
   //e-­‐>Request-­‐>Data-­‐>SetUri(	
  ...	
  );
 	
  
 	
   e-­‐>Request-­‐>Data-­‐>SetBitmap(ras);	
  
 	
   e-­‐>Request-­‐>Data-­‐>ResourceMap-­‐>Insert("chalkImage.jpg",	
  ras);	
  
 	
   e-­‐>Request-­‐>Data-­‐>SetHtmlFormat(HtmlFormatHelper::CreateHtmlFormat(L"<p>Look	
  
 what	
  I've	
  drawn	
  with	
  a	
  very	
  cool	
  app	
  called	
  Bord:	
  <img	
  src='chalkImage.jpg'></
 p>"));

sobota, 5 stycznia 13
Sharing API
                                          challenges
                        •   Publisher side has no control:

                            •   it exposes as many formats as possible (crazy tactic)

                            •   and hopes that consumer will interpret it well


                        •   Share JPG through SetBitmap and send it to Mail:

                            •   it converts it to PNG and (100kb JPG => 4.5MB PNG)

                        •   Messages accepts only URL

                            •   if you want to send there Facebook message with picture, you have to publish
                                picture in the cloud first, you cannot upload it from local storage anyhow.
                        •   You expose something in a format

                            •   App „A” interprets it well, app B screwed the thing around in embarassing
                                way. There is no option that you’d like to keep format exposed to „A” and
                                block to „B”




sobota, 5 stycznia 13
Of course there is
                               more


                        • but we have only 30 minutes, so...



sobota, 5 stycznia 13
.. to summarize
                        •   C++ experience is much better than Win32/MFC/whatever old-school
                            Windows development

                        •   Even though WinRT is in C++ (WRL) there is still lot of API
                            inconsequence in projections.

                            •   for Xaml only apps, it’s 1st class citizen if the language is the
                                preference, but you have to be patient to mix Cx/ISO and WinRT/
                                STL routines

                            •   (or wrap it well if project is bigger or you’re the architecture junkie)

                        •   DirectX 11.1 lacks of good documentation - if you lack experience,
                            you’ll have to experiment a lot!

                        •   It integrates great with STL and COM (via WRL)

                        •   It has great async support (PPL)




sobota, 5 stycznia 13
Thank you
                        daniel.biesiada@ushine.pl




sobota, 5 stycznia 13

Weitere ähnliche Inhalte

Kürzlich hochgeladen

2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 

Kürzlich hochgeladen (20)

2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 

Empfohlen

Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 

Empfohlen (20)

Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 

Windows 8 Dev, C# vs. C++ experience in practical projects

  • 1. Windows 8 development C# vs. C++ practical experience Daniel Biesiada consultant and solution architect sobota, 5 stycznia 13
  • 2. About me sobota, 5 stycznia 13
  • 3. About me 13 sobota, 5 stycznia 13
  • 4. About me 13 7 sobota, 5 stycznia 13
  • 5. About me 13 7 sobota, 5 stycznia 13
  • 6. About me 13 7 sobota, 5 stycznia 13
  • 7. About me 13 7 sobota, 5 stycznia 13
  • 8. Two apps sobota, 5 stycznia 13
  • 9. In common • Windows 8 app targeting touch devices • Relatively simple (in scope ~= 1 month) • B2B model: • I’m just the dev and advisory guy • Product design, management and ownership => customer side sobota, 5 stycznia 13
  • 10. Top differences • Customer types: • Corporate vs. Startup entity • Technology: • C# & Xaml vs. C++, Xaml & DirectX • Design • Core „Metro” vs. 95% custom • In-app business model {free vs. paid} sobota, 5 stycznia 13
  • 11. Top differences • Customer types: • Corporate vs. Startup entity • Technology: • C# & Xaml vs. C++, Xaml & DirectX • Design • Core „Metro” vs. 95% custom • In-app business model {free vs. paid} sobota, 5 stycznia 13
  • 12. Team, process & communication • Roles and competences • think carefully about communication inside the team • especially when customer is part of the team • Tools: • for prototyping • for testing • for software and design requirements • „Agile” approach • short iterations vs. discussion about „imperfect product” • milestones and again appropriate communication with the customer sobota, 5 stycznia 13
  • 17. Design • When porting from Web/IOS: • New features (non existing on other platforms) • Snap View • Search, Share contracts • Understanding of Metro Design principles • If only possible everything asynchronous • (Data = Content) Driven Development • Expression Blend, tricky yet unavoidable and handy tool for design keen developers. sobota, 5 stycznia 13
  • 18. CPP vs. C# experience • Easy part: • Xaml is the same and behaves the same, you can trust it and your skills • Great async support with PPL Tasks • still, remember about the Dispatcher • Challenges: • WinRT projection to C# != projection to C++ • DirectX mappings, then it’s cool too. • Understanding of share contract sobota, 5 stycznia 13
  • 19. WinRT in C++ from C-sharpers’ • Basic Platform::String example: • In C++: • initializer, • cast to std::wstring • ::Begin, ::End iterators • array [] wchar_t indexer • Concat method & operators • AND THAT’S ALL WHAT YOU HAVE sobota, 5 stycznia 13
  • 20. WinRT in C++ from C-sharpers’ • How to sub divide, search and execute other usual string operations? • cast to std::wstring and go with STL • Pros: great interaction with STL • Cons: stupid question rather: why the heck so basic object is so limited? • .. and there is more diffs like that, C#‘ers will catch them often sobota, 5 stycznia 13
  • 21. PPL Tasks   if  (file  !=  nullptr)   {     Platform::String^  m_imageFileName  =  file-­‐>Name;                           task<Streams::IRandomAccessStream^>  createStreamTask( file-­‐>OpenAsync(FileAccessMode::ReadWrite)); createStreamTask.then( [=](Streams::IRandomAccessStream^  randomAccessStream)  {   SaveImageToStream(randomAccessStream,  saveBackground); });   } sobota, 5 stycznia 13
  • 22. PPL Tasks   loadAndRenderTask.then([=]()   if  (file  !=  nullptr)   {   {     Dispatcher-­‐>RunAsync(CoreDispatcherPriority::Normal,     Platform::String^  m_imageFileName  =  file-­‐>Name;       ref  new  DispatchedHandler([=]()                             {                       task<Streams::IRandomAccessStream^>  createStreamTask(   LoadWaitGrid-­‐>Visibility  = file-­‐>OpenAsync(FileAccessMode::ReadWrite)); Windows::UI::Xaml::Visibility::Collapsed;         LoadProgressRing-­‐>IsActive  =  false; createStreamTask.then( SpeedText-­‐>Visibility  =   [=](Streams::IRandomAccessStream^  randomAccessStream)  { Windows::UI::Xaml::Visibility::Visible;     SaveImageToStream(randomAccessStream,  saveBackground);         BackgroundButtonSpeed-­‐>Visibility  =   });   } Windows::UI::Xaml::Visibility::Visible; ...       }       } sobota, 5 stycznia 13
  • 23. Dynamic Binding   and Cache Windows::UI::Xaml::Media::Imaging::BitmapImage^  bitmapSrc  =     ref  new  Windows::UI::Xaml::Media::Imaging::BitmapImage(); bitmapSrc-­‐>CreateOptions  =  BitmapCreateOptions::IgnoreImageCache;   bitmapSrc-­‐>UriSource  =  uri;   img-­‐>CacheMode  =  nullptr;   img-­‐>Source  =  bitmapSrc;   LoadListView-­‐>Items-­‐>Append(img); ... sobota, 5 stycznia 13
  • 24. Dynamic Binding   and Cache Windows::UI::Xaml::Media::Imaging::BitmapImage^  bitmapSrc  =     ref  new  Windows::UI::Xaml::Media::Imaging::BitmapImage(); bitmapSrc-­‐>CreateOptions  =  BitmapCreateOptions::IgnoreImageCache;   bitmapSrc-­‐>UriSource  =  uri;   img-­‐>CacheMode  =  nullptr;   img-­‐>Source  =  bitmapSrc;   LoadListView-­‐>Items-­‐>Append(img); ...   ... file-­‐>DeleteAsync();   auto  item  =  (Image^)LoadListView-­‐>Items-­‐>GetAt(selected);   auto  src  =  (BitmapImage^)item-­‐>Source;   src-­‐>UriSource  =  nullptr;  //If  you  don’t  clear  it,  cache  stays          //even  if  all  IgnoreCache,  CacheMode  properties            //are  set  well     LoadListView-­‐>Items-­‐>RemoveAt(selected); ... sobota, 5 stycznia 13
  • 25. Resource Management • BitmapSource <=> DirectX/WIC • Different Resolutions, DPI and Proportions • Xaml based positioning • Renderer’s rescale capabilities • Res/Snap/DPI Detection sobota, 5 stycznia 13
  • 26. Direct 2D paths, nice stuff and bad stuff • Nice stuff, it handles ink over bezier curves well! • It lacks of BitmapBrush for Bezier strokes • BitmapBrush can only fill closed paths • Sampling on your own: strokeGeometry-­‐>ComputePointAtLength(  ...  ) • Blending is kind of tricky: • ID2D1Image -> D2D1Bitmap tricks for eraser sobota, 5 stycznia 13
  • 27. Sharing API challenges   RandomAccessStreamReference^  imp  =  nullptr;     ComPtr<IStream>  stream;   StorageFile^  file  =  SaveToFileForSharing();   auto  p  =  file-­‐>Path;   ras  =  RandomAccessStreamReference::CreateFromFile(file);   e-­‐>Request-­‐>Data-­‐>Properties-­‐>Title  =  "Hello  from  Bord  by  Pixle";   //e-­‐>Request-­‐>Data-­‐>SetUri(  ...  );   //e-­‐>Request-­‐>Data-­‐>SetText(  ...  );   //e-­‐>Request-­‐>Data-­‐>SetUri(  ...  );     e-­‐>Request-­‐>Data-­‐>SetBitmap(ras);     e-­‐>Request-­‐>Data-­‐>ResourceMap-­‐>Insert("chalkImage.jpg",  ras);     e-­‐>Request-­‐>Data-­‐>SetHtmlFormat(HtmlFormatHelper::CreateHtmlFormat(L"<p>Look   what  I've  drawn  with  a  very  cool  app  called  Bord:  <img  src='chalkImage.jpg'></ p>")); sobota, 5 stycznia 13
  • 28. Sharing API challenges • Publisher side has no control: • it exposes as many formats as possible (crazy tactic) • and hopes that consumer will interpret it well • Share JPG through SetBitmap and send it to Mail: • it converts it to PNG and (100kb JPG => 4.5MB PNG) • Messages accepts only URL • if you want to send there Facebook message with picture, you have to publish picture in the cloud first, you cannot upload it from local storage anyhow. • You expose something in a format • App „A” interprets it well, app B screwed the thing around in embarassing way. There is no option that you’d like to keep format exposed to „A” and block to „B” sobota, 5 stycznia 13
  • 29. Of course there is more • but we have only 30 minutes, so... sobota, 5 stycznia 13
  • 30. .. to summarize • C++ experience is much better than Win32/MFC/whatever old-school Windows development • Even though WinRT is in C++ (WRL) there is still lot of API inconsequence in projections. • for Xaml only apps, it’s 1st class citizen if the language is the preference, but you have to be patient to mix Cx/ISO and WinRT/ STL routines • (or wrap it well if project is bigger or you’re the architecture junkie) • DirectX 11.1 lacks of good documentation - if you lack experience, you’ll have to experiment a lot! • It integrates great with STL and COM (via WRL) • It has great async support (PPL) sobota, 5 stycznia 13
  • 31. Thank you daniel.biesiada@ushine.pl sobota, 5 stycznia 13