Questions tagged [code-complete]

"Code Complete" is a software development book, written by Steve McConnell and published in 1993 by Microsoft Press.

"Code Complete" is a software development book, written by Steve McConnell and published in 1993 by Microsoft Press. It is widely regarded as one of the best practical guides to programming.

23 questions
39
votes
10 answers

Classes to avoid (code complete)

I am somewhat confused about a paragraph in the code complete book. In the section "Classes to avoid" it reads: "Avoid classes named after verbs A class that has only behavior but no data is generally not really a class. Consider turning a class…
adrianm
  • 13,642
  • 4
  • 49
  • 91
24
votes
22 answers

How can I become a better C# programmer?

When you can create classes and do the simple stuff (GUI, reading text files, etc...), where do I go from here? I've started reading Code Complete 2nd Edition which is great but is more of a general programming book. What topics should I learn next?
Kredns
  • 34,183
  • 49
  • 147
  • 200
6
votes
5 answers

C++ advice from Code Complete on encapsulation?

In the section on "Good Encapsulation" in Code Complete, it is recommended to hide private implementation details. An example is given in C++. The idea is basically to completely separate the interface from the implementation, even in the class…
voithos
  • 60,391
  • 10
  • 90
  • 110
5
votes
1 answer

Visual Studio Code Does Not Suggest Python Object Attributes

I use VS Code v1.25.1 with the Python extension added. Although it suggests me the attributes and methods of libraries and classes, i.e. I type from sklearn. it makes suggestions like ensemble, exception etc., when I generate a numpy array x_data =…
5
votes
3 answers

Code Complete 2ed, composition and delegation

After a couple of weeks reading on this forum I thought it was time for me to do my first post. I'm currently rereading Code Complete. I think it's 15 years since the last time, and I find that I still can't write code ;-) Anyway on page 138 in…
Arlukin
  • 279
  • 1
  • 3
  • 12
4
votes
1 answer

XCode 4's code completion for methods in the .h file

In Xcode 3 I could first write my method in the implementation (.m) file; afterwards adding the same method to the interface (.h) file. At that point Xcode 3 made a code completion for the method written in the .m file. Sadly, Xcode 4 doesn't code…
Gee.E
  • 1,095
  • 11
  • 27
4
votes
1 answer

Be suspicious of classes of which there is only one instance

tl;dr -- What does the below quoted paragraph mean? Be suspicious of classes of which there is only one instance. A single instance might indicate that the design confuses objects with classes. Consider whether you could just create an object…
gerg
  • 691
  • 2
  • 8
  • 17
3
votes
3 answers

When to drop list Comprehension and the Pythonic way?

I created a line that appends an object to a list in the following manner >>> foo = list() >>> def sum(a, b): ... c = a+b; return c ... >>> bar_list = [9,8,7,6,5,4,3,2,1,0] >>> [foo.append(sum(i,x)) for i, x in enumerate(bar_list)] [None, None,…
Claudiordgz
  • 2,999
  • 1
  • 20
  • 43
2
votes
6 answers

What is a good naming convention for a routine that sets a global variable in the same class

Code Complete (Chapter 7, Section 3) says that a good function should be named for the value it returns and a good procedure name in a class should be named for what it does. When I write synchronized methods in Delphi (pre 2009) I sometimes need…
Peter Turner
  • 10,788
  • 9
  • 62
  • 106
2
votes
3 answers

NetBeans PHP Code Completion for Standard Functions

I have started to use NetBeans 6.9.1 for developing PHP projects. Although it does provide code completion to certain extent, but it's by no means complete. For example, commonly used functions such as implode,explode are not in the list for code…
Shamim Hafiz
  • 19,616
  • 36
  • 104
  • 164
2
votes
1 answer

Clang complete not working for unsaved files?

I've found code complete is not working (via libclang-c) for unsaved files (but works great for saved files). Code (not all): // show complete options void showComplete(CXTranslationUnit TU, char *src_filename, unsigned filesize, CXUnsavedFile…
4ntoine
  • 17,607
  • 16
  • 70
  • 175
2
votes
2 answers

Coding style: function and procedures coding standard

Ch 7.6 of Code Complete 2 is confusing me, I've attached some sample code (in php) mind telling me which style is the best? or suggest something better? thanks Style 1 public function register($user, $pass) { if($this->model->isRegistered($user) …
lemon
  • 8,737
  • 7
  • 35
  • 45
2
votes
2 answers

Code metrics for my project

I would like a program that goes in my TFS and weekly takes a snapshot of different metrics like code complexity, Lines of code, code coverage and other stuff and displays them in a graph. It would also be cool to see stuff by individual programmer,…
zachary
  • 8,673
  • 13
  • 60
  • 121
1
vote
0 answers

Is the behavior of declaring loop index in for loop header defined in C++ specification?

When I was reading Code Complete 2nd Edition, there was a piece of code: for ( int recordCount = 0; recordCount < MAX_RECORDS; recordCount++ ) { // looping code that uses recordCount } // intervening code for ( int recordCount = 0; recordCount <…
johnlinp
  • 575
  • 3
  • 15
1
vote
1 answer

Recommendation on using abbreviations in CamelCase from Code Complete

In the latest code review I was asked, why did I change the method name from GetHDRFrame to GetHdrFrame, while HDR is an abbreviation. I'm pretty sure there was such recommendation in Code Complete: when using abbreviations in CamelCase names, treat…
Mikhail
  • 18,155
  • 5
  • 56
  • 129
1
2