I don't wanna! šŸ˜­

So, Iā€™m working on my own little email templating system kind of like @hkeric.wci and @jgiese.wci

And Iā€™m going through and mostly cleaning up all my test code, and turning it into production code, because as much as I want to play with it, I need it yesterday.

I find myself going through and refactoring this little bit here, that little bit thereā€¦

Make this a helper Func<T>, etc, etcā€¦

And I keep running into, ā€œWell damn thatā€™s useful, it should be its own standalone function.ā€

So I do it.

And now Iā€™m tired. Because then you have to make that all nice and production ready too, because you know you will reuse it.

I just donā€™t wanna! :sob:

Sometimes I just want to build a big monolith and move on with my day.

Iā€™m gonna do it, but ā€¦

Dean Winchester Facepalm GIF

3 Likes

You finally got tired?

episode 9 GIF

1 Like

Its called Tech Debt! :joy:

Just go into debt solve the problem and come back and fix it later.,ā€¦ (says every dev ever who never goes back and fixes shit)

9 Likes

Not to mention, itā€™s hard to spend time on making things pretty when they go obsolete so fast, itā€™s hard to know if itā€™s worth it.

4 Likes

We call those Ugly babies in our company. I have a couple the biggest one is called PG Order is 2K-4K lines of C# code in a classic customization that only me and God knew what it did when I wrote it and these days only God knows but it runs 50% of our business so it has to keep running. We are slowly replacing it.

@Banderson has a couple of ugly babies on his side too it happens :man_shrugging:

5 Likes

Animated GIF

5 Likes

Been thereā€¦ done thatā€¦

Got theā€¦


Iā€™ve mostly learned my lesson.

1 Like

I had one in Vantage.

We called it RollMaster. It was a standalone app that tied into Vantage, originally just to manage getting inventory in like we wanted.

Eventually everything tied into it. It was pretty well designed, but it was my (not completely) ugly baby.

Ran 80% of our business.


I was both sad and ecstatic to see it go when we moved to 10.

1 Like

Sounds like a slogan for EpiUsers.

Ugly Babies: Code Only God and an EpiUser Understand, Keeping the Business Running One Line at a Time!

5 Likes

Donā€™t confuse ADHD with an abundance of energy.

I run on coffee and curiosity.

Me Inside ā†’

dying-hungry-and-thirsty

4 Likes

Here was the little bit that prompted the thread:

ReplaceStringsFromDictionary

  • Replaces strings based on a dictionary. Uses a regular expression or looping. Default regular expression is replace dictionary ā€œKeysā€ between braces " {Key} " with dictionary ā€œValueā€. Looping is a straight replacement of ā€œKeyā€ with ā€œValueā€.
//Helper Functions Section----------------------------------------------------------------------------------------------------------------------------------------->
Func<Exception, string, string> AddExceptionToList = (exception, exceptionListJson) =>
{
    List<Exception> exceptionList = new List<Exception>(){exception};
    if(!String.IsNullOrEmpty(exceptionListJson)) { try { exceptionList.AddRange( JsonConvert.DeserializeObject<List<Exception>>(exceptionListJson) ); } catch {} }
    return JsonConvert.SerializeObject(exceptionList);
};
//<-----------------------------------------------------------------------------------------------------------------------------------------Helper Functions Section


try
{
    Success = true; //Assume true

    var replacementDictionary = JsonConvert.DeserializeObject<Dictionary<string, string>>(ReplacementDictionaryJson);
    
    OutputString = InputString; //Preserve InputString for easy compare
    
    if(!UseRegex) // Looping
    {
        foreach(var item in replacementDictionary)
        {
            OutputString = OutputString.Replace(item.Key, item.Value);
        }
        
        return; //Done
    }


    //Regex
    string defaultRegexString = @"{(.+?)}"; //Replaces everything inside the braces {key} with value, including the braces

    //A regex was not prrovided, use default 
    if(String.IsNullOrEmpty(RegexString)) RegexString = defaultRegexString;
    
    
    OutputString = System.Text.RegularExpressions.Regex.Replace(OutputString, RegexString, match =>
    {
      if(replacementDictionary.ContainsKey(match.Groups[1].Value))
      {
        return replacementDictionary[match.Groups[1].Value];
      }
      return $"KeyNotFound( \"{match.Groups[1].Value}\" )";
      
    });
    
}
catch (Exception ex)
{
    Success = false;
    ListErrorJson = AddExceptionToList(ex, ListErrorJson);
}
finally
{
    //Log?
}

*Monolith

happy season 4 GIF

3 Likes

This is a hell of an assumption

Do or do not. There is no try.

5 Likes

Itā€™s nice to know that everyone has these things hanging outā€¦

3 Likes

I went back and forth on that one.

I figured I was more likely to remember to say I screwed up in the code, than say I didnā€™t.

Any actual exceptions set it false.

Itā€™s Friday. I was going full-on existentialist and life-choice-questioning with my comment. Success? Pah.

1 Like

Just popped on linked in and saw this lolā€¦

5 Likes

Dammit!

Going through here, just remembered I added the ability to add templates from templates likeā€¦

{MessageTemplate.LetterheadLogo} ā†’ {[TableName].[MessageTemplateID]}

where it pulls the body for another template into this one.

Guess Iā€™m breaking that out next. :rofl:

1 Like

This is called scope creep and if you donā€™t nip it in the bud youā€™ll never get anything done! :joy:

6 Likes

A little, but I do actually plan to reuse that piece.

(Of course my reuse may not fit very well, still evaluating) :thinking: