In 2012/13 I invested my time into c# just in case c# would become more widespread and high-paying. However, after 2013, I have not noticed this trend strengthening. If I have to guess why, here some personal glimpses:
- Linux — Maturity and further performance improvement of Linux machines compared to windows machines. For large server side apps, or cloud apps, I see more and more adoption of Linux.
- Java@server-side — (in financial sector) Strengthening of java as the technology of choice on the server side. c# made a valiant but unsuccessful attempt to dethrone java in this game. Java may have limitations (do we know any?), but somehow the decision makers are not worried about them.
- C++@windows — My personal speculation. I feel c# offers higher performance than java on windows machines, but c++ is even faster.
I guess LINQ sometimes modifies a sequence in-place, and sometimes creates a new sequence like STL _copy algorithms
See posts on meta programming.
Linq sequence processing is FP.
However, Linq permits mutable sequence, contrary to FP principles.
Update: java 8 lambda. [[mastering lambds]] P 5 mentions AA BB DD as use cases for Command pattern
AA — is the main topic of the book
BB — https://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html
DD — http://www.oracle.com/technetwork/articles/java/lambda-1984522.html and http://www.drdobbs.com/jvm/jdk-getting-a-head-start-with-lambdas/240008174
Today I finally feel ready to summarize the 2 usage categories of c# delegates. If you are new like me, it’s better to treat them as 2 unrelated constructs. Between them, the underlying technical similarities are relevant only during initial deep dive, and become less important as you see them in various patterns (or “designs”).
In java, these features are probably achieved using interface + other constructs. Dotnet supports interfaces too, but in some contexts offers more “specialized” constructs in the form of delegates. As shown below, in such a context interfaces are usable but less than delegates.
Most tutorials would start with unicast delegate, without the inv list.
Coming from a java or c++ background, you will want to find a counterpart or close equivalent to delegates. Almost hopeless for BB. For AA there are quite a few, which adds to the confusion.
AA) lambda as function AAArgument
* I believe compiler converts such a lambda into a STATIC method (there’s really no host object) then bind it to a delegate Instance
* often returns something
* Usually _stateless_, usually without captured variables.
* predominantly unicast
* Action, Func and Predicate are often used in this context, but you can also use these 3 constructs as closures, which is a 3rd category beyond AA and BB
* Domain? Linq; functor argument as per Rajesh of OC
* Before java 8, often implemented as an interface or an anonymous inner class
BB) event field Backed by a multicast delegate instance (See other posts on “newsletter”)
* Usually NON-STATIC methods, esp. in GUI context
* Usually returns void
* A callback method is usually _stateful_, because the callback method often does its job with “self-owned” i.e. this.someField objects, beyond the argument objects passed in
* event is a pseudo _f i e l d_ in a class. Static field or non-static field are both common.
* Domain? GUI + asynchronous WCF
* we must register the callback method with the event source.
** can lead to memory leak
* in java, implemented by several callback Objects supporting a common interface (cf swing)
Some of the other categories —
CC) CCClosure — stateful, seldom passed in as a func arg
DD) thread start
EE) Passing in a delegate instance as a function input is the lambda usage (AA). How about returning from a function? P83 [[c#precisely]] shows examples to return an anon delegate instance. This is an advanced and non-trivial unicast use case. The underlying anon method is usually static and stateless
In a source code with AA, we see lots of custom delegate Types created on the fly.
In a source code with BB, delegate Instances take center stage, since each instance is assigned to a … pseudo field. The delegate type is less complicated.
1) home-grown web server to download any file in the local file system – essentially my invention, as no one in the team know how to do it
GUI – full ownership
stability improvement in the microagent and Guardian server
Bloomberg piece – no one dared to touch it given the complexity
Created many windows services
Though this post is about dotnet, it is likely to be also applicable to non-dotnet apps.
You can create/delete custom event logs. The 3 built-in event logs (app, security and sys) can’t be deleted. All of the above are viewable on eventvwr
Except security log, all other event logs are writable – including app, sys and custom event logs. I feel this is a simple way to implement basic application logging in dotnet. The EntryWritten event firing feature looks neat.
Further, it looks like multiple (Local) processes can subscribe to the same EntryWritten event, so you could perhaps coordinate 2 processes using EntryWritten — IPC
You can even access remote event logs.
Perf counter is Another simple IPC mechanism. You can create custom perf counters, visible to other processes + perfmon.exe.
Since one process can update the counter and another process can see it in real time, it’s IPC.
I have yet to implement IPC this way.
background — I used wcf many times but a clear understanding doesn’t come automatically.
See other blog posts about the “Service” jargon.
A TYPICAL wcf service is characterized by these items
– always remote;
– always requires serialization across network
– always uses a public url (part of the so-called service endpoint)
– protocol — typically http or tcp
– serializer/formatter/encoding — typically xml or binary
– there must exist a local proxy INSTANCE for some remote “object”, though the “service” concept isn’t strongly object-oriented.
– hosting process — any process that stays up, such as —
** console host
** winforms, wpf
** windows service (similar to linux daemons, visible on services applet)
** web server
A wcf service must be hosted — basically a server process. In contrast, the client process can be short-lived. The host is the realization of a lot of the above
wcf and soap? wcf is frequently implemented using soap + other technologies
wcf and the remoting technologies? see separate post
myArray.Aggregate(“”, (a, b) => a + b + “, “)