« first day (1355 days earlier)      last day (3642 days later) » 

1:49 AM
@RobertHarvey and for all the questions you ask it is true that a programmer should know and rather needs to know how the machine behaves, it's just interesting that the one perspective is so strongly ingrained in such a large portion of devs that they barely developed their ability to look from the other perspective, the top down from the highest level of abstraction first and how it interacts. It's important for a dev to be able to see both sides, if you don't understand the machine behaviour
you can't implement the high level abstractions, but if you can't think in terms of high level abstractions and how they interact at a conceptual level instead of an implementation level, you'll not be able to design high level abstractions of any quality, and you'll be even worse at utilizing them to the point of losing the value of abstraction to begin with
Thanks Joel for giving people the straw man argument to just claim "ooo abstraction I don't understand? Yeah, clearly architecture astronaut, is nonsense, c'mon guys let's all code assembly that's real programming"
 
 
1 hour later…
3:08 AM
@JimmyHoffa To be fair, I think there are a significant contingent of programmers who are thinking too much about architecture. You don't consider this a burden because you think like a functional programmer, but Java programmers don't have much practical access to this paradigm, which is why we have so many "software patterns."
Many of those software patterns are just workarounds for things that their particular language doesn't have natively. Of those, most have to do with the convenient use of first-class functions. The rest have to do with providing enough ceremony so that there is, as Yegge might put it, "something to look at," a familiar scaffolding by which you can divine the program's structure.
If you doubt that such architecture is over-used, consider that there are schools of thought that exist that advocate that every class you write in Java must be accompanied by a corresponding Interface, even if there is only one implementation. Why would you do this? Because that's what mocks in unit testing require (It's either that, or having the mock inherit your class, and making all of your functions virtual so that your mock object can override your methods --yuck).
 
3:39 AM
@RobertHarvey I agree there are a lot of architecture astronauts out there, much of it is bike shedding, people spend lots of time trying to figure out how to make a repo, factory, singleton, MVC, or flavor du jour because those are structures they understand when they aren't sure how to approach analyzing the actual domain problem. They focus on the details they are familiar with like the color of the bike shed.
 
 
5 hours later…
8:15 AM
@GlenH7 : The basic thing which i am trying to do Simply put:

I have GUI which will be running as the Main thread.
Besides that I have different code modules, which do different tasks altogether with the Seperation of Concern maintained.
Question is :
These Code Modules which use Queue's for inter-communication between these Modules, and Each thing into the Queue runs as a Off the ground, asynchronously - thread, like a Task.

So for the Task created from the Queue could perfectly be implemented by TAP pattern .
BUT the Long running code module's Major thread, Implementing the same using TAP doesnt look appropriate to me. So What are the other options for the same ?
 
 
6 hours later…
2:45 PM
Java : web : In a view that expects a list -> would you code is so the view checks for null or have the back end add an empty list if no items are there?
 
user55340
@tgkprog Working with empty lists is much easier than nulls, though note that when dealing with the standard taglibs, the test for empty and null tend to be the same (you are not writing scriptlets? are you?)
 
user55340
165
Q: Evaluate empty or null JSTL c tags

user338381How can I validate if a String is null or empty using the c tags of JSTL? I have a variable of name var1 and I can display it, but I want to add a comparator to validate it. <c:out value="${var1}" /> I want to validate when it is null or empty (my values are strings).

 
user55340
<c:if test="${empty var1}">
    var1 is empty or null.
</c:if>
<c:if test="${not empty var1}">
    var1 is NOT empty or null.
</c:if>
 
I swear, logging into this chat is uncanny in terms of thinking/opportunities to become more "officially" a programmer
 
No not writing script lets. thanks - not seen std tag libs for long. was just reviewing back end code.
 
user55340
2:51 PM
When possible, work with a null object rather than a null. It will make you happier in the long run.
 
user55340
In object-oriented computer programming, a Null Object is an object with defined neutral ("null") behavior. The Null Object design pattern describes the uses of such objects and their behavior (or lack thereof). It was first published in the Pattern Languages of Program Design book series. Motivation In most object-oriented languages, such as Java or C#, references may be null. These references need to be checked to ensure they are not null before invoking any methods, because methods typically cannot be invoked on null references. The Objective-C language takes another approach to this ...
 
hmm
 
@MichaelT That's a pretty controversial position. though I happen to agree with you
but not everyone does
 
user41796
@durron597 Not that controversial although there are strong opinions in both camps.
 
1
A: NullObjectPattern and the Comparable interface

