The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,888 other followers

Archive for the ‘C#’ Category

Not all XSD mappings to programming language constructs are possible

Posted by jpluimers on 2020/02/26

This post is a reminder to myself that not all mappings from XSD to programming languages are possible.

There are many impossible cases, so this is just a general reminder.

A Delphi specific case for instance is the mapping of enumerations: one reason is that XSD enumerations are case sensitive, but the Delphi language is not: [WayBackUsing XML Enumerations with Delphi XML Data Binding Wizard – Stack Overflow.

More generic examples from my answer to the above question:

  • In XSD you can derive from an existing type in two ways: extending it and limiting it. Object Oriented languages only allow you extend when deriving.
  • Delphi is not alone in these kinds of limitations. Generating wrappers from XSD schema’s is the field of specialized tools, even in the Java or .NET world.

I’ve seen horrible things with wildcards that are sort of mappable to Java, but not to C#. This could likely go on for much longer…

–jeroen

Posted in C#, Delphi, Development, Java, Java Platform, Software Development, XML, XML/XSD, XSD | 2 Comments »

Scott Hanselman on Twitter: Learn C# in your browser, no install! Practice your .NET skills on an ChromeBook if you like! Your choice!

Posted by jpluimers on 2020/02/18

This is indeed an interesting live way to learn about C# even if you think you know most of it:

[WayBackScott Hanselman on Twitter: Learn C# in your browser, no install! Practice your .NET skills on an ChromeBook if you like! Your choice!

Here you go:

–jeroen

Read the rest of this entry »

Posted in .NET, C#, Development, Software Development | Leave a Comment »

Delphi developer switching to C# – Stack Overflow

Posted by jpluimers on 2020/01/23

Another blast from the past. I’ve been using many development environment all my live, so I have been using .NET very early on allowing me to make a good comparison: [WayBackDelphi developer switching to C# – Stack Overflow.

I have a broad toolbox because we’ve never lived in a “silver bullet” era: any problem needs a combination of tools to solve them. Having a broad toolset allows you to pick and choose more easily. Mastering the different tools however requires a lot of effort and time. You really need to love this profession to put that energy in it.

I heavily use both for software development.

Development speed of server apps (web apps, web services, windows services) is much higher in .NET.

Development speed of business apps (pure Windows UI) is much higher in Delphi.

Development of sexy apps is a pain in both environments.

A few things you should know:

  • Learning the .NET framework will take a lot of time: it is huge, but contains a lot of gizmos (some gems are really well hidden).
  • Don’t lose yourself in following all new trends at once: generics, lambda, LINQ, each are nice, but grasping them all at once is only for a few of us
  • For web apps, skip WebForms, but learn ASP.NET MVVC (yes, the Ruby guys were right after all); learn HTML 5 and JavaScript too.
  • For sexy Windows apps, learn WPF, but be prepared for a steep learning curve (designer, and framework are radically different)
  • Don’t get a too sexy UI: it costs you a disproportional amount of time while your users are waiting for functionality
  • Like the market has been bashing Delphi since version 1, the market is bashing SilverLight too
  • Skip WinForms; if you need something like WinForms, then Delphi is way more productive (even more so if you have an existing Delphi VCL codebase).
  • WPF is just as thread-friendly as the VCL or WinForms (read: neither of the 3 is thread friendly)
  • Don’t perform rewrites of your Delphi stuff in .NET (or for that matter any other 1:1 rewrite from platform A into platform B): it is a waste of your time.
  • Threading and synchronization are a pain in all development environments. The pain is not so much in the general stuff (the Concurrent Collections in the .NET 4 framework helps, as do the Delphi OmniThreadLibrary), but in getting the final details and exception cases right is the real pain.
  • Garbage collection does not mean that you won’t leak memory: it means that you won’t leak when your app terminates, but while it runs the leaks are way harder to detect (boy, I wish I had the FastMM memory monitor for .NET)

–jeroen

Posted in .NET, C#, Delphi, Development, Software Development | 3 Comments »

Mad With PowerShell: FileInfo and DirectoryInfo objects are not populated upon creation in PowerShell

Posted by jpluimers on 2020/01/16

[WayBack] Mad With PowerShell: FileInfo and DirectoryInfo objects are not populated upon creation in PowerShell.

TL;DR:

  • Apart from the FullName property, the other poprerties of FileInfo and DirectoryInfo are populated later than their instance creation
  • A call to their Refresh method populates or re-populates them
  • That method is implicitly called when you request other properties than FullName

Example: see the [Archive.is]fileinfo.cs: Length property

–jeroen

Posted in .NET, Software Development, Development, C#, CommandLine, PowerShell, VB.NET, F# | Leave a Comment »

If you have a gripe with nested if-then-else statements in any language, then usually it’s time to refactor some code…

Posted by jpluimers on 2019/12/10

Every time I run into complex nested if/then/else statement in any language with truckloads of code blocks, it usually means it is time to refactor in two steps:

  1. the code blocks into separate methods
  2. the decisions and methods into a polymorphic structure

Of course this adds some overhead, but usually you end up with code that is easier to unit-test and understand both the overall structure and detailed implementations of.

I’m all for language enhancements that allow deeply nested logic to be more manageable (for instance by enhancing a case construct), but usually refactoring makes that less of a need and more of a nice to have.

Via: [WayBackAnybody else have a gripe with nested if-then-else statements in Pascal? What if we had the following statement/syntax available in Pascal? … – Gerhard Venter – Google+

–jeroen

Posted in .NET, C#, Design Patterns, Development, Software Development | Leave a Comment »

 
%d bloggers like this: