隨着項目開始增長,我傾向於將代碼邏輯地分割成幾個.h/.m文件。我喜歡這樣做,特別是當模型部分(MVC模式應用程序)是最重要的部分時。 一個合乎邏輯的例子是拆分數據加載/保存部分和數據編輯部分(例如所有計算方法)。但我現在面臨一些圓形聯的問題: // DATA SAVING/LOADING PART
#import "DataSavingLoading.h"
#import "DataCal
我有五個共享公用代碼的控制器。讓它們從父控制器繼承還是使用問題最好?例如: class PostsController < ApplicationController
before_action :authenticate, :set_project
layout 'projects'
end
class CommentsController < ApplicationC
我組織了我的程序,將每個實體分割到它自己的文件中。 這是這樣的。 main.c #include "student.h"
#include "subject.h"
#include "classroom.h"
#define PI 3.14
int sum(int a, int b);
student.h typedef struct st student;
student.c