Name-on

But Y tho?

I needed a unique name generator, so I built one.

I had used the Heroku unique-name generator before, when building bad ideas. I loved how it removed a mental hurdle from getting something out the door; coming up with a name. Personally, I’m horrible at naming things, so this was a necessity. I don’t want to get hung up on picking a good name, and the defaults are equally as bad (ConsoleApplication23, anybody?).

I’d also been wanting to get back to dot net core. The last time I had played around with it, they were still using the dnx command line tool and project.json files. So this project seemed small enough, and valuable enough, to actually keep me on task for the duration of v1.

The command line

I was stoked to be able to layout the project structure from the command line. I’m just so much more optimistic about a tool when there’s a CLI behind it. Even if I’ll never script it, the idea that i could is very appealing.

I scaffolded the whole project via the dotnet new and dotnet add commands. I was also able to build and test in the same manner. It was a nice break from VS 2017.

Structure

I found lists of adjectives and nouns online. And thank to some recent practice with regex crosswords, quickly stripped everything but the words themselves.

I added some tests for uniqueness, which is about 99.985%. I also added protection for never getting the same name twice in a row.

I was able to create a CLI for OS X, which was came in handy when publishing to Azure, and needing names for everything.

For the web app the dotnet help lists a template called razor with the description “mvc with razor pages.” I’ve used the Razor syntax since it debuted, and thought, “of course I want razor, not aspx.” Apparently though, Razor Pages is a new thing. I actually really liked it for build the web app component. I still created a controller for the API, but was happy I stumbled onto this new paradigm.

I really went over the top with the completeness. Azure for hosting. Custom domain through NameCheap. SSL through CloudFlare.

Next Steps

The README has a roadmap, which includes packaging the CLI and improving the site. PRs are welcomed.


Adventures in vs Extension Updates

While at //build I was inspired to update my extensions to support VS 2017. I meant to do it last year, but got distracted. The process was really simple, and is outlined on the new hotness that is MS Docs. It took me about 10 minutes to get it all configured an tested. But then…I was sidelined by my CI config.

For some reason, my AppVeyor builds were failing. They were clearly pulling the latest from my repo, but for some reason, the nuget restore stopped working. I probably should’ve googled the issue, and I think I did, but I was asking the wrong questions. I finally gave up and manually configured the build via the GUI, and then exported that config to YAML. When I went to do the next extension, I finally realized what the problem was. I used the exact same exported YAML, and got the exact same initial errors with the nuget restore.

Googling “appveyor not using yaml” led me to this help article. I still don’t understand why permissions were an issue to read the appveyor.yml, when it was clearly reading an updated csproj file. But I do now have extensions that support VS 2017.


Data Driven

This video absolutely changed my life. My friend and mentor showed it to me in the beginning of 2015. The early experiences of Etsy immediately resonated with me. And the concept of geometric growth being outside of the control of the business was something that I had never before considered, but absolutely made sense.

Don’t pick projects based on what’s cool, pick projects that make sense to the company.


Product Development Manifesto

Five years ago, I ambitiously applied internally for a job as Director of Product Development. I agree that my qualifications were not appropriate for such a position. To overcome that, however, I wrote this manifesto, to show how I would handle the problems faced by that team.

When I stumbled across this the other day, I was afforded a chance to see if any of my plans had been adopted. Some have, most haven’t. When I wrote that piece, I was a dev manager. Since then I’ve been a Sr Dev and a Software Architect. I’m now back in the position of manager, and I’m happy to see that my personal views haven’t substantially changed. Of course, my opinions about Scrum, testing, and APIs have evolved, but my management approaches are consistent. Trust, Respect, and Accountability. Those three pillars are the foundation of good leadership.

If you have a chance, please read it. Send any comments to me on Twitter at @clintcparker.


C# Obfuscation

You can use the underscore to write ridiculous code.

__ is a valid class name. __ is a valid namespace. __() is a valid method. And, __ is a valid property.

I stumbled upon this a few years ago , but hadn’t gotten around to writing it down. It’s really fun to play with. I thinkt the next step is to create an obfuscator extension.

Here’s a simple class from when I was teaching intro to C# and demonstrating async and await.

using System.IO;
using System.Threading.Tasks;

namespace A_A.Library
{
    public class FileAccess
    {
        public async Task<int> GetLength(string filePath)
        {
            var sr = new StreamReader(filePath);
            var chars = sr.ReadToEnd();
            return chars.Length;
        }

        public async Task<int> GetLines(string bigTxt)
        {
            int lines = 0;
            var sr = new StreamReader(bigTxt);
            while (!sr.EndOfStream)
            {
                await sr.ReadLineAsync();
                lines++;
            }
            return lines;
        }
    }
}

Here’s it is again, obfuscated. Still compiles, still valid C#.


using System.IO;
using System.Threading.Tasks;

namespace __
{
    public class ___
    {
        public async Task<int> ____(string ___)
        {
            var _ = new StreamReader(___);
            var __ = _.ReadToEnd();
            return __.Length;
        }

        public async Task<int> _____(string ___)
        {
            int _ = 0;
            var __ = new StreamReader(___);
            while (!__.EndOfStream)
            {
                await __.ReadLineAsync();
                _++;
            }
            return _;
        }
    }
}

Thanks for reading.

P.S. Who want’s to help me write the obfuscator?