{"id":277,"date":"2011-06-03T14:14:37","date_gmt":"2011-06-03T14:14:37","guid":{"rendered":"https:\/\/blogs.mathworks.com\/loren\/2011\/06\/03\/introducing-type-safe-apis-with-builder-ne\/"},"modified":"2011-05-26T20:16:58","modified_gmt":"2011-05-26T20:16:58","slug":"introducing-type-safe-apis-with-builder-ne","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/loren\/2011\/06\/03\/introducing-type-safe-apis-with-builder-ne\/","title":{"rendered":"Introducing Type Safe APIs with Builder NE"},"content":{"rendered":"<div xmlns:mwsh=\"https:\/\/www.mathworks.com\/namespace\/mcode\/v1\/syntaxhighlight.dtd\" class=\"content\">\r\n   <introduction>\r\n      <p>Guest blogger <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/authors\/4660\">Peter Webb<\/a> returns with another in an <a href=\"https:\/\/blogs.mathworks.com\/loren\/category\/deployment\/\">occasional series<\/a> of postings about application deployment.\r\n      <\/p>\r\n   <\/introduction>\r\n   <h3>Contents<\/h3>\r\n   <div>\r\n      <ul>\r\n         <li><a href=\"#1\">Life is Too Short to Write Boring Code<\/a><\/li>\r\n         <li><a href=\"#2\">Type Safe APIs<\/a><\/li>\r\n         <li><a href=\"#3\">Example C# Code<\/a><\/li>\r\n         <li><a href=\"#4\">Building and Running the Example<\/a><\/li>\r\n         <li><a href=\"#5\">More to Come<\/a><\/li>\r\n      <\/ul>\r\n   <\/div>\r\n   <h3>Life is Too Short to Write Boring Code<a name=\"1\"><\/a><\/h3>\r\n   <p>I can call MATLAB functions from C# using <a href=\"https:\/\/www.mathworks.com\/products\/netbuilder\/\">Builder NE<\/a>. But <a href=\"https:\/\/www.mathworks.com\/products\/matlab\/\">MATLAB<\/a> and <a href=\"http:\/\/en.wikipedia.org\/wiki\/C_Sharp_%28programming_language%29\">C#<\/a> have very different data types, so I spend a lot of time manually converting data from one system to the other. That kind\r\n      of work is tedious and error-prone -- the C# compiler can't check to ensure that I'm passing the right type of data to my\r\n      MATLAB functions.\r\n   <\/p>\r\n   <p>Ideally, I'd like to be able to write MATLAB code that uses <a href=\"https:\/\/www.mathworks.com\/help\/releases\/R2011a\/techdoc\/\/matlab_prog\/f2-43934.html\">MATLAB data<\/a> types and C# code that uses <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ms173104%28v=vs.80%29.aspx\">C# data types<\/a>, and not have to worry about the conversion between them. Consider a very simple example, a MATLAB <tt>multiply<\/tt> function:\r\n   <\/p><pre>function z = multiply(x, y)\r\n    z = x * y;<\/pre><p>Though it looks simple, <tt>multiply<\/tt> behaves very differently depending on the type of its inputs. If the inputs are scalars, the result is a scalar, but if they\r\n      are matrices, the result is the matrix product. And the numeric data type of the output (<tt>int32<\/tt>, <tt>double<\/tt>) varies with the type of the input.\r\n   <\/p>\r\n   <p>In C#, I'd like to call <tt>multiply<\/tt> with scalars and matrices, and additionally to to support scalars times vectors. That's three ways to call <tt>multiply<\/tt>, and in C#, that means three separate functions:\r\n   <\/p><pre>double multiply(double x, double y)               \/\/ Scalar\r\ndouble[,] multiply(double[,] x, double[,] y)      \/\/ Matrix\r\ndouble[] multiply(double[] x, double y)           \/\/ Vector x Scalar<\/pre><p>So far, that's nothing new -- I can do this today. I write each of these <tt>multiply<\/tt> functions myself, filling them up with code that converts .NET scalars, vectors and arrays to MATLAB matrices and vice versa.\r\n      But it's boring, and I hate being bored.\r\n   <\/p>\r\n   <p>So instead, I turn to the <a href=\"https:\/\/www.mathworks.com\/help\/releases\/R2011a\/toolbox\/dotnetbuilder\/ug\/bsuyj9j.html\">type safe APIs<\/a> generated by Builder NE (as of version 4.0, R2011a), and let Builder NE write this code for me.\r\n   <\/p>\r\n   <h3>Type Safe APIs<a name=\"2\"><\/a><\/h3>\r\n   <p>Type Safe APIs allow you to specify a kind of contract between your C# code and your MATLAB functions. You describe exactly\r\n      what kind of data you want to pass back and forth between MATLAB and C#, and Builder NE generates functions for those types\r\n      only. You give up a little flexiblity (you can't pass just any type of data to your MATLAB function, like you could with the\r\n      <a href=\"https:\/\/www.mathworks.com\/help\/releases\/R2011a\/toolbox\/dotnetbuilder\/MWArrayAPI\/HTML\/index.html\"><tt>MWArray<\/tt><\/a>-based interface), but you gain type safety. Now the C# compiler can tell if you're doing something you shouldn't be, like\r\n      passing strings to a function that operates on integers. (While this often completes without error, it very seldom produces\r\n      a useful result.)\r\n   <\/p>\r\n   <p>In C#, the usual mechanism for establishing such a contract is an <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/87d83y5b%28v=vs.80%29.aspx\">interface<\/a>. An interface defines the names and input and output types of one or more functions, but provides no implemention. We can\r\n      collect our three <tt>multiply<\/tt> functions into the <tt>IMultiply<\/tt> interface. By convention, .NET interface names begin with a capitial <tt>I<\/tt>.\r\n   <\/p><pre>interface IMultiply\r\n{\r\n    \/\/ Scalar multiplication\r\n    double multiply(double x, double y);<\/pre><pre>    \/\/ Multiply vector by a scalar, return a vector\r\n    double[] multiply(double[] x, double y);<\/pre><pre>    \/\/ Matrix multiplication\r\n    double[,] multiply(double[,] x, double[,] y);\r\n}<\/pre><p>The interface uses function overloading to take advantage of the polymorphism of the MATLAB function. The functions in the\r\n      C# interface have the same name as the MATLAB function; Builder NE <a href=\"https:\/\/www.mathworks.com\/help\/releases\/R2011a\/toolbox\/dotnetbuilder\/ug\/bsumwxw.html#bsyh0f9\">matches interface<\/a> functions to MATLAB functions by name and number of arguments. (I'll discuss the details of argument matching in a later\r\n      article.)\r\n   <\/p>\r\n   <p>To use a type safe API, you'll need:<\/p>\r\n   <div>\r\n      <ul>\r\n         <li>A MATLAB function<\/li>\r\n         <li>A C# interface that specifies the input and output types of that MATLAB function<\/li>\r\n         <li>A C# program that calls the MATLAB function through the C# interface.<\/li>\r\n      <\/ul>\r\n   <\/div>\r\n   <p>The example demonstrates how to incorporate a type safe API into a C# program. In the example, you'll work through 4 basic\r\n      steps:\r\n   <\/p>\r\n   <li>Create a MATLAB function, <tt>multiply<\/tt>.\r\n   <\/li>\r\n   <li>Define a C# interface <tt>IMultiply<\/tt>.\r\n   <\/li>\r\n   <li>Compile <tt>multiply<\/tt> into a .NET component named <tt>Multiply<\/tt> and generate the type safe API <tt>MultiplyIMultiply<\/tt>.\r\n   <\/li>\r\n   <li>Develop a C# main program that calls <tt>multiply<\/tt> through the <tt>IMultiply<\/tt> interface.\r\n   <\/li>\r\n   <p>Since we've already seen the MATLAB code and the C# interface, let's take a look at the C# main program.<\/p>\r\n   <h3>Example C# Code<a name=\"3\"><\/a><\/h3>\r\n   <p>You invoke MATLAB functions from C# by calling the instance methods of a Builder NE-generated component. Builder NE names\r\n      the type safe API class by combining the names of the MATLAB function component (<tt>Multiply<\/tt>) and the C# interface (<tt>IMultiply<\/tt>). In this case, <tt>MultiplyIMultiply<\/tt> is the name of the type safe API class. Call <tt>new<\/tt> to create an instance of the component's type safe API class:\r\n   <\/p><pre>\/\/ Create an instance of the Multiply component's type safe API.\r\nIMultiply m = new Multiply.MultiplyIMultiply();<\/pre><p><tt>IMultiply<\/tt> publishes three <tt>multiply<\/tt> methods, one of which multiplies a vector and a scalar. Create the input data by declaring C# variables:\r\n   <\/p><pre>\/\/ Create a C# vector and a scalar.\r\ndouble[] v = new double[]{ 2.5, 81, 64 };\r\ndouble s = 11;<\/pre><p>Finally, compute the product by calling <tt>multiply<\/tt>:\r\n   <\/p><pre>\/\/ Multiply the vector and the scalar. Note: all inputs and outputs\r\n\/\/ are native C# types.\r\ndouble[] d = m.multiply(v, s);<\/pre><p>As usual in C#, passing the wrong type of inputs (if <tt>v<\/tt> had been declared as a string for example) results in compile-time errors.\r\n   <\/p>\r\n   <h3>Building and Running the Example<a name=\"4\"><\/a><\/h3>\r\n   <p><a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/31291-introducing-type-safe-apis-with-builder-ne?controller=file_infos&amp;download=true\">Download the source code<\/a> from MATLAB Central into a new directory. The download contains the <tt>multiply<\/tt> MATLAB function and two Visual Studio projects. To create a runnable executable, you need to build the C# interface assembly,\r\n      create a <a href=\"https:\/\/www.mathworks.com\/help\/releases\/R2011a\/toolbox\/dotnetbuilder\/ug\/deploytool.html\"><tt>deploytool<\/tt><\/a> <a href=\"http:\/\/en.wikipedia.org\/wiki\/.NET_assembly\">.NET assembly<\/a> project for the MATLAB function and then link the main program against these two assemblies. The file <tt>ReadmeIntro.txt<\/tt> contains detailed instructions.\r\n   <\/p>\r\n   <p>The downloaded files compile into <tt>Multiplier.exe<\/tt>, a C# program that calls each of the methods in the <tt>IMultiply<\/tt> interface and prints the results. Make sure your runtime environment is set up correctly (you need either the <a href=\"https:\/\/www.mathworks.com\/help\/releases\/R2011a\/toolbox\/compiler\/f12-999353.html\">MCR<\/a> or MATLAB's <tt>runtime\/&lt;arch&gt;<\/tt> directory on your path) and then locate and run  <tt>Multiplier.exe<\/tt> from a DOS command window. The output should look something like this:\r\n   <\/p><pre>17 * 3.14159 = 53.40703<\/pre><pre>[ 2.5 81 64 ] * 11 = [ 27.5 891 704 ]<\/pre><pre>8 1 6   8 1 6   91 67 67\r\n3 5 7 * 3 5 7 = 67 91 67\r\n4 9 2   4 9 2   67 67 91<\/pre><p>To enable other types of multiplcation, say vector times matrix or matrix times scalar, define the appropriate methods in\r\n      <tt>IMultiply<\/tt> and then regenerate the <tt>Multiply<\/tt> component.\r\n   <\/p>\r\n   <h3>More to Come<a name=\"5\"><\/a><\/h3>\r\n   <p>To keep this post from turning into a book, I've discussed only the simplest and most common uses of Builder NE's type safe\r\n      APIs. Forthcoming articles will reveal the secrets of parameter ordering, address the use of structured types (cell arrays\r\n      and structures), and demonstrate how type safe APIs enable <a href=\"http:\/\/en.wikipedia.org\/wiki\/Inter-process_communication\">interprocess communication<\/a> through the <a href=\"http:\/\/msdn.microsoft.com\/en-us\/netframework\/aa663324\">Windows Communication Foundation<\/a>.\r\n   <\/p>\r\n   <p>In the meantime, please let me know what you think of this new feature. Will it make your job easier? How could we improve\r\n      it even futher? Let us know <a href=\"https:\/\/blogs.mathworks.com\/loren\/?p=277#respond\">here<\/a>.\r\n   <\/p><script language=\"JavaScript\">\r\n<!--\r\n\r\n    function grabCode_393b7e4e90a94e30be7a0396b8ceed44() {\r\n        \/\/ Remember the title so we can use it in the new page\r\n        title = document.title;\r\n\r\n        \/\/ Break up these strings so that their presence\r\n        \/\/ in the Javascript doesn't mess up the search for\r\n        \/\/ the MATLAB code.\r\n        t1='393b7e4e90a94e30be7a0396b8ceed44 ' + '##### ' + 'SOURCE BEGIN' + ' #####';\r\n        t2='##### ' + 'SOURCE END' + ' #####' + ' 393b7e4e90a94e30be7a0396b8ceed44';\r\n    \r\n        b=document.getElementsByTagName('body')[0];\r\n        i1=b.innerHTML.indexOf(t1)+t1.length;\r\n        i2=b.innerHTML.indexOf(t2);\r\n \r\n        code_string = b.innerHTML.substring(i1, i2);\r\n        code_string = code_string.replace(\/REPLACE_WITH_DASH_DASH\/g,'--');\r\n\r\n        \/\/ Use \/x3C\/g instead of the less-than character to avoid errors \r\n        \/\/ in the XML parser.\r\n        \/\/ Use '\\x26#60;' instead of '<' so that the XML parser\r\n        \/\/ doesn't go ahead and substitute the less-than character. \r\n        code_string = code_string.replace(\/\\x3C\/g, '\\x26#60;');\r\n\r\n        author = 'Peter Webb';\r\n        copyright = 'Copyright 2011 The MathWorks, Inc.';\r\n\r\n        w = window.open();\r\n        d = w.document;\r\n        d.write('<pre>\\n');\r\n        d.write(code_string);\r\n\r\n        \/\/ Add author and copyright lines at the bottom if specified.\r\n        if ((author.length > 0) || (copyright.length > 0)) {\r\n            d.writeln('');\r\n            d.writeln('%%');\r\n            if (author.length > 0) {\r\n                d.writeln('% _' + author + '_');\r\n            }\r\n            if (copyright.length > 0) {\r\n                d.writeln('% _' + copyright + '_');\r\n            }\r\n        }\r\n\r\n        d.write('<\/pre>\\n');\r\n      \r\n      d.title = title + ' (MATLAB code)';\r\n      d.close();\r\n      }   \r\n      \r\n-->\r\n<\/script><p style=\"text-align: right; font-size: xx-small; font-weight:lighter;   font-style: italic; color: gray\"><br><a href=\"javascript:grabCode_393b7e4e90a94e30be7a0396b8ceed44()\"><span style=\"font-size: x-small;        font-style: italic;\">Get \r\n            the MATLAB code \r\n            <noscript>(requires JavaScript)<\/noscript><\/span><\/a><br><br>\r\n      Published with MATLAB&reg; 7.12<br><\/p>\r\n<\/div>\r\n<!--\r\n393b7e4e90a94e30be7a0396b8ceed44 ##### SOURCE BEGIN #####\r\n%% Introducing Type Safe APIs with Builder NE\r\n% Guest blogger \r\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/authors\/4660 Peter Webb>\r\n% returns with another in an \r\n% <https:\/\/blogs.mathworks.com\/loren\/category\/deployment\/ occasional series>\r\n% of postings about application deployment. \r\n\r\n%% Life is Too Short to Write Boring Code\r\n% I can call MATLAB functions from C# using \r\n% <https:\/\/www.mathworks.com\/products\/netbuilder\/ Builder NE>. \r\n% But <https:\/\/www.mathworks.com\/products\/matlab\/ MATLAB> and \r\n% <http:\/\/en.wikipedia.org\/wiki\/C_Sharp_%28programming_language%29 C#>\r\n% have very different data types, so I spend a lot of time manually\r\n% converting data from one system to the other. That kind of work is\r\n% tedious and error-prone REPLACE_WITH_DASH_DASH the C# compiler can't check to ensure that I'm\r\n% passing the right type of data to my MATLAB functions.\r\n%\r\n% Ideally, I'd like to be able to write MATLAB code that uses \r\n% <https:\/\/www.mathworks.com\/help\/releases\/R2011a\/techdoc\/\/matlab_prog\/f2-43934.html \r\n% MATLAB data> types and C# code that uses \r\n% <http:\/\/msdn.microsoft.com\/en-us\/library\/ms173104%28v=vs.80%29.aspx \r\n% C# data types>, and not have to\r\n% worry about the conversion between them. Consider a very simple example, \r\n% a MATLAB |multiply| function:\r\n%\r\n%  function z = multiply(x, y)\r\n%      z = x * y;\r\n%\r\n% Though it looks simple, |multiply| behaves very differently depending on\r\n% the type of its inputs. If the inputs are scalars, the result is a\r\n% scalar, but if they are matrices, the result is the matrix product. And\r\n% the numeric data type of the output (|int32|, |double|) varies with the\r\n% type of the input.\r\n%\r\n% In C#, I'd like to call |multiply| with scalars and matrices, and\r\n% additionally to to support scalars times vectors. That's three ways to\r\n% call |multiply|, and in C#, that means three separate functions:\r\n%\r\n%  double multiply(double x, double y)               \/\/ Scalar\r\n%  double[,] multiply(double[,] x, double[,] y)      \/\/ Matrix\r\n%  double[] multiply(double[] x, double y)           \/\/ Vector x Scalar\r\n%\r\n% So far, that's nothing new REPLACE_WITH_DASH_DASH I can do this today. I write each of these\r\n% |multiply| functions myself, filling them up with code that converts .NET\r\n% scalars, vectors and arrays to MATLAB matrices and vice versa. But it's\r\n% boring, and I hate being bored. \r\n%\r\n% So instead, I turn to the \r\n% <https:\/\/www.mathworks.com\/help\/releases\/R2011a\/toolbox\/dotnetbuilder\/ug\/bsuyj9j.html \r\n% type safe APIs> generated by Builder NE (as of\r\n% version 4.0, R2011a), and let Builder NE write this code for me.\r\n\r\n%% Type Safe APIs\r\n% Type Safe APIs allow you to specify a kind of contract between your C#\r\n% code and your MATLAB functions. You describe exactly what kind of data\r\n% you want to pass back and forth between MATLAB and C#, and Builder NE\r\n% generates functions for those types only. You give up a little flexiblity\r\n% (you can't pass just any type of data to your MATLAB function, like you\r\n% could with the \r\n% <https:\/\/www.mathworks.com\/help\/releases\/R2011a\/toolbox\/dotnetbuilder\/MWArrayAPI\/HTML\/index.html\r\n% |MWArray|>-based interface), but you gain type safety. Now\r\n% the C# compiler can tell if you're doing something you shouldn't be, like\r\n% passing strings to a function that operates on integers. (While this\r\n% often completes without error, it very seldom produces a useful result.)\r\n%\r\n% In C#, the usual mechanism for establishing such a contract is an \r\n% <http:\/\/msdn.microsoft.com\/en-us\/library\/87d83y5b%28v=vs.80%29.aspx \r\n% interface>. An interface defines the names and input and output types of \r\n% one or more functions, but provides no implemention. We can\r\n% collect our three |multiply| functions into the |IMultiply| interface. By\r\n% convention, .NET interface names begin with a capitial |I|.\r\n%\r\n%  interface IMultiply\r\n%  {\r\n%      \/\/ Scalar multiplication\r\n%      double multiply(double x, double y);\r\n%\r\n%      \/\/ Multiply vector by a scalar, return a vector\r\n%      double[] multiply(double[] x, double y);\r\n%\r\n%      \/\/ Matrix multiplication\r\n%      double[,] multiply(double[,] x, double[,] y);\r\n%  }\r\n%\r\n% The interface uses function overloading to take advantage of the \r\n% polymorphism of the MATLAB function. The functions in the C# interface\r\n% have the same name as the MATLAB function; Builder NE \r\n% <https:\/\/www.mathworks.com\/help\/releases\/R2011a\/toolbox\/dotnetbuilder\/ug\/bsumwxw.html#bsyh0f9 \r\n% matches interface>\r\n% functions to MATLAB functions by name and number of arguments. \r\n% (I'll discuss the details of argument matching in a\r\n% later article.)\r\n%\r\n% To use a type safe API, you'll need:\r\n%\r\n% * A MATLAB function\r\n% * A C# interface that specifies the input and output types of that MATLAB function\r\n% * A C# program that calls the MATLAB function through the C# interface.\r\n%\r\n% The example demonstrates how to incorporate a type safe API into a C#\r\n% program. In the example, you'll work through 4 basic steps:\r\n%\r\n% # Create a MATLAB function, |multiply|.\r\n% # Define a C# interface |IMultiply|.\r\n% # Compile |multiply| into a .NET component named |Multiply| and generate\r\n% the type safe API |MultiplyIMultiply|.\r\n% # Develop a C# main program that calls |multiply| through the |IMultiply|\r\n% interface.\r\n%\r\n% Since we've already seen the MATLAB code and the C# interface,\r\n% let's take a look at the C# main program.\r\n\r\n%% Example C# Code\r\n% You invoke MATLAB functions from C# by calling the instance methods of a \r\n% Builder NE-generated component. Builder NE names the type safe API class\r\n% by combining the names of the MATLAB function component (|Multiply|) and\r\n% the C# interface (|IMultiply|). In this case, |MultiplyIMultiply| is the\r\n% name of the type safe API class. Call |new| to create an instance of the\r\n% component's type safe API class:\r\n%\r\n%  \/\/ Create an instance of the Multiply component's type safe API.\r\n%  IMultiply m = new Multiply.MultiplyIMultiply();\r\n%\r\n% |IMultiply| publishes three |multiply| methods, one of which multiplies\r\n% a vector and a scalar. Create the input data by declaring C# variables:\r\n%\r\n%  \/\/ Create a C# vector and a scalar.\r\n%  double[] v = new double[]{ 2.5, 81, 64 };\r\n%  double s = 11;\r\n%\r\n% Finally, compute the product by calling |multiply|:\r\n%\r\n%  \/\/ Multiply the vector and the scalar. Note: all inputs and outputs\r\n%  \/\/ are native C# types.\r\n%  double[] d = m.multiply(v, s);\r\n%\r\n% As usual in C#, passing the wrong type of inputs (if |v| had been\r\n% declared as a string for example) results in compile-time errors.\r\n\r\n%% Building and Running the Example\r\n% <https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/31291-introducing-type-safe-apis-with-builder-ne?controller=file_infos&download=true\r\n% Download the source code> from MATLAB Central into a new directory. The\r\n% download contains the |multiply| MATLAB function and two Visual Studio\r\n% projects. To create a runnable executable, you need to build the C# interface\r\n% assembly, create a <https:\/\/www.mathworks.com\/help\/releases\/R2011a\/toolbox\/dotnetbuilder\/ug\/deploytool.html \r\n% |deploytool|> <http:\/\/en.wikipedia.org\/wiki\/.NET_assembly .NET assembly>\r\n% project for the MATLAB function \r\n% and then link the main program against these two assemblies.\r\n% The file |ReadmeIntro.txt| contains detailed instructions.\r\n%\r\n% The downloaded files compile into |Multiplier.exe|, a C# program that\r\n% calls each of the methods in the |IMultiply| interface and prints the\r\n% results. Make sure your runtime environment is set up correctly (you need\r\n% either the <https:\/\/www.mathworks.com\/help\/releases\/R2011a\/toolbox\/compiler\/f12-999353.html \r\n% MCR> or MATLAB's |runtime\/<arch>| directory on your path) and\r\n% then locate and run  |Multiplier.exe| from a DOS command window. The\r\n% output should look something like this:\r\n%\r\n%  17 * 3.14159 = 53.40703\r\n%\r\n%  [ 2.5 81 64 ] * 11 = [ 27.5 891 704 ]\r\n%  \r\n%  8 1 6   8 1 6   91 67 67\r\n%  3 5 7 * 3 5 7 = 67 91 67\r\n%  4 9 2   4 9 2   67 67 91\r\n%\r\n% To enable other types of multiplcation, say vector times matrix or matrix\r\n% times scalar, define the appropriate methods in |IMultiply| and then\r\n% regenerate the |Multiply| component.\r\n\r\n%% More to Come\r\n% To keep this post from turning into a book, I've discussed only the\r\n% simplest and most common uses of Builder NE's type safe APIs. Forthcoming\r\n% articles will reveal the secrets of parameter ordering, address \r\n% the use of structured types (cell arrays and\r\n% structures), and demonstrate how type safe APIs enable \r\n% <http:\/\/en.wikipedia.org\/wiki\/Inter-process_communication interprocess \r\n% communication> through the \r\n% <http:\/\/msdn.microsoft.com\/en-us\/netframework\/aa663324 \r\n% Windows Communication Foundation>.\r\n%\r\n% In the meantime, please let me know what you think of this new feature.\r\n% Will it make your job easier? How could we improve it even futher? Let us\r\n% know <https:\/\/blogs.mathworks.com\/loren\/?p=277#respond here>.\r\n\r\n\r\n\r\n##### SOURCE END ##### 393b7e4e90a94e30be7a0396b8ceed44\r\n-->","protected":false},"excerpt":{"rendered":"<p>\r\n   \r\n      Guest blogger Peter Webb returns with another in an occasional series of postings about application deployment.\r\n      \r\n   \r\n   Contents\r\n   \r\n      \r\n   ... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/loren\/2011\/06\/03\/introducing-type-safe-apis-with-builder-ne\/\">read more >><\/a><\/p>","protected":false},"author":39,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[24],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/posts\/277"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/users\/39"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/comments?post=277"}],"version-history":[{"count":0,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/posts\/277\/revisions"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/media?parent=277"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/categories?post=277"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/loren\/wp-json\/wp\/v2\/tags?post=277"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}