Red-Green-Code

Deliberate practice techniques for software developers

  • Home
  • About
  • Contact
  • Project 462
  • CP FAQ
  • Newsletter

Ignore This Advice

By Duncan Smith Leave a Comment Jul 29 0

Take My Advice

When you’re stuck on a programming problem for a while (everyone has their own time threshold), it’s customary to look for a hint. If you’re working on a competitive programming problem from a past contest, they’re easy to find. Problems on uHunt are categorized by algorithm, so that’s a big hint already. Popular problems often have editorials (I have written a few myself) or even complete source code in multiple programming languages. On the other hand, if your problem has to do with a programming language or tool rather than a puzzle, Stack Overflow is the standard resource.

But what if your problem is more general than a programming puzzle or language quirk? What if you have the type of question that gets closed on Stack Overflow? In other words, what if you’re looking for advice.

« Continue »

Java Lessons from uHunt Chapter 1

By Duncan Smith Leave a Comment Jul 22 4

Eclipse

This post is part of a series on Java syntax and libraries for solving the problems in each chapter of uHunt, a tool for competitive programming practice. You can find the rest of the posts in the series by visiting my uHunt Java post category.

A few months ago, I wrote two posts related to uHunt Chapter 1. The first post covers general lessons learned from completing the 39 starred problems in that chapter. The second one is a summary of the corresponding chapter of Competitive Programming 3, the companion textbook. Although I have covered Java language features in those and other posts, I thought it would be useful to provide an overall summary of the parts of Java that I found useful when solving the problems in that chapter.

« Continue »

Profiling Java Programs with VisualVM

By Duncan Smith Leave a Comment Jul 15 0

VisualVM

Last week, I wrote about ways to improve runtime performance for a Java solution to UVa 732. This week I’m going to cover a process for analyzing Java program performance using the profiling features of the VisualVM Java troubleshooting tool. But first, a note about profiling. As I mentioned last week, even a highly optimized program can fail to be accepted by an online judge if it uses the wrong algorithm. In other words, you generally can’t profile your way out of a slow design. Nevertheless, looking at a VisualVM snapshot of your implementation can provide some useful performance insights. Just don’t spin your wheels for too long making tiny adjustments to your implementation. You may need to go with a different design instead.

« Continue »

Implementing a Fast Solution to UVa 732

By Duncan Smith Leave a Comment Jul 8 879

Stone Stack

Programming puzzles are often designed in such a way that getting your solution to complete under the time limit is at least as challenging as getting the correct result. To create such a challenge, a problem setter can adjust the size of the input until sub-optimal solutions no longer run in under the time limit.

Many puzzles can be solved using both a slower but easier approach and a more sophisticated method that runs within the required time limit. Among the uHunt starred problems, 732: Anagrams by Stack is one in which people have found performance particularly challenging, at least based on the forum threads. As with previous anagram problems, and performance-sensitive problems in general, getting Java to perform at the required level can be especially difficult. While some online judges provide wiggle room for languages with more overhead than C/C++, UVa Online Judge doesn’t seem to use that policy.

« Continue »

The Problem With Codecademy

By Duncan Smith Leave a Comment Jul 1 0

Academy of Athens

I believe in the importance of practicing programming fundamentals, especially through programming puzzles. But puzzle learning works best when you already have some experience with the programming language you’re using to solve them. By prompting you to exercise a core set of programming fundamentals, puzzles help strengthen basic coding skills. To get those basic skills in the first place, you need a starting point for learning. For a few years now, coding instruction in the browser has been a convenient option.

« Continue »

Unit Testing the Java Class Library

By Duncan Smith Leave a Comment Jun 24 0

Latte Art Robot

Unit testing is a controversial topic in developer circles. Opinions range from Most Unit Testing is Waste to You are not allowed to write any production code unless it is to make a failing unit test pass.

For those on the pro-unit testing side, there are numerous benefits to the practice, especially the test-first variety. In my experience, writing unit tests does provide a net gain in productivity compares to programming practices that don’t use them. These are the benefits that I find especially useful:

« Continue »

The Puzzle Approach to Coding Mastery

By Duncan Smith Leave a Comment Jun 17 0

Puzzle

Programming is a skill that’s easy to start learning. You can head over to a site like Codecademy and get up and running instantly. But once you finish a few introductory courses, it’s not as easy to keep making progress. You need another approach.

« Continue »

How to Make Your Job More Interesting

By Duncan Smith Leave a Comment Jun 10 0

Self-Driving Car