JoffreyI generally not recommend the NullObject pattern because IMO, I found myself in one of these 2 cases: it does not make sense to use it like an object, and it should stay null it has too much meaning to be just a NullObject, and should be a true object itself (for instance, when it acts like a f...

 
user41796
2:58 PM
It's a matter of what's idiomatic for the language you're working in.
 
user55340
The problem I've dealt with is that tossing around nulls rather than null objects leads to if null checks everywhere or NPEs floating up...
 
user55340
It doesn't make sense in all cases, but there are many places where I'd rather just get a list back, not worry if its null or not, and iterate over it... if its an empty list, thats fine.
 
yes I like that - an empty list. A Null Object -> rather just have a default where needed. For a list -> size 0
bye
 
@MichaelT not to mention how much less likely you are to have the null problems since you have the logic for "is null" at a different location than you effectively set the null (if you return things from functions, I've been burned on this quite a few times until I switched to the way you describe)
 
@MichaelT Oh, I agree totally, I'm just saying, someone who's never heard of the concept should be familiar that it's not nearly as widely accepted a practice as, say, SRP or OCP
 
user55340
3:10 PM
@durron597 There are many more Patterns than people have read (or written) about. Null Object is mentioned in Refactoring (Fowler), but not called out specifically (too obvious?). Its not at all mentioned in Design Patterns. People tend to take the GOF as the one "know these and you know them all"
 
user41796
@MichaelT If Gamma, Helm, Johnson, or Vlissides didn't invent it then it doesn't need to be a pattern.
 
user55340
@GlenH7 Also as bad as the Pokemon Pattern Anti-Pattern - "Gotta use them all!"
 
user41796
They're just like Legos, so I don't see why not. I mean, you're meant to pick-and-choose and just stack them together, right? I mean, that's REAL ARCHITECTURE.
 
@MichaelT Every system must be written using the Command pattern!! You never know when you're going to need to implement undo!!
 
user55340
12
A: Choosing the right Design Pattern

MichaelTA key misconception in today's coding world is that patterns are building blocks. You take an AbstractFactory here and a Flyweight there and maybe a Singleton over there and connect them together with XML and presto, you've got a working application. They're not. Hmm, that wasn't big enough. ...

 
user55340
3:20 PM
And the thing I link to: How to Use Design Patterns
 
Yeah, I think a lot of people miss in Go4 is the "tradeoffs" section
probably because it's always in the middle of the chapter, and people only remember the beginning and end of things... probably in this case they only remember the beginning, because Go4 is technical and hard
so they don't make it to the end
 
user41796
@MichaelT I'm surprised I hadn't up voted that one before.
 
@GlenH7 Me too. But I just did
 
user55340
>
Erich Gamma: This is definitely the way I'd recommend that people use patterns. Do not start immediately throwing patterns into a design, but use them as you go and understand more of the problem. Because of this I really like to use patterns after the fact, refactoring to patterns. One comment I saw in a news group just after patterns started to become more popular was someone claiming that in a particular program they tried to use all 23 GoF patterns. They said they had failed, because they were only able to use 20. They hoped the client would call them again to come back again so maybe
 
@MichaelT patterns don't just solve code smells, I think even this fellow is attributing to much to their power
 
3:26 PM
Oh gosh I hope there's a better solution than this first comment
0
Q: Designing unit tests for a stateful system

durron597Background Test Driven Development was popularized after I already finished school and in the industry. I am trying to learn it, but some major things still escape me. TDD proponents say lots of things like (hereafter referred to as the "single assertion principle" or SAP): For some time I'v...

 
user41796
@JimmyHoffa You could safely argue he's a bit biased about Patterns, yes. Since that's the Gamma in the GoF
 
@GlenH7 oh he's the author of the book, didn't realize
 
user55340
> Bill Venners: That's funny, because my second question was that I have observed that often people feel the design with the most patterns is the best. In our design seminar, I have the participants do a design project, which they present to the others at the end of the seminar. Almost invariably, the presenters want to show off how many patterns they used in their design, even though I try to tell them the goal is a clean, easy to understand API, not to win an I-used-the-most-patterns contest. I just heard you say the same thing, that that's not the right way to think about patterns. If no
 
@GlenH7 never paid mind to find out what the 4 in the gang are, they didn't do anything interesting enough to get my attention
 
user41796
@durron597 Just one opinion. Wouldn't worry about it.
 
user55340
3:29 PM
(ahh, it glitches on the expand, but the original is ok... hmm...)
 
@GlenH7 Well I'm actually really struggling with this problem, trying to test this part of the code takes so much of my time
 
:15621230 anything he's done that I should recognize him by other than that book? Or any ideas or concepts he really drove that are worth knowing about?
 
user41796
Bleh, I should get better at my research.
 
@GlenH7 I can't break it into byte sized nuggets like the rest of my system
 
user41796
Yes, Gamma was involved in the design of Eclipse and worked at Rationale for a bit.
 
user41796
3:32 PM
@JimmyHoffa - given that you don't do much Java work, probably nothing of interest to you. Although he's apparently on the Visual Studio team now.
 
user55340
Co-wrote JUnit
 
@GlenH7 do a PhD
 
user41796
@enderland Started down that path once. No real inclination to go back.
 
@GlenH7 I don't generally find big name people interesting for the languages they work in or libraries they've written but the concepts they evangelize. Stuff that crosses languages. JUnit was surely nothing novel...
Sounds like he's probably a great coder who doesn't evangelize anything worth learning from other than abstract flyweight manager factories
 
user55340
That type of unit testing was part of the Small Talk, but hadn't gone mainstream yet... (btw, the story of Junit's creation is kind of neat: zdnet.com/blog/burnette/… )
 
3:36 PM
@MichaelT eh? Practical unit testing tools people use in industry is much older than Java, no?
 
user55340
Beck wanted to learn some Java. Gamma wanted to learn about this "unit testing thing" that they did in Small Talk... they were on a long plane flight, so they did the two together.
 
@GlenH7 yeah I know the feeling..
 
user55340
@JimmyHoffa It is, but it wasn't at all practical in a procedural language (ever look at unit testing for C?)...
 
user41796
@enderland Seems like a whole lot of effort for minimal gain at this point in time. I have no inclination to jump over to the academic side instead of industry. And if I really wanted to go into research, I think there are quicker paths for me to follow.
 
@MichaelT sure I get that, but JUnit was what - mid/late 90s? Before then there were many languages that had passed through industry and surely unit test tools existed in many of them. Not just C, but as you said SmallTalk, I suspect Perl and Python had test tools, I wouldn't be surprised at all is COBOL or Pascal had test tools
or varied other languages for that matter
 
user55340
3:39 PM
Perl had unit testing to make sure the language worked, and it is a huge set of programs that call the various libraries (IIRC).
 
user55340
And by that I mean that perl worked, not that the code written in perl worked.
 
@GlenH7 yeah I think there is an inherent tradeoff in all those sorts of things
 
early 90s perl didn't have any test-runner tools?
 
I could see myself doing PhD types of research if I retire early or something
 
I suspect such a thing would be a little odd actually, I mean perl is just scripts, testing any of it is simply a matter of writing a script that calls the pieces of your other script with the test data...
 
user55340
3:40 PM
The culture of unit testing didn't start really in Perl until 2001:
 
user55340
Test::More is a unit testing module for Perl. Created and maintained by Michael G Schwern with help from Barrie Slaymaker, Tony Bowden, chromatic, Fergal Daly and perl-qa. Introduced in 2001 to replace Test.pm, Test::More simplified and re-energized the culture of testing in Perl leading to an explosion of new testing modules and a strongly test driven community. Test::More is the most popular Perl testing module, as of this writing about 80% of all CPAN distributions make use of it. Unlike other testing systems, Test::More is not a framework but can be used in concert with other testi...
 
user41796
@enderland At one point I dreamed of working in Employer^^^'s R&D department. But as I've settled into other parts of the country, I don't know that the benefits of that dream would offset the effort involved in uprooting everything.
 
Heh I can't imagine how that feels when you get older, I feel that way and... am not as old as some of you all ;)
 
user41796
SE says I'm 94 now. Although MichaelT is older than me.
 
@GlenH7 time has a way of changing your priorities
 
user41796
3:43 PM
It really does.
 
what does that say if I'm in my 20s and not wanting to move...
 
user41796
Perhaps you've found a good place to live then. There's nothing wrong with that.
 
guess I've been here for nearly 10 years now already
 
user41796
In my case, it's not that I don't want to move. It's the collateral damage it would cause for my family / kids that I don't want to deal with. And given some of my health challenges this year, I'm very grateful for the network I have built up around me right now.
 
user41796
But those aspects push the hurdle a lot higher. The perceived benefit has to be quite a bit greater now.
 
3:46 PM
no joke
well ultimately I want to basically be able to work remotely and have some land somewhere and not be tied to money/location at all
 
user41796
You're probably in a pretty good area in order to make that happen. Not sure what the underlying communications infrastructure is like out your way, but technology advancements continue to lower that barrier daily.
 
> One of the enduring myths about functional programming languages is that they are somehow non-algorithmic. On the contrary, the idea of functional programming is to present algorithms in a more transparent form, uncluttered by housekeeping details.
good paper, easy to follow
 
@GlenH7 yeah, the SO and I have some pretty serious thoughts about that sort fo thyign
 
neat concept
interesting that right in the top there it broaches exactly what I was talking about yesterday, FP allows you to design things without the housekeeping details, but it's interesting how so many developers just lose all sense of direction when you get rid of those housekeeping details
 
user41796
@JimmyHoffa That's because a lot of programming is really just dealing with housekeeping.
 
3:52 PM
@GlenH7 I know it, I keep plenty of house in code ;P still interesting how getting rid of the side-effect of programming causes people to lose track of all the substance
by side-effect I mean the implementation details, not side-effects in code
implementation details are just a side effect of the machine you're working on. If you were working on paper would you still create all the extraneous details? Probably, but then that's just the power of habit now isn't it?
I don't think you'll find an elegant solution to this. The general approach is not to make the system stateful to begin with, which doesn't help you when testing something that's already built. Refactoring it to be stateless probably isn't worth the cost either. — Doval 28 mins ago
@durron597 I agree completely with this --^
you're basically being hindered by an inflexible design approach, but at this point chances are just to get to write tests it's not worth your time to refactor to a less stateful design
perhaps focus on automating complete integrated and or deployed tests now instead of worrying about unit tests, your system's design likely doesn't support unit tests because of the intensely tight coupling it sounds like you have
 
@JimmyHoffa The system is inherently stateful
I mean, imagine if you were trying to test a program that plays conway's game of life
your choices (it seems to me) would be to either, given an existing board, see if the next iteration produces the expected new board
or, drill into the individual behavior like shouldDie(Board[][], int x, int y)
but the shouldDie method, if you designed it that way, would almost certainly be private
but, actually, thinking about the conway's game of life example has lit a lightbulb over my head
if i separate the state of the system from the decision logic
have a method update(SystemState state, UpdateData newData)
 
@durron597 the decision of whether you shouldDie is always a deeply personal issue...
2
 
4:07 PM
 
user55340
public class Person {
  final public Date birthday;
  personal boolean shouldDie() { ... }
}
 
@durron597 bingo, separating state from decision logic is why people use DTOs so much, dumb objects that just hold data that they can pass to classes full of logic that hold no state
 
user41796
Gonna start having to flag some of these as offensive ....
 
user55340
#ifndef FUNNY
#define FUNNY macroImage
#endif
 
4:11 PM
@JimmyHoffa If you want to turn that chat message into a reply to my post I'll certainly upvote it and probably accept it later
 
user55340
See, its a funny code macro.
 
user41796
@MichaelT Go back to your Java .... :-P
 
@MichaelT proof you need to get back to work ;P
@durron597 doval said it first and he's right, you likely don't have the time or rather it wouldn't be worth the time for you to execute such refactoring right now
 
user55340
@JimmyHoffa You're just bitter that I didn't use a lisp macro...
 
@durron597 unless you rewrite it in Haskell...
 
4:14 PM
@JimmyHoffa I actually asked my boss for "time to improve the way the system is structured to make unit testing less painful" and he approved it
 
user55340
@durron597 he'll slip a monad in there...
 
@MichaelT or an arrow?
 
@MichaelT Have some chompsky hierarchies lambda-the-ultimate.org/node/4129
I've decided LtU is the best online programmers news aggregator there is
 
user41796
@JimmyHoffa I trust that's a low volume feed?
 
4:20 PM
posted on April 15, 2014

LtU now supports MathJax, which allows the use of TeX markup in posts and comments. Note that only TeX/LaTeX markup is currently supported - the alternate MathML format conflict's with the blog's HTML sanitization. This enhancement is dedicated to neelk, who most recently suggested this feature just over a year ago. When I went searching for a bit of Mathjax-compatible LaTeX that was relevan

posted on April 21, 2014

Walter Bright recounts how he came to write D The path that led Walter Bright to write a language, now among the top 20 most used, began with curiosity — and an insult.

posted on April 29, 2014

Fifty Years of BASIC, the Programming Language That Made Computers Personal A very comprehensive history of BASIC from Time magazine. Invented by John G. Kemeny and Thomas E. Kurtz of Dartmouth College in Hanover, New Hampshire, BASIC was first successfully used to run programs on the school’s General Electric computer system 50 years ago this week–at 4 a.m. on May 1, 1964, to be precise.

posted on May 03, 2014

A CHI 2014 paper by Tom Lieber et al, abstract: We present Theseus, an IDE extension that visualizes run-time behavior within a JavaScript code editor. By displaying real-time information about how code actually behaves during execution, Theseus proactively addresses misconceptions by drawing attention to similarities and differences between the programmer's idea of what code does and what it

posted on May 18, 2014

Type soundness and freedom for Mezzo, Thibaut Balabonski, François Pottier, and Jonathan Protzenko, 2014 Full paper Presentation slides The programming language Mezzo is equipped with a rich type system that controls aliasing and access to mutable memory. We incorporate shared-memory concurrency into Mezzo and present a modular formalization of its core type system, in the form of a concur

 
@GlenH7 very. every 3-7 days
WHOA oops
but look at the distance between the dates there
 
user55340
The first import is always spammy.
 
closer to 2 weeks between each post
 
user41796
@JimmyHoffa That's a pretty reasonable spread, yeah
 
4:48 PM
Listening to it now; he pulled up the wolfenstein 3d code and went to reimplement it in Haskell
 
I wish I had the authority to grant myself random authority over other people and make them do things.
 
@ThomasOwens You do
 
@JimmyHoffa Seriously? Sweet.
 
@ThomasOwens Yes ma'am, do it up. You give them what to and how for.
in all seriousness, it is genuinely amazing how much you can organize folks you have no authority over just by having ideas about how things should go and speaking confidently of them. More people than most realize are just looking around for instruction and aid no matter what level in the company it comes from, below or above them
 
@JimmyHoffa no kidding.
 
5:03 PM
@enderland lovely weather, was 80 here yesterday
 
@JimmyHoffa ;)
 
