java自下而上和自上而下

Here you will learn about difference between top-down and bottom-up approach.

在这里,您将了解自顶向下和自底向上方法之间的区别。

Today we are going to have a comparative study of the two approaches being used in field of structured and object oriented programming. We shall start with a brief understanding of the both followed by comparison and conclusion.

今天,我们将对结构化和面向对象编程领域中使用的两种方法进行比较研究。 我们将从对两者的简要了解开始,然后进行比较和结论。

Image Source

图片来源

When talking in terms of computer science and programming, the algorithms we use to solve complex problems in a systematic and controlled way are designed on the basis of two approaches that is Top-down and Bottom-up approach. The ideology behind top-down approach is, a bigger problem is divided into some smaller sub-problems called modules, these modules are then solved individually and then integrated together to get the complete solution to the problem. In bottom-up approach on the other hand, the process starts with elementary modules and then combining together to get the desired result. Let us now quickly see in brief what these two approaches has to offer, how they differ from each other and what are the similarities.

在谈论计算机科学和程序设计时,我们基于自上而下和自下而上两种方法设计了用于系统地,受控地解决复杂问题的算法。 自顶向下方法背后的思想是,将一个较大的问题分为一些称为模块的较小子问题然后分别解决这些模块,然后将其集成在一起,以解决该问题。 另一方面,在自下而上的方法中,该过程从基本模块开始,然后组合在一起以获得所需的结果。 现在让我们快速简要地看一下这两种方法必须提供的内容,它们之间的区别和相似之处。

自上而下的方法 (Top-Down Approach)

The basic idea in top-down approach is to break a complex algorithm or a problem into smaller segments called modules, this process is also called as modularization. The modules are further decomposed until there is no space left for breaking the modules without hampering the originality. The uniqueness of the problem must be retained and preserved. The decomposition of the modules is restricted after achieving a certain level of modularity. The top-down way of solving a program is step-by-step process of breaking down the problem into chunks for organising and solving the sole problem. The C- programming language uses the top-down approach of solving a problem in which the flow of control is in the downward direction.

自顶向下方法的基本思想是将复杂的算法或问题分解为称为模块的较小段,此过程也称为模块化。 模块将进一步分解,直到没有剩余空间可以折断模块而又不影响其独创性。 问题的唯一性必须保留和保留。 在达到一定程度的模块化之后,将限制模块的分解。 自上而下解决程序的方法是将问题分解为大块的步骤,以组织和解决唯一的问题。 C编程语言使用自上而下的方法来解决控制流朝下的问题。

自下而上的方法 (Bottom-Up Approach)

As the name suggests, this method of solving a problem works exactly opposite of how the top-down approach works. In this approach we start working from the most basic level of problem solving and moving up in conjugation of several parts of the solution to achieve required results. The most fundamental units, modules and sub-modules are designed and solved individually, these units are then integrated together to get a more concrete base to problem solving.

顾名思义,这种解决问题的方法与自上而下的方法完全相反。 在这种方法中,我们从解决问题的最基本层面开始,然后逐步扩展解决方案的多个部分,以实现所需的结果。 最基本的单元,模块和子模块是单独设计和解决的,然后将这些单元集成在一起,可以为解决问题提供更具体的基础。

This bottom-up approach works in different phases or layers. Each module designed is tested at fundamental level that means unit testing is done before the integration of the individual modules to get solution. Unit testing is accomplished using low-level functions, that is another topic we will talk about later.

这种自下而上的方法可在不同的阶段或层中工作。 设计的每个模块都在基础级别上进行了测试,这意味着在集成各个模块以获取解决方案之前就已经进行了单元测试。 单元测试是使用低级功能完成的,这是我们稍后将讨论的另一个主题。

Let us now see a comparative study of both the strategies and try to understand what are common and odds among them.

现在让我们看一下这两种策略的比较研究,并尝试了解它们之间的共同点和不足之处。

