HNHacker News
TopNewBestAskShowJobs

thomk

987 karma · joined July 13, 2014

submissionscomments
thomk··on Object-Oriented Design Heuristics (2017) [slides]
I try to follow a few rules when writing OO code.

1. Make classes do one thing that is basically summarized in the class name. (This also takes care of 'separation of concerns')

2. Be careful to not over-abstract. That results in many tiny classes, aka ravioli code. Nobody, not even you, will remember what all those little bastards do. 3. If a class is bigger than a page (or two) of code, it's probably too long.

4. Design patterns are for inspiration, not the law. Solve problems, don't prove how smart you are.

5. Make your classes as simple as possible. You will thank yourself later.

6. If you have to write a comment that explains how some confusing thing works; that code block is a good refactoring candidate.

7. Refactor, refactor, refactor. Refactoring is rewriting code for clarity. The more you do this, the more your code will become clear to the reader. I find refactoring often reduces my LOC drastically.

8. If you just learned a technique/pattern and that technique/pattern is suddenly popping up everywhere in your code; make sure you aren't just using it because it's fun. Say you just learned what a singleton pattern is, now your code is littered with singletons. That's a good sign that you are forcing yourself to use your new found toy and reconsider.

9. Long method names. Don't be afraid to have long method names. Yes, it looks ugly, yes it takes time but you will thank yourself later and often a long method name will compensate for the lack of documentation on that method.

10. Your program should basically be a bag of loosely related, self-contained components. Think of them like parts of an engine, they each do one thing very well and they each have an interface to the rest of the engine. Also, they can individually be swapped out for another component (as long as they bolt up to the engine appropriately).

Understanding OOP is definitely a paradigm shift in thinking and it is also loaded with many a foot gun (especially when you are new).

thomk··on Ask HN: How do you take notes when reading a book?
I circle, underline and star things that I feel were noteworthy directly in a book. One day when my son inherits my books I want him to know what I thought was interesting. I also write in the margins (or wherever there is space) if I must write something.
thomk··on Ask HN: Should I switch from software eng if I want to be an entrepreneur?
Don't switch. Having a skillset like software development will help any other endeavor when the time comes. If you are good enough at coding, and you like business, sooner or later you'll learn what you need to learn.
thomk··on How many of you know that the team is working on something that no-one wants?
You work in a fortune 100 company, welcome to bureaucracy.

Those middle managers do not give a shit because they are middle management! Big companies have tons of people like who's only motivation is to simply not get fired (this is one point the movie Office Space nailed by the way.)

A fish rots from the head. If your executive leadership is not obsessed with its customers, nobody else will be. And you guys will continue to be rudderless which is demoralizing.

Big, fat, companies get lazy and that sucks for a guy who wants to make a difference. Go work somewhere that encourages logical (black/white) thinking and values engineers who want to turn customers into raging fans.

Or just work each day enough to not get fired, and build your own product on the side.

thomk··on Helvetica, a documentary
I love this movie. Its well done and some of the characters in it are self described nerds. Typefaces are a fascinating subject one you start to get into them.

"Hacker News" typeface in the upper left (which I believe is Verdana) does not have any serifs on it. Serifs are the extra little points and tails on letters. Hacker News body font and logo does not have serifs, therefore it is sans-serif. 'sans' meaning 'without'.

Sans-serifs are also called grotesque (or grotesk) because it appears as though the letters have had limbs amputated. :D Or at least that's how I remember the term. People definitely though they were ugly when they first appeared.

Text written in a serif typeface is considered more distinguished and authoritative . Imagine the bible written in the same font used on HN here, it would look odd.

Isn't HN authoritative and distinguished? I'll let the reader decide. However you should consider that you are reading the word 'fart' right now in it.

Fart.

thomk··on Helvetica, a documentary
Actually a font is a file on a computer, Helvetica is a typeface. Does that help? :D Probably not.
thomk··on Guide to Python Debugging
I'm a vscode user and I do like it. I only really use it for the file navigation and color coding though. Autocomplete drives me nuts, so I turned that off completely. I am a pdb fan so i drop in to that when needed. I never really considered PyCharm to be honest, it feels like overkill for me.

However your allegiance sounds interesting. Can you give some reasons why you like it so much?

thomk··on Trump threatens to 'close' down social media platforms
The same way we do it with email.
thomk··on Americans, it turns out, would rather visit a store than buy food online
This brings up another question in my mind.

You are examining 10 apples, well, so is everyone else. So all that fresh fruit has been held, bare handed, by the person who picked it, the person who loaded it and x number of customers who've examined it.

Not that ordering fruit online eliminates that problem but it seems like it would be a little more hygienic. One picker, one loader/examiner.

Maybe we need a better way to see germs so we know when we are done removing germs.