user55340
@JimmyHoffa You're doing a reasonable job of describing my niece (4 years old) when playing with other kids (even older ones).
 
@MichaelT I'm glad you don't immediately recognize this trait in most of your coworkers, too ;)
 
user55340
@enderland Well, given my current employment status... my cat is fairly confident and can tell me to scratch his head now...
 
user55340
He gets bored with pair programming though.
 
5:07 PM
oh. right :\
 
user55340
Consider this though... I personally haven't really taken a vacation in 2 years... (the way vacation schedules work)... so I'm relaxing a bit too.
 
user41796
@MichaelT You should have heard back from your initial leads by now, right? Anything promising from those two angles?
 
user55340
Add some needed home improvement.
 
user55340
@GlenH7 One had legal issues with Employer^^ and are hesitant of hiring anyone from there, despite liking the background (Employer^^ has a clause in the contract not to try to hire away people you worked with - so they go after the other former employees).
 
user41796
That's frustrating
 
user55340
5:10 PM
I'm calling back the other one today in a bit about a SDTE-ish position.
 
user55340
The third is a Very Large Company, and always has open reqs...
 
@MichaelT did you work for Datacard at some point? I feel like you said you had, I can't remember
 
user55340
I've also got a rainy... season/year fund that can last awhile if I decide to wait it out for another position to open...
 