Programming is creative work. Given a problem, you have to find a solution, then explain it to a computer in a way that humans can also understand. But unless you’re working on your own project, you don’t have total creative freedom. You have to use the tools and technologies that your team has selected, and your technical decisions are generally reviewed by other developers. On the other hand, it’s rare that you are told exactly how to solve the problem. If someone already knows that much about the solution, they could just implement it on their own. So it’s up to you to work out the details.

« Continue »

Proving That You Can Juggle Code

By Duncan Smith Leave a Comment Jun 3 0

Juggler

Peopleware is one of those books that show up on recommended reading lists for software development managers. Joel Spolsky was recommending it back in 2002. (It was written in 1987 and revised in 1999 and 2013). Chapter 16 (in the 3rd edition) begins with this vignette:

Circus Manager: How long have you been juggling?

Candidate: Oh, about six years.

Manager: Can you handle three balls, four balls, and five balls?

Candidate: Yes, yes, and yes.

Manager: Do you work with flaming objects?

Candidate: Sure.

Manager: …knives, axes, open cigar boxes, floppy hats?

Candidate: I can juggle anything.

Manager: Do you have a line of funny patter that goes with your juggling?

Candidate: It’s hilarious.

Manager: Well that sounds fine. I guess you’re hired.

Candidate: Umm… Don’t you want to see me juggle?

Manager: Gee, I never thought of that.

« Continue »

Asking for Advice is Easier than Taking It

By Duncan Smith Leave a Comment May 27 0

Advice

We have good options these days for getting answers to programming questions. Stack Overflow provides answers to fact-based questions. They can be targeted questions like How to sort a Collection? or even somewhat speculative questions like Why is there no SortedList in Java? that can be answered factually (does Java provide a list data structure that is always sorted?). Beyond that, things can get tricky on Stack Overflow, which has strict policies about question topics. For example, questions like Best ways to teach a beginner to program? tend to get locked and/or closed. Even on Programmers StackExchange, a question like How to deliberately practice computer programming?, which happens to be the top Google search result for deliberate practice for programmers, is considered off-topic. (Update 6/18/2016: And the question has finally been deleted).

As essential as Stack Overflow is for programmers, sometimes you need an answer to a question that doesn’t work there. For those types of questions, there is Quora. Although Quora does have mechanisms to maintain content quality, the rules are much looser. The advantage of this approach is that you can get answers to a wider variety of questions. The disadvantage is that it’s a lot harder to control quality. For example, Quora gets bombarded with questions of the form Is it too late for an X-year-old to learn how to program? But questions like How should I get started in competitive programming?, which would get closed on the Stack Exchange sites, can actually collect some useful answers on Quora.

There are other sources of programming information that people use for questions and answers. Reddit and Hacker News come to mind. They have voting and, in the case of Reddit, even an “accepted answer” feature. But in my experience, these sites are not as effective when used for Q&A. They are mainly designed to show a link to an article followed by comments from users. This can be adapted for Q&A, but it’s easier to use a site that was designed from the ground up for questions and answers.

« Continue »

  • « Previous Page
  • 1
  • …
  • 45
  • 46
  • 47
  • 48
  • 49
  • Next Page »

Stay in the Know

I'm trying out the latest learning techniques on software development concepts, and writing about what works best. Sound interesting? Subscribe to my free newsletter to keep up to date. Learn More
Unsubscribing is easy, and I'll keep your email address private.

Getting Started

Are you new here? Check out my review posts for a tour of the archives:

  • 2023 in Review: 50 LeetCode Tips
  • 2022 in Review: Content Bots
  • 2021 in Review: Thoughts on Solving Programming Puzzles
  • Lessons from the 2020 LeetCode Monthly Challenges
  • 2019 in Review
  • Competitive Programming Frequently Asked Questions: 2018 In Review
  • What I Learned Working On Time Tortoise in 2017
  • 2016 in Review
  • 2015 in Review
  • 2015 Summer Review

Archives

Recent Posts

  • Do Coding Bots Mean the End of Coding Interviews? December 31, 2024
  • Another Project for 2024 May 8, 2024
  • Dynamic Programming Wrap-Up May 1, 2024
  • LeetCode 91: Decode Ways April 24, 2024
  • LeetCode 70: Climbing Stairs April 17, 2024
  • LeetCode 221: Maximal Square April 10, 2024
  • Using Dynamic Programming for Maximum Product Subarray April 3, 2024
  • LeetCode 62: Unique Paths March 27, 2024
  • LeetCode 416: Partition Equal Subset Sum March 20, 2024
  • LeetCode 1143: Longest Common Subsequence March 13, 2024
Red-Green-Code
  • Home
  • About
  • Contact
  • Project 462
  • CP FAQ
  • Newsletter
Copyright © 2025 Duncan Smith