自上而下与自下而上方法的区别 (Difference between Top-down and Bottom-up Approach)

Top-Down Approach Bottom-Up Approach
Divides a problem into smaller units and then solve it. Starts from solving small modules and adding them up together.
This approach contains redundant information. Redundancy can easily be eliminated.
A well-established communication is not required. Communication among steps is mandatory.
The individual modules are thoroughly analysed. Works on the concept of data-hiding and encapsulation.
Structured programming languages such as C uses top-down approach. OOP languages like C++ and Java, etc. uses bottom-up mechanism.
Relation among modules is not always required. The modules must be related for better communication and work flow.
Primarily used in code implementation, test case generation, debugging and module documentation. Finds use primarily in testing.
自上而下的方法 自下而上的方法
将问题分成较小的单元,然后再解决。 从解决小模块并将它们加在一起开始。
此方法包含冗余信息。 冗余可以轻松消除。
不需要良好的通信。 步骤之间的通信是强制性的。
各个模块都经过了彻底的分析。 研究数据隐藏和封装的概念。
C等结构化编程语言使用自上而下的方法。 诸如C ++和Java等OOP语言使用自下而上的机制。
模块之间的关系并不总是必需的。 模块必须相互关联,以实现更好的沟通和工作流程。
主要用于代码实现,测试用例生成,调试和模块文档。 主要用于测试中。

结论 (Conclusion)

After having a sound discussion on this we all should now have got a clear understanding of the two approaches. The top-down approach is the conventional approach in which decomposition of higher level system into lower level system takes place respectively. Talking about the bottom-up mechanism for algorithm designing, starting from designing lower abstraction modules and then integrating them to higher level provides better efficiency.

在对此进行了充分讨论之后,我们现在都应该对这两种方法有了清楚的了解。 自上而下的方法是常规方法,其中分别发生将较高级别的系统分解为较低级别的系统。 讨论算法设计的自下而上的机制,从设计较低的抽象模块开始,然后将它们集成到较高的级别提供了更高的效率。

We have seen the modules in top-down approach aren’t connected in a manner so that they can communicate well, so giving rise to redundancies, whereas in the later case the redundancies are omitted to large extent. The feature of information hiding and reusability provided by bottom-up approach makes this mechanism even more popular.

我们已经看到,自顶向下方法中的模块未以某种方式连接在一起,以便它们之间可以很好地通信,从而产生了冗余,而在后一种情况下,冗余被大量省略。 自下而上的方法提供的信息隐藏和可重用性功能使此机制更加流行。

Comment below if you have doubts regarding difference between Top-down and Bottom-up approach.

如果您对“自上而下”和“自下而上”方法之间的差异有疑问,请在下面评论。

翻译自: https://www.thecrazyprogrammer.com/2018/10/difference-between-top-down-and-bottom-up-approach.html

java自下而上和自上而下