user55340
@enderland Nope.
 
user41796
Good to hear there are irons in the fire still. I always hate how time seems to slow down while waiting.
 
5:11 PM
ah, not sure why I thought so
 
user55340
Home improvement... cleaning the house (picture a... pack rat tendency person (my entire family has it) who does not have a significant other to point out things need to be done over the course of years...)... painting the fence, fighting with the lawn mower...
 
you aren't willing to relocate, right?
 
@MichaelT I hope you at least won the argument about who get's to pick what to watch on TV, you can only watch lawnmower man so many times...
 
user55340
@enderland I would be, but I'd like to exhaust the options here first... I own the house (no mortgage). Its a nice house...
 
@MichaelT I think technically after there's no mortgage on your house you more than own it, you actually pwn it at that point.
 
user55340
5:14 PM
There are 3 other houses for sale and another house for rent on this block... I'd rather not try to sell in this environment. Which means that I'd need about $4k/year for house taxes and maintenance until the economy picks up enough.
 
@JimmyHoffa ... until you don't pay property taxes
 
> Everything that is syntactically legal and the compiler will allow will end up in your code base eventually - Carmack on what it's like being a director over dozens of programmers with millions of lines of code
> Multi-paradigm means you can always do the bad thing if you really want to
 
6:04 PM
 
