Contents

283 Articles
13 Comments

Search

10 years Ago

Quino Data Driver architecture, Part I: Applications & Sessions

Published by marco on

One part of Quino that has undergone quite a few changes in the last few versions is the data driver. The data driver is responsible for CRUD: create, read, update and delete operations. One part of this is the ORM—the object-relational mapper—that marshals data to and from relational databases like PostgreSql, SQL Server and SQLite.

We’re going to cover a few topics in this series:

  1. Applications & Sessions
  2. The Data Pipeline
  3. Builders & Commands
  4. Contexts and Connections
  5. Sessions, resources... [More]

Are you ready for ReSharper 9? Not for testing, you aren’t.

Published by marco on

We’ve been using ReSharper at Encodo since version 4. And we regularly use a ton of other software from JetBrains[1]—so we’re big fans.

How to Upgrade R#

As long-time users of ReSharper, we’ve become accustomed to the following pattern of adoption for new major versions:

EAP

  1. Read about cool new features and improvements on the JetBrains blog
  2. Check out the EAP builds page
  3. Wait for star ratings to get higher than 2 out of 5
  4. Install EAP of next major version
  5. Run into issues/problems that make... [More]

The Road to Quino 2.0: Maintaining architecture with NDepend (part II)

Published by marco on

In the previous article, I explained how we were using NDepend to clean up dependencies and the architecture of our Quino framework. You have to start somewhere, so I started with the two base assemblies: Quino and Encodo. Encodo only has dependencies on standard .NET assemblies, so let’s start with that one.

The first step in cleaning up the Encodo assembly is to remove dependencies on the Tools namespace. There seems to be some confusion as to what belongs in the Core namespace versus what... [More]

The Road to Quino 2.0: Maintaining architecture with NDepend (part I)

Published by marco on

Full disclosure

A while back—this last spring, I believe—I downloaded NDepend to analyze code dependencies. The trial license is fourteen days; needless to say, I got only one afternoon in before I was distracted by other duties. That was enough, however, to convince me that it was worth the $375 to continue to clean up Quino with NDepend.

I decided to wait until I had more time before opening my wallet. In the meantime, however, Patrick Smacchia of NDepend approached me with a free... [More]

Optimizing compilation and execution for dynamic languages

Published by marco on

The long and very technical article Introducing the WebKit FTL JIT provides a fascinating and in-depth look at how a modern execution engine optimizes code for a highly dynamic language like JavaScript.

To make a long story short: the compiler(s) and execution engine optimize by profiling and analyzing code and lowering it to runtimes of ever decreasing abstraction to run as the least dynamic version possible.

A brief history lesson

What does it mean to “lower” code? A programming language... [More]

Quino v1.13.0: Schema migration, remoting, services and web apps

Published by marco on

The summary below describes major new features, items of note and breaking changes in Quino. The full list of issues is also available for those with access to the Encodo issue tracker.

Highlights

Data & Schema

Schema migration in Quino 1.13

Published by marco on

Quino is a metadata framework for .NET. It provides a means of defining an application-domain model in the form of metadata objects. Quino also provides many components and support libraries that work with that metadata to automate many services and functions. A few examples are an ORM, schema migration, automatically generated user interfaces and reporting tools.

The schema-migration tool

The component we’re going to discuss is the automated schema-migration for databases. A question that... [More]

EF Migrations troubleshooting

Published by marco on

The version of EF Migrations discussed in this article is 5.0.20627. The version of Quino is less relevant: the features discussed have been supported for years. For those in a hurry, there is a tl;dr near the end of the article.

We use Microsoft Entity Framework (EF) Migrations in one of our projects where we are unable to use Quino. We were initially happy to be able to automate database-schema changes. After using it for a while, we have decidedly mixed feelings.

As developers of our own... [More]

An introduction to PowerShell

Published by marco on

On Wednesday, August 27th, Tymon gave the rest of Encodo[1] a great introduction to PowerShell. I’ve attached the presentation but a lot of the content was in demonstrations on the command-line.

  1. Download the presentation
  2. Unzip to a local folder
  3. Open index.html in a modern web browser (Chrome/Opera/Firefox work the best; IE has some rendering issues)

We learned a few very interesting things:

  • PowerShell is pre-installed on every modern Windows computer
  • You can PowerShell to other machines... [More]

Should you return null or an empty list?

Published by marco on

I’ve seen a bunch of articles addressing this topic of late, so I’ve decided to weigh in.

The reason we frown on returning null from a method that returns a list or sequence is that we want to be able to freely use these sequences or lists with in a functional manner.

It seems to me that the proponents of “no nulls” are generally those who have a functional language at their disposal and the antagonists do not. In functional languages, we almost always return sequences instead of lists or... [More]

