I'm starting a massive project for the first time. I was supposed to be one of the developers on this big project, and all of a sudden, the lead developer and his team backed out of the contract. Now I'm left managing this big project myself with a few junior developers under me and I'm trying to get a firm grasp on how this code should be broken up.
我是第一次开始一个大型项目。我应该是这个大项目的开发人员之一,突然之间,首席开发人员和他的团队退出了合同。现在,我自己和我之下的一些初级开发人员一起管理这个大项目,并且我正在努力掌握如何分解这些代码。
Logically, to me, the code should be broken up by the screens it has. I know that might not be how it SHOULD be done. so tell me, how SHOULD it be done? The app has about 6 screens total. It connects to a server, which maintains data about all other instances of the app on other phones. You could think of it as semi-social. it will also use the camera feature in certain parts, and it will definitely use geolocation. probably geofencing. It will obviously need an API to connect to the server. most likely more APIs than just the 1. I cant say much more about it without breaking an NDA.
从逻辑上讲,对我而言,代码应该由它拥有的屏幕分解。我知道可能不应该怎么做。所以告诉我,它应该怎么做?该应用程序总共约6个屏幕。它连接到服务器,该服务器维护有关其他手机上应用程序的所有其他实例的数据。你可以把它想象成半社交的。它还将在某些部分使用相机功能,它肯定会使用地理定位。可能是地理围栏。它显然需要一个API来连接到服务器。很可能更多的API而不仅仅是1.我不能在不破坏NDA的情况下更多地谈论它。
So again, my question pertains to how the code should be broken up to make it as efficient as possible. Personally, i'll be doing little coding on the project. probably mostly code reviews, unit testing and planning. Should it have 1 file per screen, and parts that are repeated should have their own classes? should it be MVC? We're talking a 30k line app here, at its best and most efficient. is there a better way to break the code apart than the ways I've listed?
所以,我的问题再次涉及如何分解代码以使其尽可能高效。就个人而言,我将对该项目进行少量编码。可能主要是代码审查,单元测试和规划。它应该每个屏幕有1个文件,重复的部分应该有自己的类吗?它应该是MVC吗?我们在这里谈论一个30k线应用程序,它是最好和最有效的。有没有比我列出的方式更好的方法来打破代码?
I guess my real question is, does anybody have good suggestions for books that would address my current issue? code clean was suggested, that's a good start. I've already read the mythical man month and code complete but they don't really address my current issue. i need suggestions for books that will help me learn how to structure and plan the creation of large code bases
我想我真正的问题是,是否有人对可以解决我当前问题的书籍提出了很好的建议?建议代码干净,这是一个良好的开端。我已经读过神话般的月份和代码完整但他们并没有真正解决我当前的问题。我需要书籍的建议,这将有助于我学习如何构建和规划大型代码库的创建
1 个解决方案
#1
2
As I'm sure you know this is a pretty vague question you could write a book answering it. In fact, I would recommend you read one, like Clean Code. But I'll take a stab at a 10,000 foot level overview.
我相信你知道这是一个非常含糊的问题,你可以写一本书回答它。事实上,我建议你阅读一个,如清洁代码。但是我会在10,000英尺的水平上进行一次尝试。
First if you are doing an iPhone app, you will want to use MVC because that is how Apple has setup their frame work. That means each screen will have (at least) a view-controller, possibly a custom view or NIB.
首先,如果您正在使用iPhone应用程序,您将需要使用MVC,因为这就是Apple设置框架的方式。这意味着每个屏幕将(至少)具有视图控制器,可能是自定义视图或NIB。
In addition you will want your view controllers pointing to your model (your business objects) and not the other way around. These objects should implement the use cases without any user interface logic. That is what your view-controller and view will be doing.
此外,您将希望视图控制器指向您的模型(您的业务对象),而不是相反。这些对象应该实现没有任何用户界面逻辑的用例。这就是您的视图控制器和视图将要执行的操作。
How do you break apart your use cases? Well, that's highly specific to your program and I won't be able to tell you with a (lot of) details. There isn't a single right answer. But in general you want to isolate each object from other objects as much as possible. If ever object reference ever other object, then you don't really have an OO design, you have a mess. Especially when you are talking about unit tests and TDD. If when you test one part you end up pulling in the whole system, then you are not testing just one small unit, are you?
你如何分解你的用例?嗯,这是非常具体的程序,我将无法告诉你(很多)细节。没有一个正确的答案。但总的来说,您希望尽可能地将每个对象与其他对象隔离开来。如果曾经对象引用过其他对象,那么你真的没有OO设计,你就是一团糟。特别是在谈论单元测试和TDD时。如果当你测试一个部件时最终拉入整个系统,那么你不是只测试一个小单元,不是吗?
Really though, get a good book about OO design. It's a large subject that nobody will be able to explain in a SO answer. I think Clean Code is a good start, maybe other people will have other suggestions?
实际上,获得一本关于OO设计的好书。这是一个很大的主题,没有人能够在SO答案中解释。我认为清洁代码是一个良好的开端,也许其他人会有其他建议?
#1
2
As I'm sure you know this is a pretty vague question you could write a book answering it. In fact, I would recommend you read one, like Clean Code. But I'll take a stab at a 10,000 foot level overview.
我相信你知道这是一个非常含糊的问题,你可以写一本书回答它。事实上,我建议你阅读一个,如清洁代码。但是我会在10,000英尺的水平上进行一次尝试。
First if you are doing an iPhone app, you will want to use MVC because that is how Apple has setup their frame work. That means each screen will have (at least) a view-controller, possibly a custom view or NIB.
首先,如果您正在使用iPhone应用程序,您将需要使用MVC,因为这就是Apple设置框架的方式。这意味着每个屏幕将(至少)具有视图控制器,可能是自定义视图或NIB。
In addition you will want your view controllers pointing to your model (your business objects) and not the other way around. These objects should implement the use cases without any user interface logic. That is what your view-controller and view will be doing.
此外,您将希望视图控制器指向您的模型(您的业务对象),而不是相反。这些对象应该实现没有任何用户界面逻辑的用例。这就是您的视图控制器和视图将要执行的操作。
How do you break apart your use cases? Well, that's highly specific to your program and I won't be able to tell you with a (lot of) details. There isn't a single right answer. But in general you want to isolate each object from other objects as much as possible. If ever object reference ever other object, then you don't really have an OO design, you have a mess. Especially when you are talking about unit tests and TDD. If when you test one part you end up pulling in the whole system, then you are not testing just one small unit, are you?
你如何分解你的用例?嗯,这是非常具体的程序,我将无法告诉你(很多)细节。没有一个正确的答案。但总的来说,您希望尽可能地将每个对象与其他对象隔离开来。如果曾经对象引用过其他对象,那么你真的没有OO设计,你就是一团糟。特别是在谈论单元测试和TDD时。如果当你测试一个部件时最终拉入整个系统,那么你不是只测试一个小单元,不是吗?
Really though, get a good book about OO design. It's a large subject that nobody will be able to explain in a SO answer. I think Clean Code is a good start, maybe other people will have other suggestions?
实际上,获得一本关于OO设计的好书。这是一个很大的主题,没有人能够在SO答案中解释。我认为清洁代码是一个良好的开端,也许其他人会有其他建议?