This project is read-only.

New Push For TDD?

Topics: Code
Feb 27, 2015 at 7:12 AM
Having done a bit more TDD professionally now, I think it will be a great fit for a project like this with so many independent components that we are designing to be self-sufficient. However, we do have some hoops to jump through to get there. Here are a couple we should consider:
  • Many systems/dependencies are as singletons, which do make for highly "browsable" code, which will be very important for new coders here who may be overwhelmed by the sheer amount of little parts and not know their way around. F12 is our friend! F12 on an ISomething.Foo is useless and confusing but Concrete.Instance.Foo takes you right there.
  • We are interface-light / our core systems are not mockable. Historically, we actually used to be losing steam from being too interface-heavy and having to change multiple classes all the time for every single method signature change of every single type of item / behavior / effect / etc... was onerous, and we weren't even taking advantage of interfaces in any of the ways that they can actually ADD value. Their only purpose used to be "declare all your interfaces in the most-referenced DLL and now you don't have too worry about DLL reference chains as much" (which was a symptom of another problem - we had too many DLLs and too complex a DLL reference chain - but I digress).
So some possible solutions which can be explored:
  • I'd like to explore for ways to retool our singletons to still provide our codebase with the "strong browse-to-definition exploration support" while being able to mock those resources as needed. Thoughts?
  • Perhaps core systems should gain useful interfaces to assist with TDD/mocking. Specific end bits, like Behaviors, should not. Another strategy I've read, but haven't had experience with, is MOQ against concrete classes with non-private virtuals. (Neither of these alone solve the singleton issue above.)
Feb 27, 2015 at 3:49 PM
  1. Interfaces can always be added and used and should be if we are using DI the right way.
  2. The current code and its coverage is terrible; it actually seems worse than I left it years ago. What happened?
  3. I dislike static singletons as they are harder to run unit tests on, and want them to be testable instances simply wrapped in a generic singleton class to get around that issue.
  4. Really important question: What is the actual goal of this project, the one thing that is the goal? To build something people can learn from, or to release a mud?
Feb 28, 2015 at 6:01 AM
  • We're not using DI the right way yet.
  • I'm not sure that coverage was ever great, but I do know some major refactors occurred over the years. Perhaps broken tests were discarded, or perhaps coverage wasn't as good as you remember?
  • As long as they're testable AND F12-friendly, I'd be happy to see what you have in mind, if you have time to pick a singleton and see what can be done there?
  • Goals are documented here: https://wheelmud.codeplex.com/wikipage?title=Project%20Goals - in fact the whole Wiki section should be in pretty good shape as I've updated all the content as I brought it over from the stand-alone site.
Feb 28, 2015 at 4:47 PM
Glad to see you are ok with good DI.

Yes I think the test coverage went down.

Anything I do would have the strict requirement that we could build in one step and if that step is F12 then so be it.

Looking at the goals we need to take a step back and look at what we are doing. If the goal is to give people job skills then I think we need to reflect on some fi the choices that have been made for the code base and ask ourselves "would I hire somebody who did that?". In many places I see things that I would not be eager to show a potential employer.

I also think we go too far beyond what is needed to support the hobbyist coder. Adding the extra solution files is additional work that distracts from the work of creating the code base. Honestly with C# and .NET newly openesourced, as well as with the plans for Visual Studio to have a much more friendly community edition, I do not think the non-visual studio solutions are even needed and having them may actively work against our stated goals.

I'm also thinking that codeplex may be the wrong Platonism for this., Everybody is on github now, and hiring managers look at projects there all the time to qualify them for employment yet in my personal experience shy away from codeplex as "msft only". If the goal is to help people gets jobs - and I am all for that as I am actively looking for work right now - then lets follow the social trends. I would even be ok with paying for a project github and could have it up in a few minutes once I knew it was needed,

That brings me to my next issue; How do you see yourself in your current manangerial role? I see a more managers listed than I do developers even after the clean up; and honestly it looks like its just me and you if you don't count Hector who has not said much. What is his role in this? What is he working on? or is he "stepping back"?

