General Development Notes [closed] - code-snippets

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
During a typical day programming, I implement functions in a way that I would like to remember. For instance, say I tuned a DB insert function that, when I come across the situation again, I want to find what I did to resuse.
I need a place to keep the solution(what I did), and I need to find it somehow, which may be months or a year later. Using a mind map sort of idea, I was thinking about a personal wiki, but then I heard the stackoverflow podcast mention using this site for such a reason. Does anybody else keep track of slick things they've done so that they may find it sometime in the future. If so, what did you use, and in general, how do you use it?
i like to personal blog idea and using the stack for it. i'll try the idea of posting at the stack and then answering it myself, with the benefit of other people potentially giving their opinion.
As long a the stack will be around for a while :)

Jeff Atwood recommends using Stack Overflow for this kind of thing. Post a question (your problem) and then post an answer (the solution you found). This lets you share the information with the world, and maybe get some valuable feedback or better solutions.
(Wow, I got downvoted for repeating what Jeff Atwood said. I won't do that again, I promise.)

I use neomem all the time. I write notes to myself. Then I can later search for it.

You may find these questions useful
Where do you store your code snippets?
Tracking useful information
What is you preferred site for code snippets?

I use a personal Wiki, my del.icio.us bookmarks and my own blog for that. Usually my blog: When I learn something that I know I might stumble on again I write a short post in my blog.

I use WikiDPad or Wiki-On-A-Stick. It works not only for code snippets but also to take notes, record typical problems you get and how to solve them and documentation. Take my word for it, it makes your job a LOT more easier if you have proper notes... and add the power of interlinking to it and you have a killer resource. I have very bad memory and taking notes has improved my performance by an order of magnitude. It also saves you from having to ask someone the same question twice or thrice. Also, if anyone asks the same question, you can just helpfully point them to the wiki and they can read it and add to it if they need to.

The technical term for what you are thinking of is "code snippets", and googling for that will find you many programs designed to store them for a variety of platforms, including entirely web-based ones such as this one.

I set up dekiwiki on a server at work that my coworkers and I use for company specifics stuff but also for general programming tips that arise as well.

A simple wiki, may be useful. SeeTiki Wiki

I always put it on my blog. Not only am I able to get back to it later, there is also a chance that it can help someone else as well.

It's oldschool, but I keep notes in a notebook. Makes remembering solutions (or the problems that caused them) a bit easier. Usually I make 1-2 pages of notes a day.
The digital equivalent of this would be keeping a private blog or journal. Easy enough to add a search program to help you find stuff.
Worthwhile things that my boss might be interested in, like bugs and user calls all get entered into bug tracking software where it is more formally handled.

I use the excellent Trac project management system for my personal projects, and I use it's wiki as a brainstorming and note-taking tool. And, because it also hooks into the Subversion repository and the bug tracking system, I can link from my notes right to a particular section of code or a bug report.

I keep my personal projects on assembla. Wiki, Issue Tracking, Source Control... very useful.

Check to see if your editor has some kind of annotations feature. Ideally you could link a particular location in code with a small note, and store it in a centralized place. If it doesn't, that kind of plugin wouldn't be too hard to build, your biggest hurdle is going to be how to link the piece of code to a file (due to the volatile nature of code) and even that one isn't insurmountable.

Related

Learning libraries without books or tutorials [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
While many ask questions about where to find good books or tutorials, I'd like to take the opposite tack.
I consider myself to be an entry-level programmer ready to move up to mid-level. I have written code in c, c++, c#, perl, python, clojure, vb, and java, so I'm not completely clueless.
Where I see a problem in moving to the next level is learning to make better use of the literally hundreds upon hundreds of libraries available out there.
I seem paralyzed unless there is a specific example in a book or tutorial to hand-hold me, yet I often read in various forums where another programmer attempts to assist with a question. He/she will look through the docs or scan the available classes/methods in their favorite IDE and seem to grok what's going on in a relatively short period of time, even if they had no previous experience with that specific library or function.
I yearn to break the umbilical chord of constantly spending hour upon hour searching and reading, searching and reading, searching and reading. Many times there is no book or tutorial, or if there is, the discussion glosses over my specific needs or the examples shown are too far off the path for the usage I had in mind or the information is outdated and makes use of deprecated components or the library itself has fallen out of mainstream, yet is still perfectly usable (but no docs, books, or tutorials to hand-hold).
My question is: In the absence of books or tutorials, what is the best way to grok new or unfamiliar libraries?
I yearn to slicken the grok path so I can get down to the business of doing what I love most -- coding.
Give a good programmer a manual and they can figure it out quickly. It is not reading books or tutorials that makes you a good programmer, it is actually programming. Practice. You want to be better and learn better, write more code. Set small coding goals or think of a simple application to make. The more you write while looking up syntax in books and tutorials, the more those syntaxes and practices will "click." The reason many are able to "grok what's going on in a relatively short period of time" is because most programming is just syntax.
I'll give you a personal example. I picked up a book on Objective-C to figure out iPhone development. Sat there reading it all last summer. Didn't know squat when I sat down to write the application I designed up in Photoshop. Sure, the ideas are up in my head, but I did not have any practical knowledge to execute them yet. At first the syntax was extremely confusing to me, but I have a lot of experience with programming in general, animation, and UI design, so once I "memorized" the syntax, the code started flowing more naturally. Now I can write Obj-C pretty fluidly without a manual and have better understanding of what task will be difficult and what will be easy.
My question is: In the absence of books or tutorials, what is the best way to grok new or unfamiliar libraries?
How about doing what you just did: asking a question here on StackOverflow? From my experience, questions of the type "how to do task A, B or C using library X" get answered fairly quickly, especially if they are beginner questions, and no matter how esoteric or outdated the library might appear to the questioner. In fact, on several occasions I have witnessed such questions being answered by the developer of the library himself.
Even if a library seems to have "fallen out of mainstream" quite a long time ago, chances are that there are still a few people here on SO who are using it or have used it at some point in the past.
Most importantly, you no longer have to "spend hour upon hour searching and reading [...] discussions that gloss over [your] specific needs, or examples [that] are too far off the path for the usage [you] had in mind", because you can tailor your question here on SO to your very own personal needs.
Libraries provide developers with a domain specific set of concepts with which to solve problems, not unlike natural (spoken) languages. The similarity is deeper than that: the same way knowing more natural languages makes it easier to pick up a new one, experience with more libraries eases the transition into using a new one. There's no magick bullet here: the more experience you have, the faster you progress because you can anticipate what using the library to solve the task might look like.
That aside, these are the things I find help when picking up a new library:
working examples with source, like the SmartGWT showcase
small API/simplicity, like XStream or CvsReader
high quality documentation, like the one from hibernate
The bet way to learn without books is in my opinion to start programming. Solving the problems which are facing you will teach you how to use the library.
If you want to inspect or search or learn a .NET assembly - Reflector. Its free, and very powerful.
http://www.red-gate.com/products/reflector/

Interview questions to detect copy-and-paste coders [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
What questions can I ask an interview candidate that would allow me to know whether he's a "copy-and-paste coder"?
We're finding that even when candidates answer coding questions well in an interview, once on the job they'll still tend toward copying rather than refactoring.
Anyone else have similar experiences?
The first step in our interview process is a 5-minute online question. We give the candidates something like "FizzBuzz" or "Recursive fibonacci" or "Find factorial of n".
We don't have any rules. Nothing about pasting, or the code needing to compile, or what language it should be in - just do it. The 5-minute timeframe forces most candidates down one of two roads - write some pseudocode (or mostly-working code), or Google it.
When we get the answer, we Google the answer. Roughly half the time, it's been copied from some site. Our expectation is that if they spent 5 minutes finding the answer on Google, it should not only compile but it should be the absolute cleanest, best example of a solution for that problem out there. About half the time, the pasted answers are utter crap. We even get a number that didn't paste the entire snippet in, missed a whole chunk!
Copy-pasters tend to be exposed when they don't have a compiler to check them. Their modus operandi is paste, compile, tweak, compile. If they just paste a solution from a web page into another web page and submit it, they have nothing telling them they need to fix it.
This has worked extremely well - no one has made it to the phone screening who shouldn't.
I have people describe (in detail) a hard problem than they were proud of having solved. It's pretty easy to tell if they never really understood the details or simply hadn't worked through the problem themselves. Enthusiasm (sparkle even!) while describing the solution is a big plus. Gotta have a love for problem solving!
I've had this problem with candidates as well. The trick is to reduce the number of questions that only rely on definitions. You can provide them with code that needs refactoring and ask them what they would do to improve the code. This is a very open-ended question that shows how the candidate thinks.
A lot of interviewers like to ask questions where the candidate writes new code, unfortunately it is rare that developer is writing new things from scratch. Focus more on presenting existing code to the candidate and asking them to work with it to solve a problem.
Even with these questions it is possible to get a copy-and-paste coder as an interview is not necessarily how they will act in the real world.
That's my two cents.
I have two approaches, and always use both of them. They take fifteen minutes total, and I use them as the last third of an entry-level job interview.
Ask a very simple question based in theory.
"Are you familiar with the Vector class in Java? Write in pseudocode an implementation of the class supporting add, get, and clear." If they're not familiar, ask about ArrayList. If they're not familiar on either, explain what they do. The idea is that they can write a
linked list, and know what one is.
If I'm unsure at that point, ask them to write a method to sort the list manually; no using Arrays.sort() or similar. Have them explain a sorting algorithm. I don't care which one they choose, I don't care how efficient it is, any will do.
"What's the last thing you wrote that you were proud of?"
We wrote a test that basically checks to see if someone knows how/why to refactor.
We created a simple mockup application (allow the user to create predefined shapes and move them around on the screen) but introduced many types of errors on purpose.
One of these was copy & paste coding (the same functionality repeated in multiple places). Another was to embed logic for each shape into the event handlers. Terrible, terrible stuff - the worst ideas we could think of.
This allows us to see whether the candidate would recognize the opportunities for improvement and which approaches they would take to solve them.
It was a take home test and the candidate could either rewrite the application or provide notes on what kinds of changes they would make.
Not that this excuses it, but one reason developers may copy and paste code is that they don't understand the code that they're working with. For example, if you hire a C# or Java developer, and put him on a Fortran system and tell him to get work accomplished, he is going to copy and paste throughout that system due to lack of understanding.
In addition that that, quality of code can play a part in this. I know of one particular system that was not allowed to be refactored, but new changes had to be introduced. The developers had to do what they had to do to get the task done in a timely manner.
Of course, both of these scenarios don't excuse copy and paste coding, but it's worth a look inside the organization to understand why this may happen.
Don't ask common questions and/or ask them to explain their code.
You could modify your approach a bit. Do your tech review and phone screen, sure, just up the challenge of your coding test. Instead of asking simple programming test questions as a pre-screen, come up with a fairly complex programming project that they can solve - something can be scrounged up pretty quickly that can be pretty much ungoogle-able. Give them time after the interview to complete it, and require that it be well document and easy to understand. Then schedule a follow-up where you discuss the solution and ask the candidate things such as "What were you thinking here?!"
Examples of the types of projects of which I am thinking:
Write a program that plays a single hand of poker among three players
Write a flood-fill program for a random field provided by the user
Write a small check register program that accepts input from a .CSV and a starting balance, and outputs the current balance, allowing the user to view the transactions that have been read.
If they are on-site, make them whiteboard something. Lets you see how they will divide-and-conquor a problem in abstract. Watch what they focus on, what they omit, ask questions as they continue, and if you want to be a little evil - change the rules halfway through.
Break out parts of it and have them write the pseudocode on the whiteboard.

todo.txt and task management [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Apologies if this has been covered frequently, but I was wondering about how other people approach personal task management.
I've read (parts of) GTD, proceeded to get excited, installed a tonne of plug-ins all over the place, then let it all fall by the wayside. I've used todoist, outlook, google calendar, project. I've tried writing lists in a notepad, in 'notebook', on post-it-notes and in spreadsheets etc. None of it lasts.
Why is a simple and effective todo application so difficult to find? Because the application is so frequently used, I find that any small niggles with the application become overly exaggerated after a few days use.
So far, my favourite application is a variation of todo.txt called task
What do you use?
Sorry to be the bearer of bad news, but a "simple and effective todo application" is so hard to find because you are using the tool as a substitute for self-discipline and commitment. Statements like 'I've read parts of this and tried that and that and that but minor interface issues cause me to drop it in a few days' imply that you are looking for magic bullets and excuses.
Minor issues with the tools are a poor excuse to abandon the effort.
Pick a system and a tool and stick with it
No tool will give you the self-discipline and commitment necessary to change your habits
personal time-management is about changing your viewpoint and habits, not finding the "right" tool
caveat: some systems are more suitable than others for your personal work requirements. If you're a developer, a calendar-based system like Franklin Planner is probably not going to work, while a list-based system like GTD probably will.
Suggestion: google and review the various systems, pick one, and commit to it for at least a month. Try GTD and pen-and-paper, for example, then get fancy once the system is a habit. Once you know how you need to work the system and are committed to it, look for the perfect tool. In the meantime, the perfect tool is the enemy of the good practice, to mangle a quote ;-)
I use text files. Each contains a list of projects, separated by blank lines. Each line of a project's space includes syntax like:
'-': Item of interest
'*': TODO's
':': Code changes
'AWT': (Awaiting something external)
Text files live together and projects move in and out fluidly:
work.txt: Current work / active projects
deferred.txt: Stuff to do someday
done.txt: Finished; archived for records
The text file system is fast, effective, globally compatible and loads in a fraction of a second.
I think I'm like you (were, 2 years ago): too lazy to do anything until I find the perfect tool for it..
Yes, folks saying tools should never be mistaken to be a substitute for executing the plan, are absolutely right...
That said, one tool that seems "perfect enough" for me to drop thoses excuses for GTD: org-mode for Emacs. I really hope so, anyway.
I think this is almost a duplicate of How can I apply David Allen’s “Getting Things Done” as a programmer?
See also:
What Can Someone Do to Get Organized Around Here?
Time management tricks, tools & tips
What do you use to keep notes as a developer?
ToDoList is also an alternative
This is related to Task/issue tracking system with command-line interface which also mentioned todo.txt
Personally, I use the to do list on my Palm PDA, which syncs with Apple iCal.
I'm experimenting with better managing my time. I like starting out simple and building to complexity as it's required, rather than implement some behemoth bollocks that's hard to maintain.
To that end, i use simple lists.
http://tadalist.com
it's stupidly simple, free, and internets based so it follows me everywhere. winner
In our company we use Google Docs Spread Sheet - it's great beacuse you put all tasks into cells and you can share and coedit this document with others. It's very easy to use and doesn't require you to fill a lot of forms.
I use a sticky notes program called NoteZilla
Just scratch your task/idea/notes and forget about it. This is why I like sticky notes. No need to categorize, group. All that can still be done in NoteZilla.
I use TiddlyWiki. It's simple to use, all in one html file (so very portable).
It works great for me.
I'm echoing the above comment to some degree. For me, the tool is pretty much secondary to establishing the mindset and habits that would allow me to incorporate GTD principles in a consistent fashion. I really do love it, when I can get it to go. There's a nice sense of control and direction that comes when I can be disciplined about doing the small stuff - weekly sweeps, periodic reviews and all that.
My next GTD challenge is to get out of the trees so I can see the forest. :-) David Allen talks about the 50,000 foot, 30,000 foot, 10,000 foot views relating to goals. It's all very high-minded, but I have to get above 500 feet yet.
If you're familiar with GTD, there's a nice summary deck PDF over at DIY Planner:
http://www.diyplanner.com/diyp_official/diyp3cl/diyp3_gtdref_cl_2up.pdf
If you're a paper planner junkie (I am) the site's like crack :D
Hope it helps.
I use myLifeOrganized. The bottom line is you just need to start documenting the next thing you have to do on each task. MLO lets you easily and quickly do that.
It has a handy rapid task entry dialog and you can quickly enter data into it. You can document as much or as little as you want. This software, because of the ease of adding stuff to it, has saved my butt many times. It has helped me remember things that I had forgotten. I now wonder how many things I've forgotten over the years and didn't realize it.
I run it off a usb stick and I have it on my phone. I even use it to help me outline code.
As others have said, GTD is all about discipline: actually doing the things on your list. But, be sure to prioritize.
For my task list management, I currently use Remember the Milk, which is fairly handy with its IM integration (it sends IM reminders). My biggest challenge has been remembering to add the tasks, but I'm getting better at it, since somebody pointed out I could make a recurring task to remind me :P.

What are some solo developer programming methodologies? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
What are some solo developer programming methodologies for smaller projects?
Just about any development methodology will work in a solo environment except for those that explicitly require a team (such as side-by-side programming). But even then you could get around that by just creating some imaginary friends/teammates or developing a multiple personality disorder.
Even as a solo developer you can use methodologies applied to large development teams.
Write a Spec.
Layout a UML.
Do pencil-and-paper UI design.
Hallway testing: If your expect a large crowd, ask Mom if it's easy to use.
Peer review: You can build ad-hoc review teams with other solo developers.
Keep an up to date schedule.
and so on...
I solo develop all the time, and these practices keep me in line with my own work and give my bosses a great resource to know what I've done and how far along I am. And they keep me on track, to boot!
The rubber duck methodology comes to mind:
http://lists.ethernal.org/oldarchives/cantlug-0211/msg00174.html
Many agile techniques work great solo:
User interviews and stories: If you don't know what your users want, why would your software be useful?
A simple spec: Or even just be a mission statement. "Let people broadcast short messages to their subscriber lists." "Use in-degree to sort internet search results." "Let people collaboratively answer programming questions." Whatever.
A strictly-ordered todo list: Helpful to keep you from drowning in thoughts.
Tangents log: A good to-do list has a "to-don't" component, so you don't obsess over things you aren't going to do (yet).
YAGNI: Stay on target. This is very important when working by yourself, because no one is there to tell you "No! Don't reinvent dynamic typing in Java! Get back to the project." To-don't lists help with this.
Test-driven development: Writing tests forces you to think about the end result, rather than getting bogged down in implementation details. You'll get bogged down enough anyway; no need to make it worse.
Frequent releases: Make yourself stick to deadlines. "We'll have a feature-complete version that includes user stories 1-4 by Friday. It won't connect to the network or save data to disk, but XYZ..."
User testing: Have your buddies look at what you're making on a decently frequent schedule -- maybe once a month, maybe every week, depending on how many friends you have and how much beer/pizza you want to feed them. Pay very close attention to what they say and do and think when using the software.
And other things that only seem like they make sense in big projects can help a lot:
Source control: Install git. It's bone simple. Use it. Don't obsess over it.
Off-site backups: Y'know. In case of house fires or floods.
A blog: But you're only allowed to write there when a release comes out. ;) Also helps you build an audience for your product before it even ships.
Hope this helps! Solo programming on a large project can be very daunting.
Follow what is laid out in this Stack Overflow question:
What Tools/Techniques can benefit a solo developer?
Also. Use Source Control. You wouldn't believe how many times I've been bitten by that on personal projects.
There's this:
http://en.wikipedia.org/wiki/Personal_Software_Process
It's probably overkill
The issue is more a question of what you are comfortable with and what problems you hope to solve. Most methodologies are used by a solo developer at some point (pair programming is a notable exception). The issue is are you actually alone, or just working by yourself? I have found that it is invaluable to have people I can bounce ideas off of. Furthermore having someone else to look at you code (peer review) is a great way to find issues that you just cannot "see". So to agree with Aiden Bell "Programming on your oen is uncool."
I would try and connect to a community (like SO) where you can bounce ideas off of others. Then you need to build your methodology in such a way as to allow for interruptions when you send an idea out.
Does that make sense? Why are you programming alone?
Pat O
Not really an official methodology, but I have done a lot of solo development (independent consultant and ISV), and here are the things I have found to be important:
Find an online organization (like
oisv.com) to share thoughts and
ideas
Make sure you take time to interact
with actual people in the real world
Set project goals, deadlines, and
milestones
Take time to do appropriate up-front
design and project planning
Set aside working hours are stick to
them
Don't work too much and burn yourself
out
Nothing is ever perfect, so strive
for good code that works, not
perfection
Get some non-programming hobbies
This is more of trick than a methodology. When you're debugging, explain the bugs out loud to yourself as though you were trying to explain it to a co-worker. It feels silly, but forcing yourself to articulate the problem out loud often reveals what the problem is.

Does Twitter Help You Become a Better Developer or Distract You? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Since I've joined twitter I have found it very helpful to keep my finger on the pulse of technology and where it is going.
I follow many of the top Microsoft developers and find it interesting to see their struggles, opinions, and influences...
codinghorror / Jeff Atwood
shanselman / Scott Hanselman
haacked / Phil Haack
RickStrahl / Rick Strahl
RoyOsherove / Roy Osherove
It could be argued that twitter is just a distraction instead of an inspiration.
How how you find twitter as a medium for being technically savvy? Is it helpful or just a waste of time?
If you find it useful... who in the ASP.NET arena would you suggest following?
It's definitely a distraction, but I find that an amusing distraction here and there is good for me. I get more done in shorter amounts of time when my morale is high, and connecting to the outside world helps with that. I follow my wife, our cat (yep, has a twitter), several friends, a few ColdFusion & Flex evangelists, a SQL Server MVP, a few comedic relief tweeters, and fellow developers & friends.
Distraction, much like crackoverflow ;)
It depends on how you use it. It's no more or less distracting than an RSS reader or stackoverflow. If you ration usage to lunchtime, for example, then it's fine.
Distraction, I used for 1 week than stopped. I understand that you need "contact" in life but you need sometime to work too . I I require to ask a question, I go on the product forum or here to ask. If I need to contact someone I know, I use IM.
DISTRACTION! We're having to use it for project updates and can't help but waste time on it.
It's a distraction ... especially because most of the tweets are non-programming related ... i.e. Hanselman ... but that is the purpose of Twitter! So shame on me for being a follower!
I'd have to say distraction. I've posted a few tweets on problems I've had but no one ever "saves the day". Maybe my network just isn't big enough.
I tried to use twitter but I honestly didn't get what it could be useful for... So I stopped
I prefer to follow Redis, MySQL, mongoDB, memcache, Sphinx and other technology twitters. Usually it is really important to track new versions, bug fixes etc. Twitter is one of the best ways to do it. Following concrete people gives too much "time wasting" links and unuseful information.

Resources