java自下而上和自上而下_编程中自上而下和自下而上方法的区别相关推荐

  1. java当中有关循环的代码_有关Java循环的内容,编程中还是比较常用的,下面分享给大家几个循环的示例代码,练习一下。1、循环输出1到100之间所有能被3或能被4整除的数。pack...

    有关Java循环的内容,编程中还是比较常用的,下面分享给大家几个循环的示例代码,练习一下. 1.循环输出1到100之间所有能被3或能被4整除的数. package com.hz.loop02; /** ...

  2. java中调用js_java编程中实现调用js方法分析

    本文实例讲述了java编程中实现调用js方法.分享给大家供大家参考,具体如下: /* * 加载脚本引擎,并在java中调用js方法 */ public void test2() { ScriptEng ...

  3. python程序调用写好的代码_扣丁学堂浅谈Python编程中NotImplementedError的使用方法...

    扣丁学堂浅谈Python编程中NotImplementedError的使用方法 2018-07-04 14:08:02 2559浏览 本篇文章扣丁学堂 Python编程中raise可以实现报出错误的功 ...

  4. java foward_java 中sendredirect()和forward()方法的区别

    HttpServletResponse.sendRedirect与RequestDispatcher.forward方法都可以实现获取相应URL资源. sendRedirect实现请求重定向,forw ...

  5. java sendredirect报错_java 中sendredirect()和forward()方法的区别

    HttpServletResponse.sendRedirect与RequestDispatcher.forward方法都可以实现获取相应URL资源. sendRedirect实现请求重定向,forw ...

  6. android 名册源代码,Android编程中黑名单的实现方法

    本文实例讲述了Android编程中黑名单的实现方法.分享给大家供大家参考,具体如下: 说明:由于挂断电话android   api不是对外开放的,所以需要使用反射的方法得到拨打电话的服务. 1.将an ...

  7. python面向对象编程中方法和属性_Python面向对象编程中关于类和方法的学习笔记...

    Python面向对象编程中关于类和方法的学习笔记 类与类方法是面向对象的编程语言中必不可少的特性,本文总结了Python面向对象编程中关于类和方法的学习笔记,需要的朋友可以参考下 类和实例 pytho ...

  8. python面向对象编程中_Python面向对象编程中关于类和方法

    类和实例 python是一个面向对象的语言,而面向对象最重要的概念就是类和实例, 记得刚学习的时候不太理解这些概念,直到老师说了一句"物以类聚". 没错就是类, 归类 物以类聚 类 ...

  9. PHP中静态方法和实例化方法的区别

    文章来自:PHP中静态方法和实例化方法的区别 在PHP中类为什么要使用静态方法,有什么好处 不需要实例化?? 可以提高运行效率?? 这是一个经常被时时提出来的问题,很多时候我们以为理解了.懂了,但深究 ...

  10. php的mktime,php中time()和mktime()方法的区别

    time()函数是返回当前时间的.而mktime()函数的主要功能不是返回当前时间,而是格式化时间.虽然单独写mktime()而不加任何参数如:echo mktime()和echo time()的效果 ...

最新文章

  1. 沈向阳:微软每一个技术研发都会进行AI伦理道德评审
  2. 实用的bit 位操作
  3. python 字典的值可以为集合吗_转:Python字典与集合操作总结
  4. 阿里巴巴云原生 etcd 服务集群管控优化实践
  5. 几款开源的图形化Redis客户端管理软件推荐
  6. 4009-基于邻接表的边的删除(C++,附思路)
  7. 使用Xshell登录AWS的EC2云服务器和开启EC2上允许root+密码方式登录
  8. python join_python中join()方法介绍
  9. SpringBlade 2.0-RC3 发布,全新的微服务开发平台
  10. How to extract datafiles from asm diskgroup?
  11. 明解c语言答案第八章,明解C语言 入门篇 第八章答案
  12. 锁相环(PLL)专题一:鉴相器PD
  13. Unity 之 2D水插件推荐和模拟水效果制作分享
  14. MCGS实现按键按一次按下,再按一次弹起
  15. gb 28181的20位编码简介
  16. 「Cold Chain 2015国际冷链物流展」
  17. PCL中 的 kd-tree
  18. 电商行业前景怎么样?
  19. 亚马逊FBA基本介绍
  20. AI也有偏见,我们该如何信任它们?

热门文章

  1. 基于短时时域处理中短时能量和过零率的语音端点检测方法
  2. SystemVerilog: always, always_comb, alwasy_ff, always_latch
  3. 1分钟彻底搞懂关于nginx的proxy_pass
  4. python实训目的意义_Python-暑期实训day 1
  5. word排版案例报告_轻松搞定论文格式,这是 Word 排版的正确姿势
  6. python批量图片合并
  7. CoffeeScript 详解
  8. 首款物联网防火墙himqtt开源
  9. 端口输出报错**Error** test5.ASM(60) Constant too large
  10. 2021-2027全球与中国能源物流市场现状及未来发展趋势