Thoughts?
Mar 1, 2015 at 12:04 AM
(I'm using Visual Studio hotkeys for all my examples.) F12 is not about building, it's about effective code browsing. Suppose I have the following line of code:
var widget = WidgetService.Instance.TwistWidget()
Generally the fastest way to find and study the implementation of the "TwistWidget" method is to have the cursor on TwistWidget and press F12.
However, if WidgetService.Instance returns an IWidgetService instead of a WidgetService, then F12 just took you to the Interface Definition instead. From there, you are derailed, having to find all implementations of IWidgetService (move cursor, Ctrl-K+R) (hopefully there is just one real one and possibly a mock for testing) before you can then find the real implementation's version of TwistWidget. Normally, when you are done studying TwistWidget you can then press Ctrl-Minus once, but in the case of chasing down an interface implementation, you probably have to do it several times. Basically, it's easier to get lost or even lose your context on those little side excursions. So concrete classes increase browsability while interface shims increase testability. I think we'll need to find the right balance, and use interfaces for the right reasons. (Personally I think interfaces are great for multiple implementations of a shared concept like IDisposable, but not for interfaces that exactly parallel a concrete class, etc. As with anything here, I'm open to discussion and compromise.)

Of course there are lots of parts of the codebase I am not happy with. That's the case with pretty much every codebase any coder ever touches. :) I wish I had more time to take us further in the directions that I do see working quite well, like the Behaviors system and standardizing on using the document database solely/correctly instead of a hybrid system, etc.

On supporting the hobbyist coder and solutions... I disagree about removing the extra solutions, as they're easy to ignore. They do increase accessibility to hobbyists though (also a core goal); we've had a good number of contributors here over the years who only got involved because we had the SharpDevelop or MonoDevelop solutions ready. There are a lot of hobbyists who are anti-MS-stack for example. I wouldn't be opposed to documenting that the core team doesn't necessarily support/certify their function at any given moment... that we recommend using VS. Maybe, when we get our 2013 solution(s) in order we can consider moving all other solutions to an unsupported solutions folder or something? Or you may be right. I think we can revisit after 2013/2015 solution(s) are in order. (I haven't been following 2015 yet.)

I agree github is bigger. I agree their source control strategy is a better fit for the long-term WheelMUD vision. When choosing where to migrate WheelMUD, I seriously considered github. My biggest problem with github though is that it isn't social. Sure they bill themselves as "social". "Social" development though requires strong Communication. Important conversations Like This Very Conversation We're Having. :) But where in the 2015 are their per-project forums? They don't even have Private Messaging. Imagine not having email and not being able to have discussions or even meetings in the workplace; suppose you are given only Jira and commit comments as your "communication tools" - a myriad of failures, inefficiencies, wasted work surely follow. The forums have been absolutely integral to WheelMUD's survival so far. So with that in mind, do you have any solutions or alternatives in mind? A particular free secondary site for forums? Or SourceForge I suppose? I'm all ears, and now is the right time to adjust this since I haven't yet written the software to transport the old forums contents.

I see myself as the "project champion" - I love being in the code, but also dedicated to the administrative/managerial stuff because I really want this to succeed. Hector has stepped back for now.
Mar 1, 2015 at 4:57 PM
I guess not everybody uses resharper, eh?

My commitment on any project I am a part of is to be able to make a build in one step. I'm also a big fan of code coverage, letting the debugger do its work, and HAVING A CD or CI system running.

I'm not happy with the code base either. I came back to I'm not sure I want to fix. Interfaces for things is a Good Thing. Read the book "Clean Code" if you have not already.

Not easy to ignore becouse supporting them (or not supporting tehm) creates bugs and additioanl build work. Its effectively an additional platform to support. And If they are Anti MS stack in their ignorance they should not be involved with a C# or Windows code base because that is what this is. I'm more than happy to help educate people but I'm not interested in this project being slowed down by all the extra work that really isn't needed to be done, yet poeple want just to make a vocal minority happy. C# as a language is inherently opensource (it just compiles down to bytecode, that can be reversed easily just like Java) and the C# .NET core itself has also been opensource'ed by MSFT and they didn't have to do that; If some kids want to be ignorant let them, you can't force people to educate themselves, but I'm not very interested in helping spread ignorance or hate.