psr
@JimmyHoffa Better delete that before Andy tracks you down by your photo.
 
user41796
<snicker>
 
8:18 PM
some days (or weeks) motivation is just so low...
 
@JimmyHoffa: So I have this nice discussion with my supervisor about how I'm going to write an SDS the next time, so that I can give him better time estimates.
Last week, I'm working through my project trying to close it out, when I discover a deadlock.
The cause of which I cannot isolate.
So now, I'm spending my day with a machete hacking through all those precious classes, trying to find a way to bypass the part that's causing the deadlock.
So much for intricate planning.
2
 
I think this question betrays a lack of knowledge about the MVC concept. For instance, you speak of it as a new thing whereas MVC was invented in the 70s. You also speak of it as an overarching systems design approach when it's really just a basic technique for simplifying UI design and does not detail the system beyond UI. You should perhaps do some more researching on MVC to get your head around the full crux of what it is, where it came from, and what it's for, because this question doesn't really make sense when you fit it into the reality of MVC as such — Jimmy Hoffa 7 secs ago
@RobertHarvey this statement alone speaks volumes. A lesson so many of us learn over and over and over (me just as much if not more than others)
@RobertHarvey absolute worst case scenario there's a slightly shitty general deadlock solution that may be a fit for you now that you're at project end as it is and oughtn't be tearing the system apart. General solution for deadlocks: Add delays/make asynchronous your dependence. Think of it like a dirty read, it may not give you perfect data but if you can get the lock you need later you can usually let things unravel a bit so the resource is released and available again
@RobertHarvey <--- so glad I spent all that time learning to debug memory dumps with windbg
you can identify deadlocks from a live program fairly well in such fashion
 
