//TODO: professional stuff of software engineer 1001010
Showing all posts by Jason
flask & pycharm

For a research project at work, I wrote up a quick web service using Flask.  Sure, it’s not as powerful as gRPC.io – but it doesn’t need to be.  I just needed a quick and dirty RESTfull server that any app could connect to.

Two things impressed me

  1. the nearly flat learning curve – thanks in large part to the availability of docs
  2. and PyCharm‘s support for it.

Now the only thing that bothers me is my slow slide to the dark side.  C++ has been my bread and butter for many years, but with Python – all the things are already there.
Want a URL downloader in C++? Find cURL and learn how to integrate it.
Want a URL downloader in Python? pip install requests

Python scripting is way too easy. I have got to get over my biases against it.
My next personal web project will probably be in Flask

Note to future self

  • https://mattcarrier.com/flask-dreamhost-setup/
  • https://github.com/kennethreitz/requests
Weekly code review template

With 8 engineer employees that report to me, I spend a lot of time in meetings and meetings and code reviews and 1-on-1’s.
Coaching so many on multiple projects, as it turns out, takes a lot out of your day!
Here’s the outlook meeting template I use for weekly individual code reviews with my staff. I find it useful to set clear rules so that we don’t waste each other’s time. We’re professional software engineers and we talk about the architecture and not line by line accuracy or holy wars over tabs/spaces – that’s what per commit buddy checks are for 🙂


 

Hello %USERNAME%, This time slot is your time slot for us to review your code.
It may get moved due to schedule conflicts, or illness, or emergencies, or whatever – but we will strive to do this EVERY WEEK.

What this is NOT:
•       Painstaking analysis for perfectly formatted code
•       Checking for C-style off-by-one errors.  I expect that you will test all your code in a debugger & you will find that type of error anyways.
•       The Spanish Inquisition
•       A replacement for buddy checks before each commit.  Buddy checks are required for every commit.

What this is:
•       A professional discussion of the structure and effectiveness of your code
•       Feedback on the readability of your code.  I follow the 3am rule: can I read it at 3am? (..after being woken up by GNOC because servers running it are crashing and everyone is screaming over losing customers and getting bad press)
•       An opportunity to teach me about how your code works

What I hope to achieve:
•       We will both Learn and Grow as software engineers
•       Higher quality code
•       Shared knowledge of how your code works

Format:
•       Show me your work since our last review (usually a week)
•       Talk me through it – Think of me as a rubber duck (http://blog.codinghorror.com/rubber-duck-problem-solving/)
•       I will provide feedback
•       You will take notes
•       If I am wrong, you will tell me why. I do not know all.
•       You will make changes as needed after the meeting.

-Jason De Arte

value is not identical

Or: Fun with error messages!

Let‘s start with some crappy code I wrote in the Playground as I was going through the Swift language book.

let dict = [String:Float]()

dict
dict["Bob"] = 1.0
dict["Joe"] = "dude"
dict

Guess which dictionary insert line generated this error?
'@value $T5' is not identical to '(String, Float)' 

(insert Jeopardy suspenseful waiting music here)

If you’ve never written Swift I’m sure you’re probably at least partially right,
it was the “Joe” insertion

..and it was also the “Bob” insertion!

There are 3 problems here

  1. Mine: The dictionary is a String:Float, so setting a String value is wrong.
  2. Mine: The dictionary is “let” not “var“, so it’s read-only. Insertions are not allowed.
    The quick fix is to make it “var dict = [String:Float]()
  3. Swift: It’s a crappy error message. If it’s read only – then say it’s read only.

Dear Swift Language team at Apple,
When a user assigns a value to a read-only variable, please tell them root problem – not the immediate error message.  By being cryptic & indirect – you are reminding me of C++ template errors.

XOXO
-Jason De Arte

Swift Playground setting dict key values

Google Image Search – that’s not me

You’ve googled yourself – but have you image searched for yourself?

I did and google thinks that I looks like a bunch of weeping angels that like to scuba in shallow tropical waters.  Too bad I tried scuba & sucked at it – but at the same time – it’s kinda cool in a way that I don’t think I want to fix it.

Rather than link to the individual images here & reinforce google’s mistaken view of what I look like, I leave it as an exercise to the reader to find the cool underwater statues using my name

 

– Jason De Arte

Fix’n Array type syntax on the fly

Apple seems to be raising the bar on auto correcting code editor UI

From the code in the swift book

let emptyArray = String[]()

Soon after I typed it in, Playground prompted me to use the new syntax – AND FIX IT IN PLACE
A quick click transformed it to

let emptyArray = [String]()

Nice Apple, very nice.

Swift Playground Array Syntax Change Notice

 

 

Now if they would also do the Auto “Fix-it” for dictionary declarations 😉

 

-Jason De Arte

Previous Page · Next Page