As a note: I'm somebody who started out in opensource community myself and yet has worked at MSFT as well (Yes, I have code in both Linux and Windows, that is just one of the places I have been these past 5 or so years) so I find the entire needless anti-msft thing sort of stupid as somebody who came from OSS myself and then had to make all the mental shifts that happen when you look around the people on your team and think "Wow, they are smarter and less evil than the Linux guys painted them out to be." or "Oh look its Bill Gates , get out of the way and let him use the coffee machine.".

I vote for getting our solutions consolidated together, and moving everything to a single 2013 solution file since its now free.

Github may not be as social as you want, bu tits still more social and more socially acceptable than Codeplex, especially if you are a hiring manager who wants to look at your work/profile before making a choice to look at a resume. In all seriousness the main reason I want us to move to github is so that I can improve my profile there and make myself more employable. These sort of talks happen as part of merge request discussions; these talks can happen about requests to merge documentation as well :)

If that s ot good enough for you, I own GameDev.com and might be interested in giving us a sub-domain. How does http://wheelmud.gamedev.com sound?

Source-forge is where open source projects go to die.

For an open source project I am happy to do everything out in the open.

OK if your goal is more management/champion I highly recommend you pick up a few books:
  • The Clean Coder By Robert C. Martin
  • Drive By Daniel Pink
  • Agile Principles, Patterns, and Practices in C# - Robert C Martin and his Son.
Mar 1, 2015 at 8:33 PM
Correct, although resharper is popular and useful, MS was not far behind in bringing their own take on many of the missing features to VS. So even though I know I have less power overall at my fingertips by omitting resharper, I consciously choose not to; The value I gain in being able, as a lead/senior developer, to sit down at coworkers' computers and have all the hotkeys and navigation tricks I've been picking up still work every time, very much outweighs the value loss from omitting resharper. That said, if resharper has a single hotkey "browse immediately to the only concrete definition of this method rather than the interface definition" then I would find it worth looking into again for certain codebases.

On commitment to having CD/CI: You have me excited here! This is a huge gap left behind in responsibilities that Fastalanasa took care of for us on our old servers, so your timing is perfect! Agreed, these things are all hugely important.

Interfaces are indeed generally a good thing. Unfortunately at the time that the interfaces got ripped out, there was no code that used them any different than they would the exact-mirrored concrete class; no tests that used the interfaces for mocking benefits, no reasonable DI, etc. Basically, we had only the downsides. I would look forward to interfaces being actually used well. Shall we plan on taking that direction?

On "I'm not sure I want to fix" - What is an aspect you would like me to focus on ASAP? Would you like me to give a shot at getting one of our singletons into a state that is both interface-friendly/test-friendly and F12-friendly?

I didn't actually mean to open the can about why or whether the MS-haters have any foundation. (I have worked there for 4 years - it's always interesting to see both sides of such a divisive coin.) I'd rather spend our time discussing the other issues. :)

Ok, we can move to a single VS 2013 solution.

We may disagree on what it means to be social. You have listed great reasons to be on github, but we need to solve the forums issue. Github has no place for design-oriented and project-management-oriented discussions. Nowhere for the discussion we're having now. No good way to avoid redundant work. For agile, no way to sprint plan as a group. No way to release plan as a group. No way to ensure that, if I work on feature X, that they will even want it and take the PR. "Code first, discuss later" is just wrong; it leads to heartbreak. Abusing documentation PRs to try to get them to behave like forums is not appropriate, probably not "keyword searchable" on the site, etc.

So yes, perhaps I move the code to GitHub, and move our Documentation pages into a nice project ReadMe structure. Meanwhile, if you are willing and interested, you could figure out hosting forums and CD/CI through wheelmud.gamedev.com. Then we make our link between the sites very apparent.