thomk··on “Become Abnormal”: traits to cultivate for top performance
I'd also like to amend my comment from "God doesn't exist" to "We don't know if God exists".
thomk··on “Become Abnormal”: traits to cultivate for top performance
Sure. For example: I value honesty and hard work. If I am honest and am working hard I am living with integrity.
thomk··on “Become Abnormal”: traits to cultivate for top performance
You completely missed my point. Here: God doesn't exist, I'm in competition with myself only, I can't control the outcome or anyone or anything at all including my emotions, only my individual behavior.
thomk··on “Become Abnormal”: traits to cultivate for top performance
Well that depends on your value system. If you define your own value system, you decide where you are. If you get a value system from someone or something else: they decide.
thomk··on “Become Abnormal”: traits to cultivate for top performance
That's right. I can not control anything at all except my own behavior. Exactly right.
thomk··on “Become Abnormal”: traits to cultivate for top performance
Thank you for your comment, yes it is hard.

So what you are saying is God built failure into me intentionally. Therefore I could just point to that and say "Well I failed because I was prebuilt knowing I was going to fail". I don't accept that. I say "I failed because of something I, personally did not or could not do yet. I will correct that. It's not divine, it's just work and it's on me."

thomk··on “Become Abnormal”: traits to cultivate for top performance
Your points here are exactly why I am no longer religious.

Also, if you are easily offended, I'd skip the rest of this, I do not want to offend anyone, these are my opinions alone.

If you worship any God, then you can never be as good as your God. You can never be #1 even after you die. The whole framework sets you up for a life of the inability to win. You are at BEST going to be #2 because you can never ever be #1. Every religious person who worships a God is going to feel like they are a loser; because they are not and never will be #1 a 'winner'. It is exhausting.

I have not had a good experience with Christians in my everyday life. I'm sorry to say that, but when I meet someone and they tell me they are Christian; I immediately become suspicious of them. I have learned this from many, many interactions.

I think it has something to do with comparing yourself to God. "I am not #1. Sometimes I am close to #1 and sometimes I am very far from #1. When I am far from #1, maybe I steal a little or lie a little. I know I can get closer to #1 later and be forgiven (by the true #1)."

It's a sliding scale. There's no permanence.

They only way to win that game is to not play. Once you realize that not only are you already #1 there is no #2. You are responsible for you. That means you live exactly by your own personal values. For me it means I never lie or steal and that decision is not based on how I feel about myself!

I have a friend who is a Buddhist monk. We were talking about emotions recently and she said something I now think about every day: "You can't control your emotions. Don't even try, they are far too powerful. You can only control your BEHAVIOR."

I am in control of me. Nothing else is in control of me, not even my own emotions. And since I am in control of me, who else is to blame if my life is not working out?

That's not American my friend, that wisdom is ancient.

thomk··on Negative News Distorts Our Thinking
Conversely, happiness appears to raise IQ: https://www.bbc.com/news/health-19659985
thomk··on Doordash and Pizza Arbitrage
How has your experience been with privacy.com?
thomk··on Turf war: Detroit Mower Gang competes in 12-hour playground cleanup
Detroit has more crime than 99.2% of cities in the US: https://www.city-data.com/crime/crime-Detroit-Michigan.html
thomk··on Turf war: Detroit Mower Gang competes in 12-hour playground cleanup
I have been to hundreds of events in Detroit. I know the type you are talking about, I am not them, I love Detroit.

The unfortunate truth is there are 20,000 cities in the US and in 2018 Detroit ranked #3 for murder. Detroit has more murders than New York, Los Angeles and Chicago combined. You live in a dangerous city and it's not because I said so.

My guess is you guys are new to the city and you live in a nice pocket. That's great for the city, thank you. I used to 'run around' the city in the 80s when it was twice as violent and I too was never harassed because I too could afford to live and play in the nice areas.

I'm not talking about me and you.

thomk··on Turf war: Detroit Mower Gang competes in 12-hour playground cleanup
I have lived near Detroit for almost 1/2 a century. Downtown is one of the pockets that are nice. Detroit has nice pockets, the stuff in between is where you don't want your car to quit on you.

Detroit is a big city; like 140 square miles. The vast majority of that land are neighborhoods that are high crime. It's been that way for a long time. It is changing slowly but mostly around the afore mentioned pockets.

thomk··on Turf war: Detroit Mower Gang competes in 12-hour playground cleanup
Detroit, the city with the most violent crime per capita in the US, has also now been ravaged by covid-19. Most of the residential neighborhoods in Detroit are fucking terrifying for ADULTS. These guys are cutting grass in public parks so poor kids have something to do. They should be applauded because poor kids will have a place to run around and laugh for the first time in months because of volunteers.

I have seen some comments here complaining about wildlife not having a place to live close to humans.

You know what else thrives in high grass? Ticks and rats. And if a lot is abandoned too long in Detroit there's a good chance it'll accumulate dead bodies.

