Skip to main content

Posts

Showing posts from June, 2020

Permutation Algorithms: Finding the Highest Discount Between Coupons

When trying to determine which coupons, in which order, can offer the highest amount of discount across a basket of products, a permutation algorithm is required.  A permutation algorithm calculates and returns all possible arrangements of a given set of items, where the order of those items are unique.  In my research, I selected 4 permutation algorithms - Lexicographical, Heap's, Steinhaus-Johnson-Trotter-Even, and Recursive. They deliver perfectly unique permutations for my given set of coupons, but each does this in their own way. I picked these 4 to test for robustness and performance. All performed relatively quick, but do keep in mind - the use of a permutation algorithm is not for the faint of heart. It's big-O notation is usually O(2^n) or in this case O(n!), which means for just 4 items, 4 x 3 x 2 x 1 = 24 permutations; 5 items = 5 x 4 x 3 x 2 x 1 = 120 permutations. Therefore, it's a good idea to keep the number of items in your list as low as feasibly possible. ...

Helpful Reference: Using cURL

I create endpoints a lot for other systems (or end users) to call and get some data or to start a process. Because of this, cURL is something I use to test my code quite often. I also like to add an example cURL call to my javadoc comments for each endpoint class. Note: cURL can be used for other data transfers (e.g. FTP, POP3, SMTP, etc.). (see  https://curl.haxx.se/docs/manpage.html ) Example cURL calls: POST with parameters: curl -X POST -d "param1=1" -d "param2=textVal" \ http://localhost:9090/server/api/endpoint with file upload and parameters: curl -X POST -H "Content-Type: multipart/form-data" \ -F "file=@file.txt" -F "param1=1" -F "param2=textVal" \ http://localhost:9090/server/api/endpoint/upload GET with parameters: curl 'http://localhost:9090/server/api/search?id=1&val=foo'

On Purposeful "Laziness" - Best Practice

Being a software engineer, some purposeful "laziness" actions are considered best practice techniques - no joke. Let me ask you a few questions to bring this topic into clarity: Do you like writing the same code in different places, and having to remember to change the code at each location if some workflow/data changes? Do you like to add the same fields/methods across all similar java classes, and every time you need to create a new similar java class? Then change each one if workflows/data requires it (e.g. data type)? Do you like to download lots of different 3rd party jar files, from multiple sites, to add to your project(s) capabilities and standardizations? Or better yet, maybe you like to reinvent the wheel and create custom classes other than use well-tested, peer-reviewed classes. If you said yes to any of those, please research reasons for code refactoring, best practices for polymorphism, interface and abstract class use, and use of dependency management/build man...

Perspective During Covid

It's been almost 3 months since my Shelter-In-Place order began in March. With that came the stark realization of what is considered "essential businesses". Were you a part of an important group that your community deemed it could not live without? Or are you "non-essential" - meaning, sorry - you no longer have a job. I can imagine that is a tremendous blow to someone's view of themselves and their worth and livelihood.  My job as a software engineer at a digital coupon platform business, seemed "essential" at first. I have been able to successfully work from home without problems, I don't need to interact - face-to-face - with the broad public to do my work properly, and I assumed digital coupons were here to stay. Well, assumptions can and, by good old Murphy's Law, often go awry. I have been grateful for being able to continue to work, but because of the current state of retailer supplies and the shopping habits of present-day customers...

Budgeting For A Digital Offer

When a retail company wants to encourage consumers to become loyal, repeat customers, they employ various types of promotions. Promotions give customers a feeling of being special, offering usually a select "few" to special pricing, discounts, or even freebies. Who hasn't returned to their favorite store after receiving an offer of $2 off your favorite ice cream? I hear crickets... Who absorbs the discount cost offered by a promotion? Sometimes manufacturers take the hit as they try to encourage customers to try out a new flavor or line of products, or to encourage their continued relations with retailers (if a manufacturer's items are not flying off shelves, that shelf space will be allocated to another). Sometimes retailers take the expense on themselves, or sometimes it's a little of both. Either way, it can be a heavy investment for these companies and any expense needs a budget. As a software engineer for a digital offer platform company, I was part of a smal...

Resonating Quote of the Day

Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - by Rick Cook (The Wizardry Compiled) I plan to be part of the team that evens the playing field...better yet, a win for software engineers!

It All Starts Somewhere

A story, good or bad, starts somewhere. Here's mine. This blog is about me, Kathleen Franz, and my programming history, so I'd say that story started over 15 years ago, when I learned the basics of front-end and back-end coding.  When I lived in Germany for 4 years, not only was I able to learn the culture, language, and history of such a beautiful country. I was also able to attend Makromedia Akademie where I started my programming journey. It was probably at the height of Macromedia's rise in gaming, animation, programming fame with ActionScript and timelines, which made it all the more glorious for me to learn from them. They taught us front-end and back-end coding basics, with our end project being an e-commerce website. Thrilling! At that point I knew I was hooked. In early 2000s, I moved to the San Francsico Bay Area with my husband and knew I wanted to get into a job programming something. I started doing some front-end work with pure HTML, CSS, and JavaScript (okay,...