Ehm, I have a fair idea why it's happening. One of the pipelines is slower than the others, and it's honking up my Consumer.
 
@RobertHarvey and do you know what part's slow? Is it IO bound? Is it just got too large a dataset?
 
@RobertHarvey man SDS
 
8:29 PM
Software Design Specification
 
@durron597 Man, ed! !ed man
 
Guess what's not on this list: en.wikipedia.org/wiki/SDS
 
Basically "What classes will I need, how will they interact, how long will it take to write and test each one?"
 
heh i checked there too, wikipedia failed me for the... first time in a long time
 
0
Q: What was before MVC?

ProgMVC is used a lot (not only in web apps) and it seems it's the 'go to' approach when designing software. There are also a lot of MVC versions. My question is: what was before MVC? How did people structure large software systems? Obviously 'separation of concerns' wasn't invented with MVC (even ...

Translation: "What other architectural approaches are there besides MVC?"
^--- too broad, CV plz
 
8:34 PM
@JimmyHoffa It's a huge dataset, but the real problem is that I'm polling the ass end of the pipelines in the Consumer to pull off the data packets. What I'm going to do instead is to hand the pipelines a reference to the Output Queue in the Consumer (it's a thread-safe blocking queue), and let them write to it directly. Now all I have to do is figure out a new way to signal completion.
 
I hate how people learn MVC these days and then think "OK so there's the UI, and then Models. The rest of the system is just some models or something."
@RobertHarvey why not hand the consumer eventing function to the pipeline's instead? Then they don't need to write to a queue for something else, but they just execute the consumers trigger directly.
 
You mean like a Write delegate? That's not a bad idea. Though I only have two days left, and I still have some documentation to write.
 
@RobertHarvey If you're not super familiar with EventWaitHandles then by all means, go learn and use them. Signalling completion or really signalling anything with them is mega easy, they are a very handy tool to have in your toolbox that many devs don't have
@RobertHarvey You could just use a normal .NET event instead of manually using a Func<>
 
I've already got enough threads; I just need a reliable way to signal completion now.
 
@RobertHarvey eventwaithandle's exist for signalling
 
8:39 PM
Yeah, I don't need another thread. I just need a way to tell the consumer "OK, all of the pipelines are empty; you can flush and close the target file now."
 
You know like *nix signals? SIGINT, SIGKILL, etc? Windows has that too. EventWaitHandle is the .NET abstraction over those signals. They have two states: Open, Closed. Open means it's signalled, closed means it's not. You complete your processing? someEventWaitHandle.Set() and the signal fires anybody who's sitting in a someEventWaitHandle.WaitOne() block
EventWaitHandles are abstractions over windows in-built signalling system which has named and process scoped or global scoped signals. So you create a signal and give it a name and choose if it's globally or process-only scoped. new EventWaitHandle("someName", true) (or something like that) would create a signal that can be .WaitOne()'ed on by any process in your system so long as they use "someName" to be waiting on the same signal
 
Everything is blocking queues, so as long as I don't screw with the fences, it should all work. The tricky part is that the pipelines have some blocking queue buffers that need to be flushed, and it takes a few ms to get through the subsequent filters, but that's OK, because I already have Flush() signalling, and the pipeline is empty when I try to dequeue and it receives a null packet.
So I think I'm OK if I execute a Flush() on the Producer (which flushes all the pipelines), and then poll the pipelines with a loop until they all return null packets. Then I can close the file.
I'm going to make the blocking queues in each pipeline much smaller. Really, all they're there for is to keep the filters busy while packets are being read from the source file.
And right now they're set at a high-water mark of 256.
That's way too much; I'm going to dial them back to, say, 8 or 16 packets per pipeline.
 
