什么是计划和组织的应用程序的开发使用C的最好方法? [英] What is the best way to plan and organize development of an application in C?

查看:99
本文介绍了什么是计划和组织的应用程序的开发使用C的最好方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只需要code在C几次,好像每次我这样做的时候,就变成了一些无法控制的野兽。

I've only had to code in C a few times, and it seems like every time I do, it becomes some unmanageable beast.

我已经做了我的大部分编程的C#和.NET让我很习惯了类风格的建筑,但我似乎无法把握组织C程序。我应该把那些在某个文件有关的功能,把函数定义在一个文件中,并处理其它等是否有良好的资源,在那里对这个问题?

I've done most of my programming in C# and .Net so I am very accustomed to the class style architecture, but I can't seem to grasp organization in C applications. Should I put functions that are related in a certain file, put function definitions in one file and processing in another, etc. Are there any good resources out there on this subject?

参见:<一href=\"http://stackoverflow.com/questions/674722/struggling-with-c-coming-from-object-oriented-land\">http://stackoverflow.com/questions/674722/struggling-with-c-coming-from-object-oriented-land

推荐答案

下面是一个比喻,可以帮助你:

Here is an analogy that might help you:

一个类是某种与一组函数来访问和操作该数据的数据结构。在 C 语言不提供任何语法糖为您安排这种关系,但你仍然可以建立你的code围绕这一理念。所以,只要做到这一点:设计你身边的一帮类的项目

A class is a data structure of some kind and a set of functions to access and manipulate that data. The c language doesn't provide any syntatic sugar to organize this relationship for you, but you can still build your code around this idea. So, just do it: design you project around a bunch of "classes".

code组织通常发生在两种形式之一:

Code organization generally takes on one of two forms:


  • 每个函数获得一个头(接口)以 .H 延伸和一个实现文件与 .C 扩展

  • 每个类(即一组相关的功能)得到一个头文件和一个实现文件。

  • Each function gets one header (interface) file with a .h extension and one implementation file with a .c extension
  • Each "class" (i.e. set of related functions) gets one header file and one implementation file.

所以,你已经知道如何做到这一点...

So, you already know how to do this...

这篇关于什么是计划和组织的应用程序的开发使用C的最好方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