Good programming practices (again)

I am using the search parameters as indicated in the search tips document:

https://www.ghielectronics.com/community/forum/search-tips

and it was enough for me so far.

What would make it better? Where do you hit the limitations and what kind?

The best way for me to answer your question is to post the ā€œa step toward best practices: serial portā€ example I mentioned in an earlier e-mail. However, Iā€™ll try to explain in words.

Suppose youā€™re relatively new to C# and .Net Micro and you need to do the very typical task of reading ASCII messages off a serial port. Maybe youā€™ve even read the GHI tutorial and now know something about event handlers. So you do a search for +serial +event +handler. You get 423 messages spread over 22 pages. Not particularly helpful. Now I search for + parse +ascii. Only a few posts but nothing that suggests it might be better not to use string if youā€™re worried about garbage collection.

Now suppose you search for +best +practice +serial and you get 1 thread with my post first. Now, my post would of course have well documented, complete codes example with all the necessary ā€œusingā€ statements, a list of the assemblies you need to reference and comments explaining why it is a best practice to declare things ā€œprivate staticā€ or public or whatever. It would also demonstrate the use of the strongly typed byte queue that @ taylorza showed me a while ago so the event handler demonstrates the best practice of only receiving characters and dumping them into the byte queue. And on top of that would be perfectly commented, complete code sample for parsing byte arrays without generating garbage, also a good (maybe best) practice.

In addition, there would hopefully be a bunch of additional posts in the same thread from others (probably way better qualified than me) with suggested improvements and probably some alternate code examples all with equally well thought out and beautifully explained reasons for why this approach or that approach is better for this application or that application.

Well it make sense to me anyway.

1 Like

My 2 cents : call it Better Software Development Practices <- to indicate that like everything else, it is improving over time (also the practice is called Software Development, not Programming. Programming is derogatory).

I think a good place to start is with a Code Standard Document. Most organizations have one, and they are fundamental to better development practices.

@ Gene - Exactly! I was trying to think of a good example to demonstrate the point, but yours is perfect. Iā€™m an experienced C# developer, and have 2+ years experience on this forum, and I still have trouble trying to find answers to my questions using the search tools provided. There are either too many posts or too few posts returned. The biggest problem with the search engine is that posts are not tagged or categorized, and when someone provides an answer that most of us agree is the best way to do something (i.e., best practice) it gets lost in the thousands of other posts with similar key words.

A suggestion:
why not return posts with highest +1 post points as first resultsā€¦ this way when people add those +1 to someoneā€™s post it means itā€™s good infoā€¦

1 Like

@ Jay Jay - Good suggestion.

Make it sortable by number of +1 in addition to already available sort modes.

This, plus the already suggested grouping of all Posts from one thread in a search result would make searching way easier.

1 Like