@RobertHarvey polling pfleh :P make flush .Set() a signal, and have consumers all .WaitOne()ing so everytime you .Flush() it unblocks the consumer which immediately dequeues until empty.
no need to poll
 
I'll only flush once.
 
alternatively you already have it all done
so just go with what ya got heh
 
8:45 PM
Yeah, good luck with that.
 
In the future though, go learn about .NET's WaitHandles. Will simplify a lot of things for you, you'll never have to poll for something again when you get used to using signals to trigger functionality instead of just checking in a loop
 
The problem is the pipelines are self-running. So what I really need to do is tell the pipeline to tell the Consumer that it is done.
The pipeline knows when it is done, but not the consumer (unless the consumer periodically checks for a null packet).
The consumer is already aware of all the pipelines (it has a reference list).
So something needs to fire when every pipeline says "I'm done."
That should be easy enough to rig up in a ReportCompletion() method.
No need for WaitHandles. :)
@JimmyHoffa Thanks for letting me talk through it.
 
@RobertHarvey he's basically a rubber duck
 
We knew that all along, right? A rubber duck with a lambda symbol painted on his back.
 
but he's a functional rubber duck, right?
 
8:55 PM
There you go.
 
Just throwing it out there :)
That's the mental image that comes to mind for me with what you're talking about
 
That looks like a polling loop.
 
@RobertHarvey It is but the polling's optional
and at the same time it's not a polling loop
you could remove the 5000 and it won't poll, it will wait forever for one of the pipelines to fire the signal
and as soon as one of the pipelines fires the signal, the OS will unblock the thread waiting on it
when it unblocks it checks if they're all finished, if not it goes back to waiting for the next pipeline to finish, if they are all finished it fires whatever it's supposed to do when they're all finished
and if I'm rubber anything, it's a rubber gimp O_O
 
Thanks for the code. :)
 
@RobertHarvey code is like fire, even the smallest bit of it can easily grow on it's own to destroy everything you hold dear :o
 
9:22 PM
The newbies are infecting the Whiteboard. Half of the starred posts are not capitalized properly.
 
user55340
9:37 PM
@RobertHarvey u iz old.,. i'll get off ur lawn grandpa.
 
user55340
That said, @WorldEngineer if you let me poke at the P.SE blog, I'll write a bit about Patterns.
 
You need to get it by the Blog Committee first.
 
user55340
Let me write it, they can have the right of first refusal... if they don't want it, I'll pull it to my blog.
 
9:56 PM
@JimmyHoffa: Do you have to lock over a boolean member variable if it is being accessed by multiple threads?
Shit. Jon Skeet doesn't even understand volatile.
 
@RobertHarvey those are all relatively vague terms. Firstly I don't think you can lock on a primitive offhand, can you? secondly I can't even think about how the boolean would behave on each local thread - sometimes member access of stack values will get pulled and memoized in the local scope
 
I can use a separate locking object, if I have to.
 
@RobertHarvey nobody understands volatile. It's like the GC's tuning algorithm: People know it works really well but have no fucking clue what it does
 
But do you even need a synchronization primitive for a boolean?
 
@RobertHarvey you would/should, and the other piece you missed in your statement is where you said "access" - do you mean read or write?
 
9:58 PM
Yes.
 
@RobertHarvey It depends what you're doing with it - are you asking is boolean writing is atomic?
the answer is simply: Just as atomic as every other member value read or write.
 
I'll use object _locker
 
@RobertHarvey Why?
What are you doing? This sounds a bit odd
And it sounds like you're not sure what you're doing heh
 
One thread could be reading it while the other is writing it. I won't lock over it if I don't have to.
 
@RobertHarvey What is the purpose of it? Will it flip back and forth - or only one direction and only once?
 
10:01 PM
bool _pipelineWasFlushed
Only once.
Or, if you like
bool _endOfData
 
@RobertHarvey so it'll only flip once? You shouldn't need a lock for that. I assume you just have some while(!_pipelineWasFlushed) Thread.Sleep(1000); or something yeah?
 
Exactly.
 
You don't need a lock for that
 
That's what I thought.
 
even if you do get dirty reads (which you can) it just means you'll loose one more cycle in the poll but it'll get a clean read on next cycle through
and the chances of a dirty read are tiny
 
10:03 PM
OK.
Hmm, the Skeet seems to disagree.
18
A: Boolean Property Getter and Setter Locking