Optimizing data access for high-latency networks: part IV

Published by marco on

 In the previous two articles, we managed to reduce the number of queries executed when opening the calendar of Encodo’s time-tracking product Punchclock from one very slow query per person to a single very fast query.

Because we’re talking about latency in these articles, we’d also like to clear away a few other queries that aren’t related to time entries but are still wasting time.

Lazy-loading unneeded values

In particular, the queries that “Load values” for person objects look quite... [More]

Optimizing data access for high-latency networks: part III

Published by marco on

 In the previous article, we partially addressed a performance problem in the calendar of Encodo’s time-tracking product, Punchclock. While we managed to drastically reduce the amount of time taken by each query (>95% time saved), we were still executing more queries than strictly necessary.

The query that we’re trying to optimized further is shown below.

var people =
  Session.GetList<Person>().
  Where(p => Session.GetCount(p.TimeEntries.Query) > 0).
  ToList();

This query executes one... [More]

Optimizing data access for high-latency networks II

Published by marco on

 In the previous article, we discussed a performance problem in the calendar of Encodo’s time-tracking product, Punchclock.

Instead of guessing at the problem, we profiled the application using the database-statistics window available to all Quino applications.[1] We quickly discovered that most of the slowdown stems from the relatively innocuous line of code shown below.

var people = 
  Session.GetList<Person>().
  Where(p => p.TimeEntries.Any()).
  ToList();

First things first: what does... [More]

Optimizing data access for high-latency networks: part I

Published by marco on

 Punchclock is Encodo’s time-tracking and invoicing tool. It includes a calendar to show time entries (shown to the left). Since the very first versions, it hasn’t opened very quickly. It was fast enough for most users, but those who worked with Punchclock over the WAN through our VPN have reported that it often takes many seconds to open the calendar. So we have a very useful tool that is not often used because of how slowly it opens.

That the calendar opens slowly in a local network and even... [More]

Questions to consider when designing APIs: Part II

Published by marco on

In the previous article, we listed a lot of questions that you should continuously ask yourself when you’re writing code. Even when you think you’re not designing anything, you’re actually making decisions that will affect either other team members or future versions of you.

In particular, we’d like to think about how we can reconcile a development process that involves asking so many questions and taking so many facets into consideration with YAGNI.

Designing != Implementing

The implication... [More]

11 years Ago

Questions to consider when designing APIs: Part I

Published by marco on

A big part of an agile programmer’s job is API design. In an agile project, the architecture is defined from on high only in broad strokes, leaving the fine details of component design up to the implementer. Even in projects that are specified in much more detail, implementers will still find themselves in situations where they have to design something.

This means that programmers in an agile team have to be capable of weighing the pros and cons of various approaches in order to avoid causing... [More]

Dealing with improper disposal in WCF clients

Published by marco on

There’s an old problem in generated WCF clients in which the Dispose() method calls Close() on the client irrespective of whether there was a fault. If there was a fault, then the method should call Abort() instead. Failure to do so causes another exception, which masks the original exception. Client code will see the subsequent fault rather than the original one. A developer running the code in debug mode will have be misled as to what really happened.

You can see WCF Clients and the “Broken”... [More] by David Barrett

REST API Status codes (400 vs. 500)

Published by marco on

In a project that we’re working on, we’re consuming REST APIs delivered by services built by another team working for the same customer. We had a discussion about what were appropriate error codes to return for various situations. The discussion boiled down to: should a service return a 500 error code or a 400 error code when a request cannot be processed?

I took a quick look at the documentation for a couple of the larger REST API providers and they are using the 500 code only for... [More]

Mixing your own SQL into Quino queries: part 2 of 2

Published by marco on

In the first installment, we covered the basics of mixing custom SQL with ORM-generated queries. We also took a look at a solution that uses direct ADO database access to perform arbitrarily complex queries.

In this installment, we will see more elegant techniques that make use of the CustomCommandText property of Quino queries. We’ll approach the desired solution in steps, proceeding from attempt #1 – attempt #5.

tl;dr: Skip to attempt #5 to see the final result without learning why it’s... [More]

Mixing your own SQL into Quino queries: part 1 of 2

Published by marco on

The Quino ORM[1] manages all CrUD—Create, Update, Delete—operations for your application. This basic behavior is generally more than enough for standard user interfaces. When a user works with a single object in a window and saves it, there really isn’t that much to optimize.

Modeled methods

A more complex editing process may include several objects at once and perhaps trigger events that create additional auditing objects. Even in these cases, there are still only a handful of save... [More]

Java 8

