Is Brevity the Soul of Wit? - A Programmer's Perspective

General chat, humour, riddles, logic/lateral/word puzzles...
Post Reply
User avatar
hankinsohl
Posts: 10
Joined: Thu Nov 30, 2017 9:45 am

Is Brevity the Soul of Wit? - A Programmer's Perspective

Post by hankinsohl » Tue Dec 05, 2017 1:05 pm

Browsing the problem answer posts, it seems to me that Project Euler is far more mathematically oriented than programming oriented; brevity is beautiful and is reflected in many wonderful posts.

At the same time, production code in actual service often runs hard up against "beauty" - programming teammates will often be less talented than PE posters - even if you happen to work for an excellent company such as Microsoft/Amazon/Google/etc.

In a real-world environment, where code maintenance is essential, brevity must be sacrificed for clarity.

Too - the question of security - bounds checks, parameter verification, etc. - such checks are (IMO) rightly absent from most PE solution posts - but in production code - at least in debug builds - and certainly in code facing unchecked input - such checks are mandatory. Choice of programming language may lessen a lot of the security concerns of course.

And clarity too may be sacrificed - often elegant PE solutions are presented without a single comment - leaving the reader to work out what's happening.
==================
An anecdote -

I once wrote a clever bit of code and checked it into production. I then went on vacation.

When I returned, I noticed that my code had been changed - not only that - an error had been introduced into my previously error-free code.

Who was at fault? Me, or the errant code "correctors"?

I think I was mostly at fault - a simple comment in my code would have headed off "correction" by my teammates. I was fully aware that my code wasn't straight forward when I checked it in - nonetheless it was brief, and elegant.
===================
So, is PE mostly a mathematical site? or a programming site?

I think it's mostly mathematical for reasons outlined above.

What do you think?
Last edited by hankinsohl on Wed Dec 06, 2017 3:51 am, edited 1 time in total.
Image

User avatar
hk
Administrator
Posts: 9788
Joined: Sun Mar 26, 2006 9:34 am
Location: Haren, Netherlands

Re: Is Brevity the Sole of Wit? - A Programmer's Perspective

Post by hk » Tue Dec 05, 2017 1:25 pm

It's the interplay of math and programming that makes Project Euler interesting for most of its participants.
So it's neither mostly mathematical nor mostly programming.
But mostly both of the two.
Image

User avatar
hankinsohl
Posts: 10
Joined: Thu Nov 30, 2017 9:45 am

Re: Is Brevity the Sole of Wit? - A Programmer's Perspective

Post by hankinsohl » Tue Dec 05, 2017 1:40 pm

Thanks hk.

Out of curiosity, is your background mostly mathematical or programming or a mixture of both?
==============
Me?

My father was a PhD mathematician. I grew up loving math and science and early on in high school took a programming class which I loved.

My career took me into neither field - chemical engineering by degree I nonetheless did no chemical engineering work - but engineering in general instead.

My personal love of computers and programming led me to purchase one of the first Amiga computers as soon as they came out. A little later on I developed a disassembler for the Amiga (DSM) and sold roughly 1000 copies of the program commercially.

Later on in my career, I switched from engineering to programming - most recently having worked for Microsoft.

So my take on PE problems/solutions is from the background of a professional programmer with interest in math.
Image

User avatar
hk
Administrator
Posts: 9788
Joined: Sun Mar 26, 2006 9:34 am
Location: Haren, Netherlands

Re: Is Brevity the Sole of Wit? - A Programmer's Perspective

Post by hk » Tue Dec 05, 2017 1:45 pm

One more comment:
I think that "programming" and "software development and maintenance" are quite different things.
People working in the IT-sector are often unjustfiable thinking that "software development and maintenance" is the same as "programming".

(Btw, I'm not answering any questions about myself in public)
Image

traxex
Posts: 49
Joined: Thu Oct 19, 2017 12:30 pm

Re: Is Brevity the Sole of Wit? - A Programmer's Perspective

Post by traxex » Tue Dec 05, 2017 5:31 pm

Best practices are heuristics. Part of being a good programmer is understanding why they exist, what benefits and costs they have, and recognizing when they're not useful.

If a piece of code doesn't need to be maintained, spending time making it maintainable is a waste. If it doesn't need to be understood by other people, there's no need to make it understandable. Being able to write a run-once-and-forget program very quickly is a skill and does not preclude one from also being able to develop "serious" software. Some programmers have a very narrow view and believe that a 200-line program with a github repository, README.md file, semantic versioning, unit tests and continuous integration is always Better with a capital B than a one-line shell script that does the same thing.

For me, Project Euler and problem solving is a way to escape all the baggage of developing software at work and make programming fun again.

I would agree that Project Euler is more mathematical than algorithmic, compared to competitive programming sites. There are some algorithmic problems here, notably a bunch of dynamic programming in pre-200 problems, but overall they are the exception.
Technically, everyone is full of himself.

Post Reply