|
My number one tip when it comes to the situation where you spend a few hours figuring something out which in the end was fairly simple is to get the habit in to work in seeing it from another angle.
Hard to explain without having it sound cliche but this is one of those situations where often enough you just need to air the problem with someone else. Try to explain it out loud to yourself as if you were describing it to someone or if possible find someone to discuss it with.
It can actually be fairly useful to speak with someone that's not a programmer/coder because then you have to dissect the problem in order for them to understand what's going on and that will help you solve it.
Another thing I might suggest is to take on something a little bigger to challenge yourself and grow. Something where you just can't jump straight in to and requires more design and thought.
A few years ago I made a simple tamaguchi game in c++ for my wife where she easily just could make new pngs to add more clothing, faces etc.
At the time it seemed so trivial to me, I knew what I wanted to do and started doing it. But after a little while it grew so complex that it was a total mess and I realise that I had spent more time writing a UI library than working on a game and once I striped the game away I had something that was easy to reuse. Helped reinforce oop principles in me after realising my mistakes as well as how to better plan ahead.
I like programming games because they can range from super simple to complex behemoths. You can work closely with the gpu, on network or AI and UI. It's also easy to get ideas, just pick something and see if you can replicate it and improve to your liking.
|
|
|
|
|
If I understand what you're saying correctly, the issue is the "impedance mismatch" between knowing what you want to do and knowing how to do it. It can be very impeding!
For example, when doing Python programming, I know various basic things about the language and its syntax, but I don't know hardly anything about useful 3rd party utilities (or even the ones built into Python!) and I certainly don't know the Pythonic way of doing things. So, for example, in C#, if I want to iterate over an IEnumerable , I have a couple options that are well known to me:
for (var foo in bunchAFoos) {...}
or
bunchAFoos.ForEach((f)=>...);
But how do I even write a loop in Python? Is:
for foo in bunchAFoos:
The best way? What if I want an index? Well, I use an extension method in C#:
bunchAFoos.ForEachWithIndex((idx, foo) => ...);
I have google the answer for Python:
for index, foo in enumerate(self.buncAFoos):
And is that the best way?
It gets worse -- do I wrap my Python functions in a class (their called "methods" then)? How do create a static singleton of the class? How do I derive from a class? How do I call the base method? Discovering that I have to explicitly call the base class constructor was a WTF is going wrong debugging session.
And then there's the debugger (using Visual Studio Python plugin). Why can't I step over the code>if statement? On a fluke, I changed:
if self.state == AppState.performing:
to:
if (self.state == AppState.performing):
and weirdly, I can now step over the if statement in the debugger. Why?
How do enums work in Python? (Answer: use the "enum" module and write it like non-member assignments, like this:
class AppState(Enum):
offline = 1
online = 2
unconfigured = 3
waiting = 4
performing = 5
TheOnlyRealTodd wrote: Is this pretty typical for a new coder or coders in general?
It's typical of coders with a new language/framework/platform. Don't even get me started on the lunacy of trying to launch an app at startup in Debian (or any *nix OS.)
So, to re-iterate, the impedance mismatch between knowing something because I've read a book or watched a few videos, vs. knowing how to do a thing, well, that can be cough shocking.
Marc
|
|
|
|
|
Marc Clifton wrote: the impedance mismatch between knowing something because I've read a book or watched a few videos, vs. knowing how to do a thing I call that "eloquent," and I speak from direct experience of a life-time of swimming upstream all-too-slowly against the flux of mis-matched impediments, kept afloat only by some talents in rationalization and denail
cheers, Bill
«There is a spectrum, from "clearly desirable behaviour," to "possibly dodgy behavior that still makes some sense," to "clearly undesirable behavior." We try to make the latter into warnings or, better, errors. But stuff that is in the middle category you don’t want to restrict unless there is a clear way to work around it.» Eric Lippert, May 14, 2008
modified 5-Jul-16 1:47am.
|
|
|
|
|
you hit denail on dehead with that one.
|
|
|
|
|
I've once spent 9 hours (starting at 21:12) trying to solve a problem and after I went to bed and got up, I found the easy solution that I simply missed because I was running head first into a wall instead of simply turning back and bypass the wall.
|
|
|
|
|
|
|
You are not alone bro! I also had the same problem and I am still have.It is about a month now since I have stated learning Mobile application development using Android Studio.Actually at the beginning I was total confused and I was about to "Give up" and Quit doing those stuffs but I remember my parents insists to me that Giving up is a sin,So I reflected those words and I see my self was about to commit sin so I continue learning.
I encourage you to struggle hard and you will succed.Also apart from that I recommend you to read this book "The Dip" written by Seth G. it will help you.
Remember that "Programmers of Today are the wizards of the Future"
|
|
|
|
|
A lot of really good advice here, and it reflects a lot of the techniques that I use to learn and get things done: Take on projects that stretch your capabilities, try to explain the issue to someone else, talking it over with another coder, etc.
One that I haven't seen mentioned is this: Really really put in the time to learn some deep basic knowledge, such as data structures, algorithms, and computation theory. I spent about 8 years doing coding work, both on the side and for pay, and I was pretty good at getting things done. I learned like you did, and felt pretty adept at taking on new challenges and expanding my repertoire.
Then the business I was in went under, and I used my GI bill to go back to school (rather than call myself unemployed) for a graduate degree in Comp Sci. Out of all the classes, it was the Algorithms, Data Structures, and Computational Theory classes that taught me the most--and it all came together in the class where we wrote a basic operating system from scratch.
(I had never had these classes before--I was an Aerospace Engineer from way back, and took up software development because, like you, I enjoyed it and had a lot more patience for coding than anything else)
When I went back to work (needed the money more than the degree), I found that my problem-solving skills (and even better, my "problem-recognition" skills) had improved tremendously. And because I had a better understanding of how computers work, the particular language I was working in became less important than figuring out what the software needed to do as a whole.
You don't have to actually take classes, but it's like automobile maintenance: If you don't understand the basics of electrical circuits and 4-stroke engines, you can still get the job done, but it'll take a lot longer and there's a lot of "magic" involved. Learning the underlying principles of hash tables, stacks, sorting algorithms, and memory management makes a world of difference.
...and BTW, even with all this, I still run into problems that take me 2-3 days to figure out, even if the final answer is simple. But it's the ability to find this "simple" solution that we get paid for, right?
vuolsi così colà dove si puote
ciò che si vuole, e più non dimandare
--The answer to Minos and any question of "Why are we doing it this way?"
|
|
|
|
|
You believe you are proficient, but I'm afraid all you really know is how to spell the keywords. With many years of practice, you will suffer less frequently from these periods of inability to move forward. Bad news, huh?
It's called "coder's block": writer's block for code. You get over coders block by...wait for it...coding. Partly this means experience coding, but it also means not allowing yourself to be blocked. You must write something.
- If you can't write a function, try writing just the function signature
- If you can't write the signature, try writing an introductory comment
- Try writing a unit test that uses the function, to see how you will use the thing you want to write
- Get out a blank sheet of notepaper and try writing a few phrases or keywords about what you want the function to do
Just as soon as you have written something, you will begin to review it mentally. You'll begin to see if you like it. You'll engage whole new subsystems of your brain to work on the problem.
A separate problem is that you have to have some familiarity with each library you use. It takes a long time to look at all the documentation for a library to see if it has a function you need. Not so long to remember what order the arguments are in. But this is just temporary.
|
|
|
|
|
John Robbins has some good advice on debugging with .NET. Pick up one of his books or see what is otherwise available. I haven't checked this particular presentation, but channel 9 has this presentation.[^]
My professor (who became a Touring award winner...) had a very specific principle for proving code: Define INVARIANTS in your code. That means you have known expectations of variables (and state) at specific points. Test for those. .NET provides Debug.Assert which allows you to test for those invariants and doesn't require you to remove them for production (just use build configuration).
Add to that by considering test first (test driven development), or at least keep testing in mind when you code.
Many other great insights posted here - I can vouch for pretty much all of them after almost 40 years in the business.
When it comes to extended sessions - that boils down to how much you can mentally keep track of and how TIRED you are. Some times, nothing beats being "in the zone" for an extended period, but only when you are actually making noticeable progress or following multiple leads. But when you start to spin your wheels, you are probably better off taking a break.
I like to do Sudoku puzzles, and the ones I have trouble with at night before bed are usually quickly solved the next morning. Same thing with programming challenges.
* Learn and practice using patterns.
* Describe problems out loud or in writing. That forces you to think them through.
* Learn by teaching others. That challenges you to know.
* Don't rely on what you know - things change. I have had to unlearn more things that I have had to learn. Look it up.
* Get comfortable with a good search engine (I like DuckDuckGo.com). Realize that not all answers on line are good answers.
* Have fun coding, and don't forget to have a life away from a keyboard and screen.
|
|
|
|
|
I am a newbie too. I went through all the tutorial videos a couple of times. I entered the code that was offered up by the speakers and played with it.
Once I got past that and wanted more, I found that there are problem sites that present problems or challenges to be solved. SPOJ and HackerRank are ones that I am familiar with. Sometimes I spend days on a problem. The problems introduced me to all kinds of programming and debugging techniques that I normally would not have encountered otherwise. Working on XOR-ing the contiguous subarrays right now. Programming Problems and Competitions :: HackerRank[^] Driving me crazy.
Being an feisty old guy with just a desire to learn something new I am under no pressure to learn as fast and as much as I can. I program for fun. Do not want a job or need a job. I just feel a big sense of accomplishment when I get a problem right. It is sad that most of my age group just sit around and watch TV all day in their retirement and don't even know how to turn on a computer.
Keep plugging and try the stuff on Hacker Rank or SPOJ. I use Snippet Manager to collect bits and pieces of code that I constantly refer back to. It seems pretty primitive but I cannot find anything better.
|
|
|
|
|
I reached in the fridge for the milk to put in my morning coffee (heartstarter). The expiry date on the bottle was 11 JUL 16 . My initial reaction was "That's 5 years out of date!"
Cheers,
Peter
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
|
|
|
|
|
ah huh .. and your profile says you're here in Aus .. now, if you were in USA, I might understand
|
|
|
|
|
I've been using sortable date formats for years, so year month day is a natural parse for me. I just have to remember that it's not natural to everyone else.
Cheers,
Peter
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
|
|
|
|
|
well, I guess, this being a forum inhabited largely by software type people, thats acceptable (elsewhere, I have to force myself not to '/' my '0's because I get funny looks .....)
|
|
|
|
|
It's the sortable date layout. I've done the same kind of thing myself.
I wanna be a eunuchs developer! Pass me a bread knife!
|
|
|
|
|
Good News Of The Day
Sharp-Shooting Army Veteran Saves Bald Eagle Stuck Up A Tree[^]
What do you get when you cross a joke with a rhetorical question?
The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism.
Do questions with multiple question marks annoy you???
|
|
|
|
|
|
You can trust Calvin to be mercenary about anything!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
I really miss Watterson, but he wanted to quit when he was on the top, and I guess he did just that.
|
|
|
|
|
same with Gary Larson! I like Watterson, but Larson...
|
|
|
|
|
Went to Google Earth and then to the Web version: Google Earth[^]
And got this message:
Your browser does not support the Google Earth Plug-in
Please try again with the latest version of one of these browsers:
Firefox (32-bit)
Internet Explorer 7-9 and 10-11 with Compatibility View (32-bit).
Learn more »
To view maps in 3D, you need the Google Earth Plug-in
My browser? Google Chrome...
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Same here.
Marc
|
|
|
|
|
It seems Google do not develop actively Google Earth anymore, you have Google Maps instead...
Skipper: We'll fix it.
Alex: Fix it? How you gonna fix this?
Skipper: Grit, spit and a whole lotta duct tape.
|
|
|
|
|