Business logic with JS RRS feed

  • General discussion

  • I have a feeling that Microsoft wants developers to use HTML5/CSS/JS more and more.
    For user interface this is perhaps the right way to go for obvious reasons at least for web apps,
    but I have a feeling that Microsoft wants developers to use JS more and more also for business logic, ref. e.g. the TypeScript initiative.

    What are others opinions ?
    Do "we" have to learn how to write applications business Logic using JavaScript, Typescript or other similar (ECMA 6?) ?
    Will we be able to write business logic in e.g. C# in the future ? (also locally on the PC, mobile Device etc.) ?
    Perhaps I just misunderstand the trends.

    Will JavaScript ever be a good language for applications (except for UX With HTML/CSS) ?
    I think I can glimpse a dim chaos in my crystal ball...

    Saturday, October 6, 2012 11:35 AM

All replies

  • Yes, you can, in fact many companies are already doing this. Node.js is a language for writing server side applications (including business logic) that has been around for a few years. Microsoft is a fan of Node.js, as things like TypeScript show.
    Saturday, October 6, 2012 8:47 PM
  • Thanks for Your answer

    I am not really sure which question you answered though :) (but my questions were not reallly clear either).

    Is your opinion that JS (script#, actionscript, TypeScript or whatever) is a good Language for business Logic ?

    Someone have opinions if this will kill or weaken e.g. C#, .net etc. in the long run ?
    (which is the reason why I asked the question if we must learn JS or supersets)

    I know so little about JS because the tiny web apps I made was by using Silverlight, which seems to be abondoned.
    For desktop apps I mostly used WPF (winforms long time ago), which seems to be abondoned.
    Modern UI (is this the correct name now ?) enables xaml which is similar to Silverlight, so the question remains if Microsoft want us to use HTML/JS/CSS more and more so that xaml/C# for Metro may also be abandoned and will this eventually disable C#/.net etc. also for backend ?

    EDIT Additional:
    What about performance if js is used for backend serverside Logic, e.g. Node.js compared to e.g. java, .net or even C++ or Delphi etc. ?
    • Edited by EuroEager Sunday, October 7, 2012 12:24 PM
    Sunday, October 7, 2012 6:47 AM
  • Microsoft wants people to write apps, plain and simple. The HTML/JavaScript option is intended to bring in developers from the web side of things and allow them to leverage their skills to write Win8 apps. After developing in HTML/JavaScript for a few months (and I have a heavy web background for over 10 years), I don't think it's quite that simple. But you certainly could probably get up to speed with that faster than with XAML if you've never done WPF or Silverlight programming.

    Obviously there is a drive to make it easier to use JavaScript for business logic (better tooling, debugging, ability to consume WinRT components, TypeScript, etc.).  But I still find it unwieldy to write heavy business logic compared to .NET. That's just me.  The architecture my company has been using (although it's still early) is HTML/JavaScript for the UI layer and C# WinRT for the heavy lifting. We just find that way easier to manage.  Your mileage may vary, depending on your skills and the needs of your app.

    By the way, C# is certainly not going anywhere anytime soon, it's still needed for web apps, web services (WCF/WebApi), Windows services, etc.  Silverlight on the other hand does seem to be a non-starter at this point, particularly for new application development.

    Monday, October 8, 2012 12:44 PM
  • Thanks

    Yes, I think I can agree upon all of this, particularly that we should not necessarly write business logic by JavaScript (or supersets etc.) just because it is possible, at least I hope that C# and WinRT or .net will have its place in the backend.

    I can also understand why using html5/css/js for UX is a good thing for porting between web (browser) and desktop (WinRT).
    However, html5/css/js in WinRT has a heavy dependency to WinRT and cannot easily be ported to web I think, correct ?

    By the way: My understanding is that javascript was created mainly for DOM manipualtion (hence browser UX), is that correct ?

    Monday, October 8, 2012 12:55 PM
  • I don't think the idea is really portability (between Win8 and web apps).  Like you say, there is a heavy dependency on WinRT and for now the layout seems much different (lots of -ms-grid).  Grid layout will be more supported as browsers fully implement the next W3C spec (whenever that gets finalized), but until then I'm not convinced you can share a whole lot.  To me that is one more reason to write your business/data logic in a separate C# component, although it would be nice if you could expose both WinRT and standard .NET in the same component. Maybe you can, I haven't actually tried it.

    The idea is more making it easier to use/leverage web skills to write Windows apps.

    Monday, October 8, 2012 12:59 PM
  • Yes, as you say, reuse of skill, not portability is probably the right way to see it.

    With "next W3C spec ", I suppose you mean HTML5 ? (Planned to be released as a Recommendation in 2014 I think)

    Monday, October 8, 2012 1:25 PM
  • You can write your business logic now in C# for Windows 8 and have a HTML/CSS/JS UI built on top of it. In your JavaScript app solution, go to add a new project, and under Visual C# / Windows Store, you'll see "Windows Runtime Component". This has been a huge help for me on past projects where the business logic did not lend itself to being written in JavaScript (also useful when WSDLs get involved).

    Wednesday, October 10, 2012 10:43 PM