Published by marco on

 This article discusses and compares the initial version of Java 8 and C# 4.5.1. I have not used Java 8 and I have not tested that any of the examples—Java or C#—even compile, but they should be pretty close to valid.

Java 8 has finally been released and—drum roll, please—it has closures/lambdas, as promised! I would be greeting this as champagne-cork–popping news if I were still a Java programmer.[1] As an ex-Java developer, I greet this news more with an ambivalent shrug than with any... [More]

Quino: efficiency, hinting and local sorting

Published by marco on

In Quino: partially-mapped queries we took a look at how Quino seamlessly maps as much as possible to the database, while handling unmappable query components locally as efficiently as possible.

Correctness is more important than efficiency

As efficiently as possible can be a bit of a weasel statement. We saw that partial application of restrictions could significantly reduce the data returned. And we saw that efficient handling of that returned data could minimize the impact on both... [More]

Quino: partially-mapped queries

Published by marco on

In Quino: an overview of query-mapping in the data driver we took a look at some of the basics of querying data with Quino while maintaining acceptable performance and memory usage.

Now we’ll take a look at what happens with partially-mapped queries. Before explaining what those are, we need a more concrete example to work with. Here’s the most-optimized query we ended up with in the previous article:

var query = Session.GetQuery<Person>();... [More]

LESS vs. SASS: Variable semantics

Published by marco on

I’ve been using CSS since pretty much its inception. It’s powerful but quite low-level and lacks support for DRY. So, I switched to generating CSS with LESS a while back. This has gone quite well and I’ve been pretty happy with it.

Recently, I was converting some older, theme stylesheets for earthli. A theme stylesheet provides no structural CSS, mostly setting text, background and border colors to let users choose the basic color set. This is a perfect candidate for LESS.

So I constructed a... [More]

Rolling your own languages and frameworks

Published by marco on

The blog post/article So You Want To Write Your Own Language? by Walter Bright (Dr. Dobbs) contains a lot of interesting information, related to only to parsing, but also to runtime and framework design. Bright is well-known as the designer of the D programming language, so he’s definitely worth a read.

I thought he jumped back and forth between topics a bit, so I summarized the contents for myself below:

Parsing

Bright identifies Minimizing keystrokes, easy parsing and minimizing the number of keywords as false gods.... [More]

Quino: an introduction to query-mapping in the ORM

Published by marco on

The following article was originally published on the Encodo blogs and is cross-published here.


One of the most-used components of Quino is the ORM. An ORM is an Object-Relational Mapper, which accepts queries and returns data.

  • Applications formulate queries in Quino using application metadata
  • The ORM maps this query to the query language of the target database
  • The ORM transforms the results returned by the database to objects (the classes for which were also generated from application... [More]

Generating JSON from Dart object graphs

Published by marco on

 A while back, I participated in an evaluation of languages that could replace JavaScript for our web front-end development language at Encodo. We took a look at two contenders: Dart and TypeScript. At the time, Dart was weaker for the following reasons:

  • It had not yet been released
  • It had little to no tool support
  • Integration with existing JS libraries was somewhat laborious

Though TypeScript has its weaknesses (it has technically not yet hit a 1.0 release), we eventually decided to go in... [More]

The Ruby language: where you can randomize your base class

Published by marco on

 I have never really examined Ruby in detail but it seems to be even more of a treasure-trove of ad-hoc features than PHP.

It takes full advantage of being evaluated at run-time to offer features that I haven’t seen in even other dynamic languages. Some of these features seem like they might be nice shortcuts but also seem like they would be difficult to optimize. Not only that, but they seem so obscure that they would likely will trip up even more seasoned users of the language.

At any rate,... [More]

Apple Developer Videos

Published by marco on

It’s well-known that Apple runs a walled garden. Apple makes its developers pay a yearly fee to get access to that garden. In fairness, though, they do provide some seriously nice-looking APIs for their iOS and OS X platforms. They’ve been doing this for years, as listed in the post iOS 7 only is the only sane thing to do by Tal Bereznitskey. It argues that the new stuff in iOS 7 is compelling enough to make developers consider dropping support for all older operating systems. And this for pragmatic reasons, such... [More]

Brilliant articles by the funniest guy at Microsoft

Published by marco on

I recently stumbled upon some Essays from the funniest man in Microsoft Research by Raymond (Old New Thing). He is such a funny writer that this article, against convention, will consist mostly of citations rather than an even mix of citations and paraphrasing that I naturally consider to be much more lucid and pithy. I quote at length to do the material justice, for documentation and to ensure that you all download the PDFs to see if there is more where that came from (there is). All emphases have been added.

Mobile... [More] by James Mickens (Microsoft Research)