Screw your wildlife.

thomk··on Build Software from Front-to-Back
I was just thinking something like this as well. The best term for it is 'schema' but that moniker seems so, ill-fitting. For lack of a better term the 'schema' isn't really designed, it's discovered.

Thats how I know I'm on the right path. I start to organize the data and new things that appear fit naturally into what I've already discovered.

This is the epitome of organic design because you are simply the conduit between the truth and a schema definition. If you force yourself to not be clever and just interpret what you've found, your database model will be solid.

thomk··on Ask HN: I've been promoted to Architect. What do I need to learn/do to excel?
#1 Put your absolute focus on getting things finished.

That can be much harder than it sounds because first you have to master the skill of defining what 'finished' means. Speak with the stakeholders and, without judgement or resistance, find out what it would mean to them to be 'done' with this project, phase, milestone, whatever.

Let them tell you. The business people should make decisions about the business. They set em up, you knock em down.

#2 Strategize on how to get it finished. Once you have an agreement on what 'done' looks like, then talk with your team in a casual environment with a whiteboard present. Ask your team: Here is our task, what is the best way to get this done? Call on the members of your team who are quiet. Do not mistake being quiet for being out of ideas. Those guys just need a little encouragement to speak up. People say 'there are no bad ideas' that's not true, of course there are bad ideas. However, the environment and tone that you want to set for this meeting is: There is no NEGATIVE JUDGEMENT for your ideas. Get your guys to feel comfortable to spill out everything. Your job is to collect the gems.

#3 Assemble the document. Get those gems into some sort of order that ends with you being done (see step 1). This is the 'architecture' phase. You have the task defined, you have the 'how' defined, now you assemble it into a document that you give back to both the stakeholders and your team for corrections. Repeat as necessary. Group the tasks into phases/sprints. Show your work to the stakeholders on a regular basis. If they change course because of that, go back to #1. It'll be faster this time.

#4 Delegate Do your absolute best to give away as much of that work as possible. This will free you up to both help and coach the development team and to update the management team. If you are heads down in code for 50 hours/wk every week, you are not leading, you are coding.

If you are going to code, abstract up the hardest part of the project and code that only.

--

TL/DR: Train yourself to find the shortest path to done, which often means not using your favorite technology. Part of being a mature leader means to know when to be non-biased and to follow the natural flow of project requirements and staff acumen. Don't force that, listen more than you talk at first. Gather information and then produce a document that echos your decisions.

thomk··on Most detailed ever photograph of The Night Watch goes online
Nerdwriter covered this expertly: https://www.youtube.com/watch?v=5E8f64yj1Jk

Nerdwriter is an amazing youtube channel where he does breakdowns like this of all kids of art, film, celebrities, etc.

thomk··on An Insomniac's journey to regular sleep
I have struggled with sleep my whole life. I can't sleep, I'm a light sleeper and I almost always wake up tired. Not long ago I started making massive changes to help myself sleep. I get up early, I don't eat late and no screens a few hours before bed and I'm good. If I'm worried about things, I write out a list on paper so "I won't forget about them".

If I exercise I get better sleep, if I eat a good diet I get better sleep.

Not sure we need an app for sleep. It kinda feels like a solution looking for a problem.

thomk··on Why are some people better at working from home than others?
Our solution is that I go to bed at 8pm and get up at 4am and work like mad until breakfast which is around 9am. Thats 5h of uninterrupted coding time, which is about the max my old brain can handle anyway. The hard part is doing 'working hours' business, but hey, I just email everyone from the potty.

Sorry, ahem, bathroom.

thomk··on Write Libraries, Not Frameworks
Stuff like that always makes me feel like someone has turned off their logical reasoning and they are just basically creating code that fills in some personal mental gap that somehow 'completes the set' of the things they are working on at the moment.
thomk··on Power Bends Light (2019)
You might want to check out 'The Effective Executive' by Peter Drucker. It sounds like you are in the perfect place in your career to read that book. It's a quick read and a short book.

Let me as you a question. A waitress comes over to you at a Diner as says "What can I get for you?". If you tell her, are you 'ordering her around?

Maybe try to reframe your perspective a bit on your subordinates. They probably depend on you to give them work to do right?

You said something interesting there; your 'bulldoze' comment. Without discounting the fact that there are bulldozers out there, a lot of the time that is more akin to just having confidence that once you hit a roadblock you'll 'figure it out because you always do'.

One thing in that Drucker book that always stands out to me is he says something like: You are in charge to make the hard decisions. The easy decisions make themselves.

thomk··on Write Libraries, Not Frameworks
Did you ever see his YouTube channel? It has exactly one video and it is awesome: https://www.youtube.com/channel/UC65NUFfqjWn3y02kYYl9nSQ
← PreviousPage 2 of 10Next →