Hehe, I've never actually participated on a source-forge project yet. Good to know!

I've read the first book, never heard of the second, and the third book is on my list already. Thanks!

Finally, I want to make sure we're getting off on the right foot. Seems like we're both in WA. I'll PM you.
Mar 2, 2015 at 4:10 PM
Resharper has had a lot of updates. I highly recommend you check it out; the productivity boost
I get when looking or maintaining code bases and I need to ramp up on them fast is amazing.

As you can see from the emails we have been exchanging, I have a lot of experience in CI/CD. I'm actually starting to look into Docker and other containerization formats as well just for fun.

Well you mentioned being a lead in your current role and you want to be champion here; Leaders lead by doing, so if you want to take the lead and re-factor one of the Singletons if anything it would give me a better idea if what you have in mind. I said the "I'm not sure I want to" bit because I'm actively looking for things I can do to that can be used to show potential employers.

Yes been here at MSFT too as you know. The back and forth got tiring, and now that I'm trying t stay away from MSFT as I believe staying at MSFT would long term be a dead end for my career, I'm looking for any way I can to find a spot that I can leverage my skills yet not be at MSFT.

GitHub is more code focused and codeplex is more PM friendly project focused. If we have a disagreement on what social is, I want to learn both sides so I can understand that issue better. I get what your saying in terms of having a dedicated forum but I have seen some epic threads on github merge requests that settled or talked about these same sort of issues. Its just not upfront. I do agree that github is lacking a forum and I think its one of their most requested features. http://programmers.stackexchange.com/questions/87049/how-come-many-project-hosting-sites-dont-have-a-forum-feature

I will start to look into the sub-domain today between my normal "looking for a job style activities".
Mar 3, 2015 at 8:08 AM
Edited Mar 3, 2015 at 8:18 AM
I hammered out two spikes for being able to test behaviors that depend on singletons, while maintaining browse-to-definition. I checked the source into src\TemporarySpikes\TestSingletonSpike. Of the two, I like spike2 a little better. It's not perfect but it might be a good balance? Curious what you think, if you get a chance to check it out.

Unfortunately I've been burned repeatedly by open source projects that lack in preparatory/design discussions... I would build a feature and make a PR which would promptly die, even though it is solid code and what I believe fits in the codebase or ideal feature set... or have to rewrite the whole thing again because they didn't Communicate that they were rewriting the part of the code I built my stuff on top of (and of course pull their own sweeping changes first even though they finished it later), etc... Having learned from those heartbreaks, I would much rather be able to communicate up front "Hey I'm planning on implementing Issue X in this manner this or next weekend... Here's my understanding of what I think the Issue is and what users will want... Are my assumptions correct? Is that a reasonable approach which will likely lead to a successful Pull Request?"

Also, WheelMUD has a ton of wonderful design threads and the like, and many of those personable threads you were reminiscing about wouldn't have been able to happen on github. :) So yes, I'm liking the move-to-github idea - we can figure out a solution for up-front communication; whether we figure out some decent forums software to host through the subdomain, or some other reasonable hosted services to link between. Heck we could link these codeplex forums (but IMO they're not very good and that would probably be confusing).
Mar 5, 2015 at 7:52 PM
I get it. I enjoy the forums as well if only because you can allow life the time it needs and then come back to the forum when you have the time/mental energy.

I can add a wheel-mud sub-domain easily but after thinking about this more I cant help but wonder how that is going to end up. I'm getting the sense that its just you and I actively interested in this right now but I also feel like Hector wants to be involved, or cant be but doesn't want to let go. I'm not sure of the status of this so I do not want to make assumptions, but these are the things I am feeling based n the very limited data have right now so I want to be open with my thoughts and ask for feedback/confirmations.

Its clear to me that we need a decent forum; Its also clear to me that codeplex didn't really put a lot of thought into the forum they provided. Perhaps that should be the first step?
Mar 6, 2015 at 2:03 AM
The http://muds.gamedev.com/ domain is up with a forum, if we need a wheelmud subdomain just ask but I was thinking more general talks about mud development would bring in more people.