Jon SkeetWell, you don't need locks necessarily - but if you want one thread to definitely read the value that another thread has written, you either need locks or a volatile variable. I've personally given up trying to understand the precise meaning of volatile. I try to avoid writing my own lock-free c...

 
psr
Skeet just says you may get a dirty read
 
He says the code may not terminate.
 
psr
Oh, possibly a dirty read indefinitely. That would be bad.
 
I'll put a lock around it.
An abundance of caution... I'll even give the lock its own locking object.
 
psr
♫ If you liked it then you should have put a lock on it ♫
3
 
10:11 PM
an indefinite dirty read? That would only happen if your function memoizes the variable (which happens sometimes but you can force it not to)
 
user55340
 
psr
@JimmyHoffa Skeet claims it can sit in a register indefinitely
 
I read some of the article linked to in the comments about volatile. Makes my head hurt.
 
@psr interesting. That seems weird but that's what volatile's for...
 
user55340
Only know you've been high when you're feeling low
Only hate the road when you’re missin' home
Only know you need a lock when you let it go
And you let it go
 
psr
10:12 PM
@JimmyHoffa Sure. live it up.
 
@RobertHarvey volatile mostly just means "Ensure this is never cached or memoized, and guarantee access/initialization/etc occurs in precisely the order I specify - no optimization may change it"
 
It most likely would work on a boolean, without further analysis.
 
psr
@JimmyHoffa Within the bounds of memory barriers on either side, which is defined as "where the souls of programmers are trapped". If I remember correctly off the top of my head.
 
@psr yeah trying to think it over in my head - hitting a perfect race condition right before the member on one side is how you would end up with an indefinitely inaccurate value cached
but that's like.. that's just such an unbelievably tiny window, but yeah it is a risk. One that nobody in enterprise anywhere really worries about (pretty much ever)
 
user55340
@JimmyHoffa ... we just restart the app server... it was probably something else that caused the problem anyways.
 
10:19 PM
Hitting that window in my application would be bad. As in, "I just wasted the last 8 hours" bad.
 
psr
@JimmyHoffa QA will never prove it was your fault.
 
@MichaelT That video is a trip. The guy's voice is nice, but if you've never heard it before, you'd think it had a Mickey Mouse processor on it.
Set to 3.
 
user55340
I still like this one... bit more appropriate to our careers.
 
user55340
May 11 at 0:20, by MichaelT
 
Also, he looks like this guy.
 
user55340
10:21 PM
And then same song... live recording...
 
user55340
May 11 at 0:21, by MichaelT
 
user55340
In his song "Traveling alone" he describes himself as "Australian Man, Scandinavian Tan"
 
Meaning none, right?
 
user55340
Yep.
 
user55340
I'm fond of his rant at 1:44 in the live version.
 
10:33 PM
@psr ever.
 
10:49 PM
0
Q: How does a search functionality fit in DDD with CQRS?

SongoIn Vaughn Vernon's book Implementing domain driven design and the accompanying sample application I found that he implemented a CQRS approach to the iddd_collaboration bounded context. He presents the following classes in the application service layer: CalendarApplicationService.java Cal...

eesh. "I'm told not to X for some reason, so how do I use Y and Z to make A?" - need to look at these things from a broader perspective and forget about blind faith - why shouldn't you X? why is Y and Z even good?
 
It gets worse. I think many folks actually think DDD is a software development technique.
Hm, well I think I may have found out why I was deadlocking.
 
@RobertHarvey You forgot to delete that little code hidden in an #if DEBUG ?
 
The ordered queue was presented a tuple with the same key.
Gah. The debugger is showing the queue keys in decimal, but the new key in hexadecimal.
I hate that.
Crap. This could get ugly.
 
@RobertHarvey what are you locking on? If you're deadlocking, maybe you're just locking too much - do you have many read-only structures? I hope you're not locking just to read.
Even locking to write can be avoided often times if you make the data being read an immutable object (or at least unique instance to whoever's going to write something based on it)
 
I've gotten the architecture simplified to the point where the real error is emerging... It's not being buried under a bunch of threads anymore.
 
10:59 PM
@RobertHarvey Aren't race conditions fun?
 
mmm hmm.
 
@RobertHarvey what was that about Haskell again? Oh sorry, I'll shutup.
 
Haskell wouldn't have saved me here.
 
@RobertHarvey inaccurate, Haskell wouldn't have deadlocked
 
11:29 PM
New reason to use Equals() instead of == ... You can find all of the uses of Equals().
 
11:52 PM
grep Equals(
but what if there is a space before the (
 

« first day (1355 days earlier)      last day (3642 days later) »